diff --git a/src/StackHCI/StackHCI.Autorest/generate-info.json b/src/StackHCI/StackHCI.Autorest/generate-info.json index 1d53db7efc87..e96a563b1d35 100644 --- a/src/StackHCI/StackHCI.Autorest/generate-info.json +++ b/src/StackHCI/StackHCI.Autorest/generate-info.json @@ -1,8 +1,8 @@ { + "autorest_core": "3.9.7", "node": "v14.15.5", "autorest_powershell": "3.0.512", - "autorest_core": "3.9.7", "autorest_modelerfour": "4.15.414", - "autorest": "`-- (empty)", - "swagger_commit": "11bbc2b1df2e915a2227a6a1a48a27b9e67c3311" + "swagger_commit": "4a361fccb94e82da94a239d3563f1e3e3b9d007d", + "autorest": "`-- (empty)" } diff --git a/src/StackHCI/StackHCI.sln b/src/StackHCI/StackHCI.sln index 1aa015ee559f..6008a5472772 100644 --- a/src/StackHCI/StackHCI.sln +++ b/src/StackHCI/StackHCI.sln @@ -19,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StackHCI.Autorest", "StackH EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StackHCI", "StackHCI\StackHCI.csproj", "{076C5B97-2EE6-4553-91F8-31FF721E4CEE}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.StackHCIVm", "StackHCIVm.Autorest\Az.StackHCIVm.csproj", "{AAFE074D-EAE9-4FC9-834A-8B42ED5DCE44}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -60,5 +62,9 @@ Global {076C5B97-2EE6-4553-91F8-31FF721E4CEE}.Debug|Any CPU.Build.0 = Debug|Any CPU {076C5B97-2EE6-4553-91F8-31FF721E4CEE}.Release|Any CPU.ActiveCfg = Release|Any CPU {076C5B97-2EE6-4553-91F8-31FF721E4CEE}.Release|Any CPU.Build.0 = Release|Any CPU + {AAFE074D-EAE9-4FC9-834A-8B42ED5DCE44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AAFE074D-EAE9-4FC9-834A-8B42ED5DCE44}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AAFE074D-EAE9-4FC9-834A-8B42ED5DCE44}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AAFE074D-EAE9-4FC9-834A-8B42ED5DCE44}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/src/StackHCI/StackHCI/Az.StackHCI.psd1 b/src/StackHCI/StackHCI/Az.StackHCI.psd1 index 29aa06ad0032..66a9025447d5 100644 --- a/src/StackHCI/StackHCI/Az.StackHCI.psd1 +++ b/src/StackHCI/StackHCI/Az.StackHCI.psd1 @@ -55,7 +55,8 @@ RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.13.1'; }) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = 'StackHCI.Autorest/bin/Az.StackHCI.private.dll', - 'StackHCI.Autorest\bin\Az.StackHCI.private.dll' + 'StackHCI.Autorest\bin\Az.StackHCI.private.dll', + 'StackHCIVm.Autorest\bin\Az.StackHCIVm.private.dll' # Script files (.ps1) that are run in the caller's environment prior to importing this module. # ScriptsToProcess = @() @@ -65,11 +66,13 @@ RequiredAssemblies = 'StackHCI.Autorest/bin/Az.StackHCI.private.dll', # Format files (.ps1xml) to be loaded when importing this module FormatsToProcess = 'StackHCI.Autorest/Az.StackHCI.format.ps1xml', - 'StackHCI.Autorest\Az.StackHCI.format.ps1xml' + 'StackHCI.Autorest\Az.StackHCI.format.ps1xml', + 'StackHCIVm.Autorest\Az.StackHCIVm.format.ps1xml' # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess NestedModules = @('StackHCI.Autorest/Az.StackHCI.psm1', - 'StackHCI.Autorest\Az.StackHCI.psm1') + 'StackHCI.Autorest\Az.StackHCI.psm1', + 'StackHCIVm.Autorest\Az.StackHCIVm.psm1') # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. FunctionsToExport = 'Add-AzStackHCIVMAttestation', 'Disable-AzStackHCIAttestation', @@ -86,7 +89,30 @@ FunctionsToExport = 'Add-AzStackHCIVMAttestation', 'Disable-AzStackHCIAttestatio 'Remove-AzStackHciArcSetting', 'Remove-AzStackHciCluster', 'Remove-AzStackHciExtension', 'Remove-AzStackHCIRemoteSupport', 'Remove-AzStackHCIVMAttestation', 'Set-AzStackHCI', - 'Unregister-AzStackHCI', 'Update-AzStackHciCluster' + 'Unregister-AzStackHCI', 'Update-AzStackHciCluster', + 'Add-AzStackHCIVmVirtualMachineDataDisk', + 'Add-AzStackHCIVmVirtualMachineNetworkInterface', + 'Get-AzStackHCIVmImage', 'Get-AzStackHCIVmLogicalNetwork', + 'Get-AzStackHCIVmNetworkInterface', 'Get-AzStackHCIVmStoragePath', + 'Get-AzStackHCIVmVirtualHardDisk', 'Get-AzStackHCIVmVirtualMachine', + 'New-AzStackHCIVmImage', 'New-AzStackHCIVmLogicalNetwork', + 'New-AzStackHCIVmNetworkInterface', 'New-AzStackHCIVmStoragePath', + 'New-AzStackHCIVmVirtualHardDisk', 'New-AzStackHCIVmVirtualMachine', + 'Remove-AzStackHCIVmImage', 'Remove-AzStackHCIVmLogicalNetwork', + 'Remove-AzStackHCIVmNetworkInterface', + 'Remove-AzStackHCIVmStoragePath', + 'Remove-AzStackHCIVmVirtualHardDisk', + 'Remove-AzStackHCIVmVirtualMachine', + 'Remove-AzStackHCIVmVirtualMachineDataDisk', + 'Remove-AzStackHCIVmVirtualMachineNetworkInterface', + 'Restart-AzStackHCIVmVirtualMachine', + 'Start-AzStackHCIVmVirtualMachine', + 'Stop-AzStackHCIVmVirtualMachine', 'Update-AzStackHCIVmImage', + 'Update-AzStackHCIVmLogicalNetwork', + 'Update-AzStackHCIVmNetworkInterface', + 'Update-AzStackHCIVmStoragePath', + 'Update-AzStackHCIVmVirtualHardDisk', + 'Update-AzStackHCIVmVirtualMachine' # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. CmdletsToExport = @() diff --git a/src/StackHCI/StackHCI/help/Add-AzStackHCIVmVirtualMachineDataDisk.md b/src/StackHCI/StackHCI/help/Add-AzStackHCIVmVirtualMachineDataDisk.md new file mode 100644 index 000000000000..3d7117755669 --- /dev/null +++ b/src/StackHCI/StackHCI/help/Add-AzStackHCIVmVirtualMachineDataDisk.md @@ -0,0 +1,196 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/add-azstackhcivmvirtualmachinedatadisk +schema: 2.0.0 +--- + +# Add-AzStackHCIVmVirtualMachineDataDisk + +## SYNOPSIS +The operation to add a data disk to a virtual machine. + +## SYNTAX + +### ByResourceId (Default) +``` +Add-AzStackHCIVmVirtualMachineDataDisk -ResourceId [-DataDiskId ] [-DataDiskName ] + [-DataDiskResourceGroup ] [-WhatIf] [-Confirm] [] +``` + +### ByName +``` +Add-AzStackHCIVmVirtualMachineDataDisk -Name -ResourceGroupName [-SubscriptionId ] + [-DataDiskId ] [-DataDiskName ] [-DataDiskResourceGroup ] [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION +The operation to add a data disk to a virtual machine. + +## EXAMPLES + +### Example 1: Add a Data Disk to a Virtual Machine +```powershell +Add-AzStackHCIVmVirtualMachineDataDisk -Name 'testVm' -ResourceGroupName 'test-rg' -DataDiskName 'testVhd' +``` + +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` + +This command attaches a data disk to the virtual machine in the specified resource group. + +## PARAMETERS + +### -DataDiskId +List of data disks to be attached to the virtual machine passed in Id format + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataDiskName +List of data disks to be attached to the virtual machine passed by Name + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataDiskResourceGroup +Resource Group of the Data Disks + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual machine + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: VirtualMachineName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the VM + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Add-AzStackHCIVmVirtualMachineNetworkInterface.md b/src/StackHCI/StackHCI/help/Add-AzStackHCIVmVirtualMachineNetworkInterface.md new file mode 100644 index 000000000000..49bfafeabb37 --- /dev/null +++ b/src/StackHCI/StackHCI/help/Add-AzStackHCIVmVirtualMachineNetworkInterface.md @@ -0,0 +1,196 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/add-azstackhcivmvirtualmachinenetworkinterface +schema: 2.0.0 +--- + +# Add-AzStackHCIVmVirtualMachineNetworkInterface + +## SYNOPSIS +The operation to add a network interface to a virtual machine. + +## SYNTAX + +### ByResourceId (Default) +``` +Add-AzStackHCIVmVirtualMachineNetworkInterface -ResourceId [-NicId ] [-NicName ] + [-NicResourceGroup ] [-WhatIf] [-Confirm] [] +``` + +### ByName +``` +Add-AzStackHCIVmVirtualMachineNetworkInterface -Name -ResourceGroupName + [-SubscriptionId ] [-NicId ] [-NicName ] [-NicResourceGroup ] [-WhatIf] + [-Confirm] [] +``` + +## DESCRIPTION +The operation to add a network interface to a virtual machine. + +## EXAMPLES + +### Example 1: Add a Network Interface to a Virtual Machine +```powershell +Add-AzStackHCIVmVirtualMachineNetworkInterface -Name 'testVm' -ResourceGroupName 'test-rg' -NicName 'testNic' +``` + +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` + +This command attaches a network interface to the virtual machine in the specified resource group. + +## PARAMETERS + +### -Name +Name of the virtual machine + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: VirtualMachineName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicId +NetworkInterfaces - list of network interfaces to be attached to the virtual machine in id format + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicName +NetworkInterfaces - list of network interfaces to be attached to the virtual machine in name format + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicResourceGroup +Resource Group of the Network Interfaces + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Id of the Virtual Machine + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Az.StackHCI.md b/src/StackHCI/StackHCI/help/Az.StackHCI.md index 8a3533652a92..b905803189f7 100644 --- a/src/StackHCI/StackHCI/help/Az.StackHCI.md +++ b/src/StackHCI/StackHCI/help/Az.StackHCI.md @@ -14,6 +14,12 @@ Microsoft Azure PowerShell: StackHci cmdlets ### [Add-AzStackHCIVMAttestation](Add-AzStackHCIVMAttestation.md) Add-AzStackHCIVMAttestation configures guests for AzureStack HCI IMDS Attestation. +### [Add-AzStackHCIVmVirtualMachineDataDisk](Add-AzStackHCIVmVirtualMachineDataDisk.md) +The operation to add a data disk to a virtual machine. + +### [Add-AzStackHCIVmVirtualMachineNetworkInterface](Add-AzStackHCIVmVirtualMachineNetworkInterface.md) +The operation to add a network interface to a virtual machine. + ### [Disable-AzStackHCIAttestation](Disable-AzStackHCIAttestation.md) Disable-AzStackHCIAttestation disables IMDS Attestation on the host @@ -47,6 +53,24 @@ Gets Remote Support Session History Details. ### [Get-AzStackHCIVMAttestation](Get-AzStackHCIVMAttestation.md) Get-AzStackHCIVMAttestation shows a list of guests added to IMDS Attestation on a node. +### [Get-AzStackHCIVmImage](Get-AzStackHCIVmImage.md) +Gets a gallery image + +### [Get-AzStackHCIVmLogicalNetwork](Get-AzStackHCIVmLogicalNetwork.md) +Gets a logical network + +### [Get-AzStackHCIVmNetworkInterface](Get-AzStackHCIVmNetworkInterface.md) +Gets a network interface + +### [Get-AzStackHCIVmStoragePath](Get-AzStackHCIVmStoragePath.md) +Gets a storage container + +### [Get-AzStackHCIVmVirtualHardDisk](Get-AzStackHCIVmVirtualHardDisk.md) +Gets a virtual hard disk + +### [Get-AzStackHCIVmVirtualMachine](Get-AzStackHCIVmVirtualMachine.md) +Gets a virtual machine + ### [Install-AzStackHCIRemoteSupport](Install-AzStackHCIRemoteSupport.md) Installs Remote Support. @@ -65,6 +89,30 @@ Create an HCI cluster. ### [New-AzStackHciExtension](New-AzStackHciExtension.md) Create Extension for HCI cluster. +### [New-AzStackHCIVmImage](New-AzStackHCIVmImage.md) +The operation to create an image. +Please note some properties can be set only during image creation. + +### [New-AzStackHCIVmLogicalNetwork](New-AzStackHCIVmLogicalNetwork.md) +The operation to create or update a logical network. +Please note some properties can be set only during logical network creation. + +### [New-AzStackHCIVmNetworkInterface](New-AzStackHCIVmNetworkInterface.md) +The operation to create or update a network interface. +Please note some properties can be set only during network interface creation. + +### [New-AzStackHCIVmStoragePath](New-AzStackHCIVmStoragePath.md) +The operation to create or update a storage container. +Please note some properties can be set only during storage container creation. + +### [New-AzStackHCIVmVirtualHardDisk](New-AzStackHCIVmVirtualHardDisk.md) +The operation to create or update a virtual hard disk. +Please note some properties can be set only during virtual hard disk creation. + +### [New-AzStackHCIVmVirtualMachine](New-AzStackHCIVmVirtualMachine.md) +The operation to create or update a virtual machine. +Please note some properties can be set only during virtual machine creation. + ### [Register-AzStackHCI](Register-AzStackHCI.md) Register-AzStackHCI creates a Microsoft.AzureStackHCI cloud resource representing the on-premises cluster and registers the on-premises cluster with Azure. @@ -83,9 +131,42 @@ Removes Remote Support. ### [Remove-AzStackHCIVMAttestation](Remove-AzStackHCIVMAttestation.md) Remove-AzStackHCIVMAttestation removes guests from AzureStack HCI IMDS Attestation. +### [Remove-AzStackHCIVmImage](Remove-AzStackHCIVmImage.md) +The operation to delete an image. + +### [Remove-AzStackHCIVmLogicalNetwork](Remove-AzStackHCIVmLogicalNetwork.md) +The operation to delete a logical network. + +### [Remove-AzStackHCIVmNetworkInterface](Remove-AzStackHCIVmNetworkInterface.md) +The operation to delete a network interface. + +### [Remove-AzStackHCIVmStoragePath](Remove-AzStackHCIVmStoragePath.md) +The operation to delete a storage container. + +### [Remove-AzStackHCIVmVirtualHardDisk](Remove-AzStackHCIVmVirtualHardDisk.md) +The operation to delete a virtual hard disk. + +### [Remove-AzStackHCIVmVirtualMachine](Remove-AzStackHCIVmVirtualMachine.md) +The operation to delete a virtual machine. + +### [Remove-AzStackHCIVmVirtualMachineDataDisk](Remove-AzStackHCIVmVirtualMachineDataDisk.md) +The operation to delete a data disk from a virtual machine. + +### [Remove-AzStackHCIVmVirtualMachineNetworkInterface](Remove-AzStackHCIVmVirtualMachineNetworkInterface.md) +The operation to delete a network interface from a virtual machine. + +### [Restart-AzStackHCIVmVirtualMachine](Restart-AzStackHCIVmVirtualMachine.md) +The operation to restart a virtual machine instance. + ### [Set-AzStackHCI](Set-AzStackHCI.md) Set-AzStackHCI modifies resource properties of the Microsoft.AzureStackHCI cloud resource representing the on-premises cluster to enable or disable features. +### [Start-AzStackHCIVmVirtualMachine](Start-AzStackHCIVmVirtualMachine.md) +The operation to start a virtual machine instance. + +### [Stop-AzStackHCIVmVirtualMachine](Stop-AzStackHCIVmVirtualMachine.md) +The operation to stop a virtual machine instance. + ### [Unregister-AzStackHCI](Unregister-AzStackHCI.md) Unregister-AzStackHCI deletes the Microsoft.AzureStackHCI cloud resource representing the on-premises cluster and unregisters the on-premises cluster with Azure. The registered information available on the cluster is used to unregister the cluster if no parameters are passed. @@ -93,3 +174,21 @@ The registered information available on the cluster is used to unregister the cl ### [Update-AzStackHciCluster](Update-AzStackHciCluster.md) Update an HCI cluster. +### [Update-AzStackHCIVmImage](Update-AzStackHCIVmImage.md) +The operation to update an image. + +### [Update-AzStackHCIVmLogicalNetwork](Update-AzStackHCIVmLogicalNetwork.md) +The operation to update a logical network. + +### [Update-AzStackHCIVmNetworkInterface](Update-AzStackHCIVmNetworkInterface.md) +The operation to update a network interface. + +### [Update-AzStackHCIVmStoragePath](Update-AzStackHCIVmStoragePath.md) +The operation to update a storage container. + +### [Update-AzStackHCIVmVirtualHardDisk](Update-AzStackHCIVmVirtualHardDisk.md) +The operation to update a virtual hard disk. + +### [Update-AzStackHCIVmVirtualMachine](Update-AzStackHCIVmVirtualMachine.md) +The operation to update a virtual machine instance. + diff --git a/src/StackHCI/StackHCI/help/Get-AzStackHCIVmImage.md b/src/StackHCI/StackHCI/help/Get-AzStackHCIVmImage.md new file mode 100644 index 000000000000..1f762f030b2f --- /dev/null +++ b/src/StackHCI/StackHCI/help/Get-AzStackHCIVmImage.md @@ -0,0 +1,175 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmimage +schema: 2.0.0 +--- + +# Get-AzStackHCIVmImage + +## SYNOPSIS +Gets a gallery image + +## SYNTAX + +### BySubscription (Default) +``` +Get-AzStackHCIVmImage [-SubscriptionId ] [-DefaultProfile ] [-NoWait] [] +``` + +### ByName +``` +Get-AzStackHCIVmImage [-SubscriptionId ] -Name -ResourceGroupName + [-DefaultProfile ] [-NoWait] [] +``` + +### ByResourceGroup +``` +Get-AzStackHCIVmImage [-SubscriptionId ] -ResourceGroupName [-DefaultProfile ] + [-NoWait] [] +``` + +### ByResourceId +``` +Get-AzStackHCIVmImage [-SubscriptionId ] -ResourceId [-DefaultProfile ] [-NoWait] + [] +``` + +## DESCRIPTION +Gets a gallery image + +## EXAMPLES + +### Example 1: Get an Image +```powershell +Get-AzStackHCIVmImage -Name "testimage" -ResourceGroupName "test-rg" +``` + +```output +Name ResourceGroupName +---- ----------------- +testImage test-rg +``` + +This command gets a specific image in the specified resource group. + +### Example 2: List all Images in a Resource Group +```powershell +Get-AzStackHCIVmImage -ResourceGroupName 'test-rg' +``` + +```output +Name ResourceGroupName +---- ----------------- +testImage test-rg +``` + +This command lists all images in the specified resource group. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the image + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName, ByResourceGroup +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource Id of the Image + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Get-AzStackHCIVmLogicalNetwork.md b/src/StackHCI/StackHCI/help/Get-AzStackHCIVmLogicalNetwork.md new file mode 100644 index 000000000000..629ead378c4e --- /dev/null +++ b/src/StackHCI/StackHCI/help/Get-AzStackHCIVmLogicalNetwork.md @@ -0,0 +1,174 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmlogicalnetwork +schema: 2.0.0 +--- + +# Get-AzStackHCIVmLogicalNetwork + +## SYNOPSIS +Gets a logical network + +## SYNTAX + +### List1 (Default) +``` +Get-AzStackHCIVmLogicalNetwork [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzStackHCIVmLogicalNetwork -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### List +``` +Get-AzStackHCIVmLogicalNetwork -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### ByResourceId +``` +Get-AzStackHCIVmLogicalNetwork [-ResourceId ] [-DefaultProfile ] [-NoWait] + [] +``` + +## DESCRIPTION +Gets a logical network + +## EXAMPLES + +### Example 1: Get a Logical Network +```powershell +Get-AzStackHCIVmLogicalNetwork -Name 'testLnet' -ResourceGroupName 'test-rg' +``` + +```output +Name ResourceGroupName +---- ----------------- +testLnet test-rg +``` + +This command gets a specific logical network in the specified resource group. + +### Example 2: List all Logical Networks in a Resource Group +```powershell +Get-AzStackHCIVmLogicalNetwork -ResourceGroupName 'test-rg' +``` + +```output +Name ResourceGroupName +---- ----------------- +testLnet test-rg +``` + +This command lists all logical networks in the specified resource group. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the logical network + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: LogicalNetworkName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM ID of the logical network. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String[] +Parameter Sets: List1, Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Get-AzStackHCIVmNetworkInterface.md b/src/StackHCI/StackHCI/help/Get-AzStackHCIVmNetworkInterface.md new file mode 100644 index 000000000000..247f4a626fe7 --- /dev/null +++ b/src/StackHCI/StackHCI/help/Get-AzStackHCIVmNetworkInterface.md @@ -0,0 +1,174 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmnetworkinterface +schema: 2.0.0 +--- + +# Get-AzStackHCIVmNetworkInterface + +## SYNOPSIS +Gets a network interface + +## SYNTAX + +### List1 (Default) +``` +Get-AzStackHCIVmNetworkInterface [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzStackHCIVmNetworkInterface -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### List +``` +Get-AzStackHCIVmNetworkInterface -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### ByResourceId +``` +Get-AzStackHCIVmNetworkInterface [-ResourceId ] [-DefaultProfile ] [-NoWait] + [] +``` + +## DESCRIPTION +Gets a network interface + +## EXAMPLES + +### Example 1: Get a Network Interface +```powershell +Get-AzStackHCIVmNetworkInterface -Name 'testNic' -ResourceGroupName 'test-rg' +``` + +```output +Name ResourceGroupName +---- ----------------- +testNic test-rg +``` + +This command gets a specific network interface in the specified resource group. + +### Example 2: List all Logical Networks in a Resource Group +```powershell +Get-AzStackHCIVmNetworkInterface -ResourceGroupName 'test-rg' +``` + +```output +Name ResourceGroupName +---- ----------------- +testNic test-rg +``` + +This command lists all network interfaces in the specified resource group. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the network interface + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: NetworkInterfaceName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Id of the network interface. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String[] +Parameter Sets: List1, Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Get-AzStackHCIVmStoragePath.md b/src/StackHCI/StackHCI/help/Get-AzStackHCIVmStoragePath.md new file mode 100644 index 000000000000..1eb18d320762 --- /dev/null +++ b/src/StackHCI/StackHCI/help/Get-AzStackHCIVmStoragePath.md @@ -0,0 +1,173 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmstoragepath +schema: 2.0.0 +--- + +# Get-AzStackHCIVmStoragePath + +## SYNOPSIS +Gets a storage container + +## SYNTAX + +### List1 (Default) +``` +Get-AzStackHCIVmStoragePath [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzStackHCIVmStoragePath -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### List +``` +Get-AzStackHCIVmStoragePath -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### ByResourceId +``` +Get-AzStackHCIVmStoragePath [-ResourceId ] [-DefaultProfile ] [-NoWait] [] +``` + +## DESCRIPTION +Gets a storage container + +## EXAMPLES + +### Example 1: Get a Storage Path +```powershell +Get-AzStackHCIVmStoragePath -Name "testStoragePath" -ResourceGroupName "test-rg" +``` + +```output +Name ResourceGroupName +---- ----------------- +testStoragePath test-rg +``` + +This command gets a specific storage path in the specified resource group. + +### Example 2: List all Storage Paths in a Resource Group +```powershell +Get-AzStackHCIVmStoragePath -ResourceGroupName "test-rg" +``` + +```output +Name ResourceGroupName +---- ----------------- +testStoragePath test-rg +``` + +This command lists all storage paths in the specified resource group. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the storage container + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: StorageContainerName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM ID of the storage path. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String[] +Parameter Sets: List1, Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Get-AzStackHCIVmVirtualHardDisk.md b/src/StackHCI/StackHCI/help/Get-AzStackHCIVmVirtualHardDisk.md new file mode 100644 index 000000000000..c57afabbb128 --- /dev/null +++ b/src/StackHCI/StackHCI/help/Get-AzStackHCIVmVirtualHardDisk.md @@ -0,0 +1,174 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmvirtualharddisk +schema: 2.0.0 +--- + +# Get-AzStackHCIVmVirtualHardDisk + +## SYNOPSIS +Gets a virtual hard disk + +## SYNTAX + +### List1 (Default) +``` +Get-AzStackHCIVmVirtualHardDisk [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzStackHCIVmVirtualHardDisk -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### List +``` +Get-AzStackHCIVmVirtualHardDisk -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### ByResourceId +``` +Get-AzStackHCIVmVirtualHardDisk [-ResourceId ] [-DefaultProfile ] [-NoWait] + [] +``` + +## DESCRIPTION +Gets a virtual hard disk + +## EXAMPLES + +### Example 1: Get a Virtual Hard Disk +```powershell +Get-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" +``` + +```output +Name ResourceGroupName +---- ----------------- +testVhd test-rg +``` + +This command gets a specific virtual hard disk in the specified resource group. + +### Example 2: List all Virtual Hard Disks in a Resource Group +```powershell +Get-AzStackHCIVmVirtualHardDisk -ResourceGroupName "test-rg" +``` + +```output +Name ResourceGroupName +---- ----------------- +testVhd test-rg +``` + +This command lists all virtual hard disks in the specified resource group. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual hard disk + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: VirtualHardDiskName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM ID of the virtual hard disk. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String[] +Parameter Sets: List1, Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Get-AzStackHCIVmVirtualMachine.md b/src/StackHCI/StackHCI/help/Get-AzStackHCIVmVirtualMachine.md new file mode 100644 index 000000000000..002afd55cb70 --- /dev/null +++ b/src/StackHCI/StackHCI/help/Get-AzStackHCIVmVirtualMachine.md @@ -0,0 +1,207 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmvirtualmachine +schema: 2.0.0 +--- + +# Get-AzStackHCIVmVirtualMachine + +## SYNOPSIS +Gets a virtual machine + +## SYNTAX + +### BySubscription (Default) +``` +Get-AzStackHCIVmVirtualMachine [-SubscriptionId ] [-DefaultProfile ] [-NoWait] [-WhatIf] + [-Confirm] [] +``` + +### ByName +``` +Get-AzStackHCIVmVirtualMachine -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +### ByResourceGroup +``` +Get-AzStackHCIVmVirtualMachine -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +### ByResourceId +``` +Get-AzStackHCIVmVirtualMachine -ResourceId [-DefaultProfile ] [-NoWait] [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION +Gets a virtual machine + +## EXAMPLES + +### Example 2: Get a Virtual Machine. +```powershell +Get-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" +``` + +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` + +This commnad gets a virtual machine in a specified resource group. + +### Example 2: List Virtual Machines in a Resource Group +```powershell +Get-AzStackHCIVmVirtualMachine -ResourceGroupName "test-rg" +``` + +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` + +This command lists all virtual machines in a resource group. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual machine + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: VirtualMachineName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName, ByResourceGroup +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM ID of the virtual machine. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: BySubscription, ByName, ByResourceGroup +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.Machine + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/New-AzStackHCIVmImage.md b/src/StackHCI/StackHCI/help/New-AzStackHCIVmImage.md new file mode 100644 index 000000000000..a456cd7d3acc --- /dev/null +++ b/src/StackHCI/StackHCI/help/New-AzStackHCIVmImage.md @@ -0,0 +1,439 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmimage +schema: 2.0.0 +--- + +# New-AzStackHCIVmImage + +## SYNOPSIS +The operation to create an image. +Please note some properties can be set only during image creation. + +## SYNTAX + +### MarketplaceURN (Default) +``` +New-AzStackHCIVmImage -Name -ResourceGroupName [-SubscriptionId ] -Location + -CustomLocationId -OSType -URN + [-CloudInitDataSource ] [-StoragePathName ] [-StoragePathResourceGroup ] + [-StoragePathId ] [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] + [-Confirm] [] +``` + +### GalleryImage +``` +New-AzStackHCIVmImage -Name -ResourceGroupName [-SubscriptionId ] -Location + -CustomLocationId -OSType [-CloudInitDataSource ] + [-StoragePathName ] [-StoragePathResourceGroup ] [-StoragePathId ] [-Tag ] + -ImagePath [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +### Marketplace +``` +New-AzStackHCIVmImage -Name -ResourceGroupName [-SubscriptionId ] -Location + -CustomLocationId -OSType [-CloudInitDataSource ] + [-StoragePathName ] [-StoragePathResourceGroup ] [-StoragePathId ] [-Tag ] + -Offer -Publisher -Sku -Version [-DefaultProfile ] [-AsJob] + [-NoWait] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The operation to create an image. +Please note some properties can be set only during image creation. + +## EXAMPLES + +### Example 1: Create a Gallery Image +```powershell +New-AzStackHCIVmImage -Name "testImage" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -ImagePath "C:\ClusterStorage\Volume1\Ubunut.vhdx" -OSType "Linux" -Location "eastus" +``` + +```output +Name ResourceGroupName +---- ----------------- +testImage test-rg +``` + +This command creates a gallery image from a local path. + +### Example 2: Create a Marketplace Gallery Image +```powershell +New-AzStackHCIVmImage -Name "testMarketplaceImage" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -Offer "windowsserver" -Publisher "MicrosoftWindowsServer" -Sku "2022-Datacenter" -Version "latest" -OSType "Windows" +``` + +```output +Name ResourceGroupName +---- ----------------- +testMarketplaceImage test-rg +``` + +This command creates a marketplace gallery image using the specified offer , publisher, sku and version. + +### Example 3: {Create a Marketplace Gallery Image From URN +```powershell +New-AzStackHCIVmImage -Name "testMarketplaceImageURN" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -URN "microsoftwindowsserver:windowsserver:2022-datacenter:latest" -OSType "Windows" +``` + +```output +Name ResourceGroupName +---- ----------------- +testMarketplaceImageURN test-rg +``` + +This command creates a marketplace gallery image using the specified urn. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CloudInitDataSource +Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomLocationId +The ARM Id of the extended location to create image resource in. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ImagePath +Local path of image that the image should be created from. + +This parameter is required for non marketplace images. + +```yaml +Type: System.String +Parameter Sets: GalleryImage +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +The geo-location where the resource lives + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the Image +The name must start and end with an alphanumeric character and must contain all alphanumeric characters or '-', '.', or '_'. +The max length can be 80 characters and the minimum length is 1 character. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: ImageName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Offer +The name of the marketplae gallery image definition offer. + +```yaml +Type: System.String +Parameter Sets: Marketplace +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OSType +Operating system type that the gallery image uses [Windows, Linux] + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Publisher +The name of the marketplace gallery image definition publisher. + +```yaml +Type: System.String +Parameter Sets: Marketplace +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Sku +The name of the marketplace gallery image definition SKU. + +```yaml +Type: System.String +Parameter Sets: Marketplace +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoragePathId +Storage ContainerID of the storage container to be used for gallery image + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoragePathName +Storage Container Name of the storage container to be used for gallery image + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoragePathResourceGroup +Resource Group of the Storage Path. +The Default value is the Resource Group of the Image. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -URN +The URN of the marketplace gallery image. + +```yaml +Type: System.String +Parameter Sets: MarketplaceURN +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Version +The version of the marketplace gallery image. + +```yaml +Type: System.String +Parameter Sets: Marketplace +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/New-AzStackHCIVmLogicalNetwork.md b/src/StackHCI/StackHCI/help/New-AzStackHCIVmLogicalNetwork.md new file mode 100644 index 000000000000..b46d1db1fb85 --- /dev/null +++ b/src/StackHCI/StackHCI/help/New-AzStackHCIVmLogicalNetwork.md @@ -0,0 +1,405 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmlogicalnetwork +schema: 2.0.0 +--- + +# New-AzStackHCIVmLogicalNetwork + +## SYNOPSIS +The operation to create or update a logical network. +Please note some properties can be set only during logical network creation. + +## SYNTAX + +``` +New-AzStackHCIVmLogicalNetwork -Name -ResourceGroupName [-SubscriptionId ] + -Location -CustomLocationId [-DnsServer ] [-Tag ] + [-VMSwitchName ] [-AddressPrefix ] [-IpAllocationMethod ] [-IpPoolEnd ] + [-IpPoolStart ] [-IpPoolType ] [-IpPool ] [-Route ] + [-SubnetName ] [-Subnet ] [-Vlan ] [-DefaultProfile ] [-AsJob] [-NoWait] + [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The operation to create or update a logical network. +Please note some properties can be set only during logical network creation. + +## EXAMPLES + +### Example 1: Create a Logical Network +```powershell +New-AzStackHCIVmLogicalNetwork -Name "testLnet" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -VmSwitchName "testswitch" +``` + +```output +Name ResourceGroupName +---- ----------------- +testLnet test-rg +``` + +This command creates a logical network in the specified resource group. + +## PARAMETERS + +### -AddressPrefix +List of address prefixes for the subnet. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomLocationId +The name of the extended location. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DnsServer +The list of DNS servers IP addresses. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IpAllocationMethod +The IP address allocation method. +Possible values include: 'Static', 'Dynamic' + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IpPool +Network associated pool of IP Addresses + +```yaml +Type: System.Collections.Hashtable[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IpPoolEnd +End of the ip address pool + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IpPoolStart +Start of the ip address pool + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IpPoolType +Ip pool type + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +The geo-location where the resource lives + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual network + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: LogicalNetworkName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Route +Collection of routes contained within a route table. + +```yaml +Type: System.Collections.Hashtable[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Subnet +List of subnets under the virtual network + +```yaml +Type: System.Collections.Hashtable[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubnetName +Name of the subnet + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Vlan +Vlan to use for the subnet + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VMSwitchName +Name of the network switch to be used for VMs + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/New-AzStackHCIVmNetworkInterface.md b/src/StackHCI/StackHCI/help/New-AzStackHCIVmNetworkInterface.md new file mode 100644 index 000000000000..1f90884f91e3 --- /dev/null +++ b/src/StackHCI/StackHCI/help/New-AzStackHCIVmNetworkInterface.md @@ -0,0 +1,328 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmnetworkinterface +schema: 2.0.0 +--- + +# New-AzStackHCIVmNetworkInterface + +## SYNOPSIS +The operation to create or update a network interface. +Please note some properties can be set only during network interface creation. + +## SYNTAX + +``` +New-AzStackHCIVmNetworkInterface -Name -ResourceGroupName [-SubscriptionId ] + -Location -CustomLocationId [-DnsServer ] [-IpAddress ] + [-MacAddress ] [-SubnetId ] [-SubnetName ] [-SubnetResourceGroup ] + [-IpConfiguration ] [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] + [-Confirm] [] +``` + +## DESCRIPTION +The operation to create or update a network interface. +Please note some properties can be set only during network interface creation. + +## EXAMPLES + +### Example 1: Create a Network Interface +```powershell +New-AzStackHCIVmNetworkInterface -Name "testNic" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -SubnetName "testLnet" +``` + +```output +Name ResourceGroupName +---- ----------------- +testNic test-rg +``` + +This command creates a network interface in the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomLocationId +The name of the extended location. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DnsServer +List of DNS server IP Addresses for the interface + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IpAddress +PrivateIPAddress - Private IP address of the IP configuration. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IpConfiguration +A list of IPConfigurations of the network interface. + +```yaml +Type: System.Collections.Hashtable[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +The geo-location where the resource lives + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MacAddress +MacAddress - The MAC address of the network interface. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the Network Interface + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: NetworkInterfaceName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubnetId +The ARM resource id of the Subnet. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubnetName +The name of the Subnet. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubnetResourceGroup +Resource Group of the Subnet. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/New-AzStackHCIVmStoragePath.md b/src/StackHCI/StackHCI/help/New-AzStackHCIVmStoragePath.md new file mode 100644 index 000000000000..512206ee49cb --- /dev/null +++ b/src/StackHCI/StackHCI/help/New-AzStackHCIVmStoragePath.md @@ -0,0 +1,236 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmstoragepath +schema: 2.0.0 +--- + +# New-AzStackHCIVmStoragePath + +## SYNOPSIS +The operation to create or update a storage container. +Please note some properties can be set only during storage container creation. + +## SYNTAX + +``` +New-AzStackHCIVmStoragePath -Name -ResourceGroupName [-SubscriptionId ] + -Location [-CustomLocationId ] [-Path ] [-Tag ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The operation to create or update a storage container. +Please note some properties can be set only during storage container creation. + +## EXAMPLES + +### Example 1: Create a Storage Path +```powershell +New-AzStackHCIVmStoragePath -Name "testStoragePath" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}"-Location "eastus" -Path "C:\ClusterStorage\Volume1\testpath" +``` + +```output +Name ResourceGroupName +---- ----------------- +testStoragePath test-rg +``` + +This command creates a storage path in the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomLocationId +The name of the extended location. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +The geo-location where the resource lives + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the storage container + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: StorageContainerName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Path +Path of the storage container on the disk + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/New-AzStackHCIVmVirtualHardDisk.md b/src/StackHCI/StackHCI/help/New-AzStackHCIVmVirtualHardDisk.md new file mode 100644 index 000000000000..84e0720471f4 --- /dev/null +++ b/src/StackHCI/StackHCI/help/New-AzStackHCIVmVirtualHardDisk.md @@ -0,0 +1,378 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmvirtualharddisk +schema: 2.0.0 +--- + +# New-AzStackHCIVmVirtualHardDisk + +## SYNOPSIS +The operation to create or update a virtual hard disk. +Please note some properties can be set only during virtual hard disk creation. + +## SYNTAX + +``` +New-AzStackHCIVmVirtualHardDisk -Name -ResourceGroupName [-SubscriptionId ] + -Location -CustomLocationId [-BlockSizeByte ] [-StoragePathId ] + [-StoragePathName ] [-StoragePathResourceGroup ] [-DiskFileFormat ] + [-SizeGb ] [-Dynamic] [-HyperVGeneration ] [-LogicalSectorByte ] + [-PhysicalSectorByte ] [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] + [-Confirm] [] +``` + +## DESCRIPTION +The operation to create or update a virtual hard disk. +Please note some properties can be set only during virtual hard disk creation. + +## EXAMPLES + +### Example 1: Create a Virtual Hard Disk +```powershell +New-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -SizeGb 2 +``` + +```output +Name ResourceGroupName +---- ----------------- +testVhd test-rg +``` + +This command creates a virtual hard disk in the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BlockSizeByte +The block size, in bytes, of the virtual hard disk. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomLocationId +The ARM Id of the extended location to create virtual hard disk resource in. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DiskFileFormat +The format of the actual VHD file [vhd, vhdx] + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Dynamic +Boolean for enabling dynamic sizing on the virtual hard disk + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -HyperVGeneration +The hypervisor generation of the Virtual Machine [V1, V2] + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +The geo-location where the resource lives + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -LogicalSectorByte +Logical Sector Bytes of the Disk + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual hard disk. + +Must contain all alphanumeric characters or '-' or '_'. +Max length is 80 characters, and min length is 1 character. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: VirtualHardDiskName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PhysicalSectorByte +Physical Sector Bytes of the Disk + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SizeGb +Size of the disk in GB + +```yaml +Type: System.Int64 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoragePathId +Storage ContainerID of the storage container to be used for VHD + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoragePathName +Storage Container Name to be used for the VHD + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoragePathResourceGroup +Storage Container resource group. +The resource group of the virtual hard disk will be used if this value is not provided. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/New-AzStackHCIVmVirtualMachine.md b/src/StackHCI/StackHCI/help/New-AzStackHCIVmVirtualMachine.md new file mode 100644 index 000000000000..e013a5faec01 --- /dev/null +++ b/src/StackHCI/StackHCI/help/New-AzStackHCIVmVirtualMachine.md @@ -0,0 +1,808 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmvirtualmachine +schema: 2.0.0 +--- + +# New-AzStackHCIVmVirtualMachine + +## SYNOPSIS +The operation to create or update a virtual machine. +Please note some properties can be set only during virtual machine creation. + +## SYNTAX + +### ByImageId (Default) +``` +New-AzStackHCIVmVirtualMachine -Name -ResourceGroupName [-SubscriptionId ] + -Location -CustomLocationId -OsType -ImageId + [-DynamicMemoryMaximumMemoryInMb ] [-DynamicMemoryMinimumMemoryInMb ] + [-DynamicMemoryTargetBuffer ] [-VmMemoryInMB ] [-VmProcessor ] [-VmSize ] + [-IdentityType ] [-DisablePasswordAuthentication] [-ProvisionVMAgent] + [-ProvisionVMConfigAgent] [-NicId ] [-NicName ] [-NicResourceGroup ] + [-DataDiskId ] [-DataDiskName ] [-DataDiskResourceGroup ] + [-AdminPassword ] [-AdminUsername ] [-ComputerName ] [-EnableTpm] + [-SshPublicKey ] [-StoragePathId ] [-StoragePathName ] + [-StoragePathResourceGroup ] [-Tag ] [-SecureBootEnabled] [-EnableAutomaticUpdate] + [-TimeZone ] [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +### ByImageName +``` +New-AzStackHCIVmVirtualMachine -Name -ResourceGroupName [-SubscriptionId ] + -Location -CustomLocationId -OsType [-DynamicMemoryMaximumMemoryInMb ] + [-DynamicMemoryMinimumMemoryInMb ] [-DynamicMemoryTargetBuffer ] [-VmMemoryInMB ] + [-VmProcessor ] [-VmSize ] [-IdentityType ] + [-DisablePasswordAuthentication] [-ProvisionVMAgent] [-ProvisionVMConfigAgent] [-NicId ] + [-NicName ] [-NicResourceGroup ] [-DataDiskId ] [-DataDiskName ] + [-DataDiskResourceGroup ] [-AdminPassword ] [-AdminUsername ] [-ComputerName ] + [-EnableTpm] [-SshPublicKey ] [-StoragePathId ] [-StoragePathName ] + [-StoragePathResourceGroup ] [-Tag ] [-SecureBootEnabled] [-EnableAutomaticUpdate] + [-TimeZone ] -ImageName [-ImageResourceGroup ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-WhatIf] [-Confirm] [] +``` + +### ByOsDiskId +``` +New-AzStackHCIVmVirtualMachine -Name -ResourceGroupName [-SubscriptionId ] + -Location -CustomLocationId -OsType [-DynamicMemoryMaximumMemoryInMb ] + [-DynamicMemoryMinimumMemoryInMb ] [-DynamicMemoryTargetBuffer ] [-VmMemoryInMB ] + [-VmProcessor ] [-VmSize ] [-IdentityType ] + [-DisablePasswordAuthentication] [-ProvisionVMAgent] [-ProvisionVMConfigAgent] [-NicId ] + [-NicName ] [-NicResourceGroup ] [-DataDiskId ] [-DataDiskName ] + [-DataDiskResourceGroup ] [-AdminPassword ] [-AdminUsername ] [-ComputerName ] + [-EnableTpm] [-SshPublicKey ] [-StoragePathId ] [-StoragePathName ] + [-StoragePathResourceGroup ] [-Tag ] [-SecureBootEnabled] [-EnableAutomaticUpdate] + [-TimeZone ] -OSDiskId [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] + [] +``` + +### ByOsDiskName +``` +New-AzStackHCIVmVirtualMachine -Name -ResourceGroupName [-SubscriptionId ] + -Location -CustomLocationId -OsType [-DynamicMemoryMaximumMemoryInMb ] + [-DynamicMemoryMinimumMemoryInMb ] [-DynamicMemoryTargetBuffer ] [-VmMemoryInMB ] + [-VmProcessor ] [-VmSize ] [-IdentityType ] + [-DisablePasswordAuthentication] [-ProvisionVMAgent] [-ProvisionVMConfigAgent] [-NicId ] + [-NicName ] [-NicResourceGroup ] [-DataDiskId ] [-DataDiskName ] + [-DataDiskResourceGroup ] [-AdminPassword ] [-AdminUsername ] [-ComputerName ] + [-EnableTpm] [-SshPublicKey ] [-StoragePathId ] [-StoragePathName ] + [-StoragePathResourceGroup ] [-Tag ] [-SecureBootEnabled] [-EnableAutomaticUpdate] + [-TimeZone ] -OSDiskName [-OSDiskResourceGroup ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The operation to create or update a virtual machine. +Please note some properties can be set only during virtual machine creation. + +## EXAMPLES + +### Example 1: Create a Virtual Machine with an Image. +```powershell +New-AzStackHCIVmVirtualMachine -Name "testVm" -OsType "Linux" -ImageName "testImage" -VmSize "Standard_K8S_v1" -AdminUsername "localadmin" -ComputerName "testVm" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" +``` + +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` + +This command creates a virtual machine from a gallery image. + +### Example 2: Create a Virtual Machine with a Disk. +```powershell +New-AzStackHCIVmVirtualMachine -Name "testVm" -OsType "Linux" -OsDiskName "testOsDisk" -VmSize "Standard_K8S_v1" -AdminUsername "localadmin" -ComputerName "testVm" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" +``` + +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` + +This command creates a virtual machine from a disk. + +## PARAMETERS + +### -AdminPassword +AdminPassword - admin password + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AdminUsername +AdminUsername - admin username + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ComputerName +ComputerName - name of the computer + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomLocationId +The name of the extended location. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataDiskId +Data Disks - List of data disks to be attached to the virtual machine in id format. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataDiskName +Data Disks - List of data disks to be attached to the virtual machine in name format . + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataDiskResourceGroup +Data Disks - Resource Group of Data Disks. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DisablePasswordAuthentication +DisablePasswordAuthentication - whether password authentication should be disabled + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DynamicMemoryMaximumMemoryInMb +Maximum Dynamic Memory + +```yaml +Type: System.Int64 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DynamicMemoryMinimumMemoryInMb +Minimum Dynamic Memory + +```yaml +Type: System.Int64 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DynamicMemoryTargetBuffer +Defines the amount of extra memory that should be reserved for a virtual machine at runtime, as a percentage of the total memory that the virtual machine is thought to need. +This only applies to virtual systems with dynamic memory enabled. +This property can be in the range of 5 to 2000. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EnableAutomaticUpdate +Specifies Whether to EnableAutomaticUpdates on the machine. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EnableTpm +Used to indicate whether or not to enable TPM + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IdentityType +The identity type. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ImageId +Resource ID of the image to create the VM with. + +```yaml +Type: System.String +Parameter Sets: ByImageId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ImageName +Name of the image to create the VM with. + +```yaml +Type: System.String +Parameter Sets: ByImageName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ImageResourceGroup +Resource group of the image to create the VM from. + +```yaml +Type: System.String +Parameter Sets: ByImageName +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +The geo-location where the resource lives + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual machine + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: VirtualMachineName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicId +NetworkInterfaces - list of network interfaces to be attached to the virtual machine in ARM Id format. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicName +NetworkInterfaces - list of network interfaces to be attached to the virtual machine in name format. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicResourceGroup +NetworkInterfaces - Resource Group of Network Interfaces. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OSDiskId +Resource ID of the OS disk + +```yaml +Type: System.String +Parameter Sets: ByOsDiskId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OSDiskName +Name of the OS disk + +```yaml +Type: System.String +Parameter Sets: ByOsDiskName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OSDiskResourceGroup +Resource Group of the OS disk + +```yaml +Type: System.String +Parameter Sets: ByOsDiskName +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OsType +OsType - string specifying whether the OS is Linux or Windows + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProvisionVMAgent +Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine creation process. +VM Agent is provsioned by default. +Please pass -ProvisionVMAgent:$false to disable. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProvisionVMConfigAgent +Indicates whether virtual machine configuration agent should be provisioned on the virtual machine. +When this property is not specified, default behavior is to set it to true. +VM Config Agent is provisioned by default. +Please pass -ProvisionVMConfigAgent:$false to disable. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecureBootEnabled +Specifies whether secure boot should be enabled on the virtual machine. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SshPublicKey +PublicKeys - The list of SSH public keys used to authenticate with VMs + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoragePathId +Id of the storage container that hosts the VM configuration file + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoragePathName +Name of the storage container that hosts the VM configuration file + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoragePathResourceGroup +Storage Container resource group. +The resource group of the virtual machine will be used if this value is not provided. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TimeZone +TimeZone for the virtual machine + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VmMemoryInMB +RAM in MB for the virtual machine + +```yaml +Type: System.Int64 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VmProcessor +Number of processors for the virtual machine + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VmSize +Size of the VM. +Can be a Predefined size or Custom. +Possible Predefined Sizes include - Custom,Standard_A2_v2,Standard_A4_v2,Standard_D16s_v3,Standard_D2s_v3,Standard_D32s_v3,Standard_D4s_v3,Standard_D8s_v3,Standard_DS13_v2,Standard_DS2_v2,Standard_DS3_v2,Standard_DS4_v2,Standard_DS5_v2,Standard_K8S2_v1,Standard_K8S3_v1,Standard_K8S4_v1,Standard_K8S5_v1,Standard_K8S_v1,Standard_NK12,Standard_NK6,Standard_NV12, StandardNv6 + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmImage.md b/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmImage.md new file mode 100644 index 000000000000..abaebf5369ef --- /dev/null +++ b/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmImage.md @@ -0,0 +1,159 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmimage +schema: 2.0.0 +--- + +# Remove-AzStackHCIVmImage + +## SYNOPSIS +The operation to delete an image. + +## SYNTAX + +### ByResourceId (Default) +``` +Remove-AzStackHCIVmImage [-SubscriptionId ] -ResourceId [-Force] [-WhatIf] [-Confirm] + [] +``` + +### ByName +``` +Remove-AzStackHCIVmImage -Name -ResourceGroupName [-SubscriptionId ] [-Force] + [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The operation to delete an image. + +## EXAMPLES + +### Example 1: Remove an image. +```powershell +Remove-AzStackHCIVmImage -Name "testImage" -ResourceGroupName "test-rg" +``` + +This command removes the image from the specified resource group. + +## PARAMETERS + +### -Force +Forces the cmdlet to remove the network interface without prompting for confirmation. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the gallery image + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the image. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### System.Boolean + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmLogicalNetwork.md b/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmLogicalNetwork.md new file mode 100644 index 000000000000..61a37f535650 --- /dev/null +++ b/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmLogicalNetwork.md @@ -0,0 +1,158 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmlogicalnetwork +schema: 2.0.0 +--- + +# Remove-AzStackHCIVmLogicalNetwork + +## SYNOPSIS +The operation to delete a logical network. + +## SYNTAX + +### ByResourceId (Default) +``` +Remove-AzStackHCIVmLogicalNetwork -ResourceId [-Force] [-WhatIf] [-Confirm] [] +``` + +### Delete +``` +Remove-AzStackHCIVmLogicalNetwork -Name -ResourceGroupName [-SubscriptionId ] + [-Force] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The operation to delete a logical network. + +## EXAMPLES + +### Example 1: Remove a logical network. +```powershell +Remove-AzStackHCIVmLogicalNetwork -Name "testLnet" -ResourceGroupName "test-rg" +``` + +This command removes the logical network from the specified resource group. + +## PARAMETERS + +### -Force +Forces the cmdlet to remove the virtual network without prompting for confirmation. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual network + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: LogicalNetworkName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the virtual network. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### System.Boolean + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmNetworkInterface.md b/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmNetworkInterface.md new file mode 100644 index 000000000000..5e2f1239db46 --- /dev/null +++ b/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmNetworkInterface.md @@ -0,0 +1,161 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmnetworkinterface +schema: 2.0.0 +--- + +# Remove-AzStackHCIVmNetworkInterface + +## SYNOPSIS +The operation to delete a network interface. + +## SYNTAX + +### ByResourceId (Default) +``` +Remove-AzStackHCIVmNetworkInterface -ResourceId [-SubscriptionId ] [-Force] [-WhatIf] + [-Confirm] [] +``` + +### ByName +``` +Remove-AzStackHCIVmNetworkInterface [-SubscriptionId ] -Name -ResourceGroupName + [-Force] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The operation to delete a network interface. + +## EXAMPLES + +### Example 1: Remove a network interface. +```powershell +Remove-AzStackHCIVmLogicalNetwork -Name "testNic" -ResourceGroupName "test-rg" +``` + +This command removes the network interface from the specified resource group. + +## PARAMETERS + +### -Force +Forces the cmdlet to remove the network interface without prompting for confirmation. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the network interface + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: NetworkInterfaceName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the network interface. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHCIVmIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmStoragePath.md b/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmStoragePath.md new file mode 100644 index 000000000000..d5f95a11cb24 --- /dev/null +++ b/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmStoragePath.md @@ -0,0 +1,239 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmstoragepath +schema: 2.0.0 +--- + +# Remove-AzStackHCIVmStoragePath + +## SYNOPSIS +The operation to delete a storage container. + +## SYNTAX + +### ByResourceId (Default) +``` +Remove-AzStackHCIVmStoragePath [-SubscriptionId ] [-InputObject ] + -ResourceId [-Force] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-WhatIf] [-Confirm] + [] +``` + +### ByName +``` +Remove-AzStackHCIVmStoragePath -Name -ResourceGroupName [-SubscriptionId ] + [-InputObject ] [-Force] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] + [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The operation to delete a storage container. + +## EXAMPLES + +### Example 1: Remove a Storage Path +```powershell +Remove-AzStackHCIVmStoragePath -Name "testStoragePath" -ResourceGroupName "test-rg" +``` + +This command removes the storage path from the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Force +Forces the cmdlet to remove the storage path without prompting for confirmation. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +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.StackHCIVm.Models.IStackHciVMIdentity +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the storage container + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: StorageContainerName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the storage path. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHCIVmIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmVirtualHardDisk.md b/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmVirtualHardDisk.md new file mode 100644 index 000000000000..3cfbbef9db35 --- /dev/null +++ b/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmVirtualHardDisk.md @@ -0,0 +1,159 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualharddisk +schema: 2.0.0 +--- + +# Remove-AzStackHCIVmVirtualHardDisk + +## SYNOPSIS +The operation to delete a virtual hard disk. + +## SYNTAX + +### ByResourceId (Default) +``` +Remove-AzStackHCIVmVirtualHardDisk [-SubscriptionId ] -ResourceId [-Force] [-WhatIf] + [-Confirm] [] +``` + +### ByName +``` +Remove-AzStackHCIVmVirtualHardDisk -Name -ResourceGroupName [-SubscriptionId ] + [-Force] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The operation to delete a virtual hard disk. + +## EXAMPLES + +### Example 1: Remove a Virtual Hard Disk +```powershell +Remove-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" +``` + +This command removes the virtual hard disk from the specified resource group. + +## PARAMETERS + +### -Force +Forces the cmdlet to remove the virtual hard disk without prompting for confirmation. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual hard disk + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: VirtualHardDiskName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the virtual hard disk. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### System.Boolean + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmVirtualMachine.md b/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmVirtualMachine.md new file mode 100644 index 000000000000..78a5dac60fa1 --- /dev/null +++ b/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmVirtualMachine.md @@ -0,0 +1,224 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualmachine +schema: 2.0.0 +--- + +# Remove-AzStackHCIVmVirtualMachine + +## SYNOPSIS +The operation to delete a virtual machine. + +## SYNTAX + +### ByResourceId (Default) +``` +Remove-AzStackHCIVmVirtualMachine [-SubscriptionId ] [-InputObject ] + -ResourceId [-Force] [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] + [] +``` + +### ByName +``` +Remove-AzStackHCIVmVirtualMachine -Name -ResourceGroupName [-SubscriptionId ] + [-InputObject ] [-Force] [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] + [-Confirm] [] +``` + +## DESCRIPTION +The operation to delete a virtual machine. + +## EXAMPLES + +### Example 1: Remove a Virtual Machine +```powershell +Remove-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" +``` + +This command removes the virtual machine from the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Force +Forces the cmdlet to remove the virtual machine without prompting for confirmation. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +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.StackHCIVm.Models.IStackHciVMIdentity +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual machine + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: VirtualMachineName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the virtual machine. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHCIVmIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmVirtualMachineDataDisk.md b/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmVirtualMachineDataDisk.md new file mode 100644 index 000000000000..35133c99e153 --- /dev/null +++ b/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmVirtualMachineDataDisk.md @@ -0,0 +1,196 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualmachinedatadisk +schema: 2.0.0 +--- + +# Remove-AzStackHCIVmVirtualMachineDataDisk + +## SYNOPSIS +The operation to delete a data disk from a virtual machine. + +## SYNTAX + +### ByResourceId (Default) +``` +Remove-AzStackHCIVmVirtualMachineDataDisk -ResourceId [-DataDiskId ] + [-DataDiskName ] [-DataDiskResourceGroup ] [-WhatIf] [-Confirm] [] +``` + +### ByName +``` +Remove-AzStackHCIVmVirtualMachineDataDisk -Name -ResourceGroupName [-SubscriptionId ] + [-DataDiskId ] [-DataDiskName ] [-DataDiskResourceGroup ] [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION +The operation to delete a data disk from a virtual machine. + +## EXAMPLES + +### Example 1: Removes a Data Disk from a Virtual Machine +```powershell +Remove-AzStackHCIVmVirtualMachineDataDisk -Name "testVm" -ResourceGroupName "test-rg" -DataDiskName "testVhd" +``` + +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` + +This command removes a data disk from the virtual machine in the specified resource group. + +## PARAMETERS + +### -DataDiskId +Data Disks - list of data disks to be removed from the virtual machine in id format. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataDiskName +Data Disks - list of data disks to be removed from the virtual machine in name format. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataDiskResourceGroup +Resource Group of the Data Disks. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual machine + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: VirtualMachineName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the virtual machine. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmVirtualMachineNetworkInterface.md b/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmVirtualMachineNetworkInterface.md new file mode 100644 index 000000000000..9816cc6be99e --- /dev/null +++ b/src/StackHCI/StackHCI/help/Remove-AzStackHCIVmVirtualMachineNetworkInterface.md @@ -0,0 +1,196 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualmachinenetworkinterface +schema: 2.0.0 +--- + +# Remove-AzStackHCIVmVirtualMachineNetworkInterface + +## SYNOPSIS +The operation to delete a network interface from a virtual machine. + +## SYNTAX + +### ByResourceId (Default) +``` +Remove-AzStackHCIVmVirtualMachineNetworkInterface -ResourceId [-NicId ] + [-NicName ] [-NicResourceGroup ] [-WhatIf] [-Confirm] [] +``` + +### ByName +``` +Remove-AzStackHCIVmVirtualMachineNetworkInterface -Name -ResourceGroupName + [-SubscriptionId ] [-NicId ] [-NicName ] [-NicResourceGroup ] [-WhatIf] + [-Confirm] [] +``` + +## DESCRIPTION +The operation to delete a network interface from a virtual machine. + +## EXAMPLES + +### Example 1: Removes a Network Interface from a Virtual Machine +```powershell +Remove-AzStackHCIVmVirtualMachineNetworkInterface -Name "testVm" -ResourceGroupName "test-rg" -NicName 'testNic' +``` + +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` + +This command removes a network interface from the virtual machine in the specified resource group. + +## PARAMETERS + +### -Name +Name of the virtual machine + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: VirtualMachineName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicId +NetworkInterfaces - list of network interfaces to be attached from the virtual machine in id format. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicName +NetworkInterfaces - list of network interfaces to be removed from the virtual machine in name format. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicResourceGroup +NetworkInterfaces - resource group of the network interfaces + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the virtual machine. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Restart-AzStackHCIVmVirtualMachine.md b/src/StackHCI/StackHCI/help/Restart-AzStackHCIVmVirtualMachine.md new file mode 100644 index 000000000000..1b0f811bede2 --- /dev/null +++ b/src/StackHCI/StackHCI/help/Restart-AzStackHCIVmVirtualMachine.md @@ -0,0 +1,189 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/restart-azstackhcivmvirtualmachine +schema: 2.0.0 +--- + +# Restart-AzStackHCIVmVirtualMachine + +## SYNOPSIS +The operation to restart a virtual machine instance. + +## SYNTAX + +### ByResourceId (Default) +``` +Restart-AzStackHCIVmVirtualMachine -ResourceId [-DefaultProfile ] [-AsJob] [-NoWait] + [-WhatIf] [-Confirm] [] +``` + +### ByName +``` +Restart-AzStackHCIVmVirtualMachine -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The operation to restart a virtual machine instance. + +## EXAMPLES + +### Example 1: Restart Virtual Machine +```powershell +Restart-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" +``` + +This command restarts the virtual machine in the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual machine + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: VirtualMachineName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the virtual machine. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Start-AzStackHCIVmVirtualMachine.md b/src/StackHCI/StackHCI/help/Start-AzStackHCIVmVirtualMachine.md new file mode 100644 index 000000000000..856f5e6069e7 --- /dev/null +++ b/src/StackHCI/StackHCI/help/Start-AzStackHCIVmVirtualMachine.md @@ -0,0 +1,189 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/start-azstackhcivmvirtualmachine +schema: 2.0.0 +--- + +# Start-AzStackHCIVmVirtualMachine + +## SYNOPSIS +The operation to start a virtual machine instance. + +## SYNTAX + +### ByResourceId (Default) +``` +Start-AzStackHCIVmVirtualMachine -ResourceId [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] + [-Confirm] [] +``` + +### ByName +``` +Start-AzStackHCIVmVirtualMachine -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The operation to start a virtual machine instance. + +## EXAMPLES + +### Example 1: Start Virtual Machine +```powershell +Start-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" +``` + +This command starts the virtual machine in the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual machine + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: VirtualMachineName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the virtual machine. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Stop-AzStackHCIVmVirtualMachine.md b/src/StackHCI/StackHCI/help/Stop-AzStackHCIVmVirtualMachine.md new file mode 100644 index 000000000000..22d6777a8c59 --- /dev/null +++ b/src/StackHCI/StackHCI/help/Stop-AzStackHCIVmVirtualMachine.md @@ -0,0 +1,191 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/stop-azstackhcivmvirtualmachine +schema: 2.0.0 +--- + +# Stop-AzStackHCIVmVirtualMachine + +## SYNOPSIS +The operation to stop a virtual machine instance. + +## SYNTAX + +### ByResourceId (Default) +``` +Stop-AzStackHCIVmVirtualMachine -ResourceId [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] + [-Confirm] [] +``` + +### ByName +``` +Stop-AzStackHCIVmVirtualMachine -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The operation to stop a virtual machine instance. + +## EXAMPLES + +### Example 1: Stop Virtual Machine +```powershell +Stop-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" +``` + +This command stops the virtual machine in the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual machine + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: VirtualMachineName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the virtual machine. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHCIVmIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Update-AzStackHCIVmImage.md b/src/StackHCI/StackHCI/help/Update-AzStackHCIVmImage.md new file mode 100644 index 000000000000..d499f088c9f7 --- /dev/null +++ b/src/StackHCI/StackHCI/help/Update-AzStackHCIVmImage.md @@ -0,0 +1,173 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmimage +schema: 2.0.0 +--- + +# Update-AzStackHCIVmImage + +## SYNOPSIS +The operation to update an image. + +## SYNTAX + +### GalleryImage (Default) +``` +Update-AzStackHCIVmImage [-WhatIf] [-Confirm] [] +``` + +### ByName +``` +Update-AzStackHCIVmImage -Name -ResourceGroupName [-SubscriptionId ] + [-Tag ] [-WhatIf] [-Confirm] [] +``` + +### ByResourceId +``` +Update-AzStackHCIVmImage [-SubscriptionId ] -ResourceId [-Tag ] [-WhatIf] + [-Confirm] [] +``` + +## DESCRIPTION +The operation to update an image. +Please note some properties can be set only during image creation. + +## EXAMPLES + +### Example 1: Update an Image. +```powershell +Update-AzStackHCIVmImage -Name "testImage" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} +``` + +```output +Name ResourceGroupName +---- ----------------- +testImage test-rg +``` + +This command updates an exisiting image in the specified resource group. + +## PARAMETERS + +### -Name +Name of the gallery image + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the image. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: ByName, ByResourceId +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: ByName, ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Update-AzStackHCIVmLogicalNetwork.md b/src/StackHCI/StackHCI/help/Update-AzStackHCIVmLogicalNetwork.md new file mode 100644 index 000000000000..2f8332c9f3ee --- /dev/null +++ b/src/StackHCI/StackHCI/help/Update-AzStackHCIVmLogicalNetwork.md @@ -0,0 +1,235 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmlogicalnetwork +schema: 2.0.0 +--- + +# Update-AzStackHCIVmLogicalNetwork + +## SYNOPSIS +The operation to update a logical network. + +## SYNTAX + +### ByResourceId (Default) +``` +Update-AzStackHCIVmLogicalNetwork [-ResourceId ] [-Tag ] [-WhatIf] [-Confirm] + [] +``` + +### UpdateExpanded +``` +Update-AzStackHCIVmLogicalNetwork -Name -ResourceGroupName [-SubscriptionId ] + [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzStackHCIVmLogicalNetwork -InputObject [-Tag ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The operation to update a logical network. + +## EXAMPLES + +### Example 1: Update a Logical Network. +```powershell +Update-AzStackHCIVmLogicalNetwork -Name "testLnet" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} +``` + +```output +Name ResourceGroupName +---- ----------------- +testLnet test-rg +``` + +This command updates an exisiting logical network in the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +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.StackHCIVm.Models.IStackHciVMIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Name of the logical network + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: LogicalNetworkName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the virtual network. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Update-AzStackHCIVmNetworkInterface.md b/src/StackHCI/StackHCI/help/Update-AzStackHCIVmNetworkInterface.md new file mode 100644 index 000000000000..e16b83388ba7 --- /dev/null +++ b/src/StackHCI/StackHCI/help/Update-AzStackHCIVmNetworkInterface.md @@ -0,0 +1,235 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmnetworkinterface +schema: 2.0.0 +--- + +# Update-AzStackHCIVmNetworkInterface + +## SYNOPSIS +The operation to update a network interface. + +## SYNTAX + +### ByResourceId (Default) +``` +Update-AzStackHCIVmNetworkInterface [-ResourceId ] [-Tag ] [-WhatIf] [-Confirm] + [] +``` + +### UpdateExpanded +``` +Update-AzStackHCIVmNetworkInterface -Name -ResourceGroupName [-SubscriptionId ] + [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzStackHCIVmNetworkInterface -InputObject [-Tag ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The operation to update a network interface. + +## EXAMPLES + +### Example 1: Update a Network Interface. +```powershell +Update-AzStackHCIVmNetworkInterface -Name "testNic" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} +``` + +```output +Name ResourceGroupName +---- ----------------- +testNic test-rg +``` + +This command updates an exisiting network interface in the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +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.StackHCIVm.Models.IStackHciVMIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Name of the network interface + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: NetworkInterfaceName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the network interface. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Update-AzStackHCIVmStoragePath.md b/src/StackHCI/StackHCI/help/Update-AzStackHCIVmStoragePath.md new file mode 100644 index 000000000000..c2f0de589c83 --- /dev/null +++ b/src/StackHCI/StackHCI/help/Update-AzStackHCIVmStoragePath.md @@ -0,0 +1,235 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmstoragepath +schema: 2.0.0 +--- + +# Update-AzStackHCIVmStoragePath + +## SYNOPSIS +The operation to update a storage container. + +## SYNTAX + +### ByResourceId (Default) +``` +Update-AzStackHCIVmStoragePath [-ResourceId ] [-Tag ] [-WhatIf] [-Confirm] + [] +``` + +### UpdateExpanded +``` +Update-AzStackHCIVmStoragePath -Name -ResourceGroupName [-SubscriptionId ] + [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzStackHCIVmStoragePath -InputObject [-Tag ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The operation to update a storage container. + +## EXAMPLES + +### Example 1: Update a Storage Path. +```powershell +Update-AzStackHCIVmStoragePath -Name "testVhd" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} +``` + +```output +Name ResourceGroupName +---- ----------------- +testStoragePath test-rg +``` + +This command updates an exisiting storage path in the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +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.StackHCIVm.Models.IStackHciVMIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Name of the storage container + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: StorageContainerName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the storage path. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Update-AzStackHCIVmVirtualHardDisk.md b/src/StackHCI/StackHCI/help/Update-AzStackHCIVmVirtualHardDisk.md new file mode 100644 index 000000000000..8347070991de --- /dev/null +++ b/src/StackHCI/StackHCI/help/Update-AzStackHCIVmVirtualHardDisk.md @@ -0,0 +1,235 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmvirtualharddisk +schema: 2.0.0 +--- + +# Update-AzStackHCIVmVirtualHardDisk + +## SYNOPSIS +The operation to update a virtual hard disk. + +## SYNTAX + +### ByResourceId (Default) +``` +Update-AzStackHCIVmVirtualHardDisk [-ResourceId ] [-Tag ] [-WhatIf] [-Confirm] + [] +``` + +### UpdateExpanded +``` +Update-AzStackHCIVmVirtualHardDisk -Name -ResourceGroupName [-SubscriptionId ] + [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzStackHCIVmVirtualHardDisk -InputObject [-Tag ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The operation to update a virtual hard disk. + +## EXAMPLES + +### Example 1: Update a Virtual Hard Disk. +```powershell +Update-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} +``` + +```output +Name ResourceGroupName +---- ----------------- +testVhd test-rg +``` + +This command updates an exisiting virtual hard disk in the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +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.StackHCIVm.Models.IStackHciVMIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Name of the virtual hard disk + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: VirtualHardDiskName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the virtual hard disk . + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCI/help/Update-AzStackHCIVmVirtualMachine.md b/src/StackHCI/StackHCI/help/Update-AzStackHCIVmVirtualMachine.md new file mode 100644 index 000000000000..1c5ea87d4cf2 --- /dev/null +++ b/src/StackHCI/StackHCI/help/Update-AzStackHCIVmVirtualMachine.md @@ -0,0 +1,273 @@ +--- +external help file: Az.StackHCI-help.xml +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmvirtualmachine +schema: 2.0.0 +--- + +# Update-AzStackHCIVmVirtualMachine + +## SYNOPSIS +The operation to update a virtual machine instance. + +## SYNTAX + +### ByName (Default) +``` +Update-AzStackHCIVmVirtualMachine -Name -ResourceGroupName [-SubscriptionId ] + [-ProvisionVMAgent] [-ProvisionVMConfigAgent] [-VmMemoryInMB ] [-VmProcessor ] + [-VmSize ] [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] + [] +``` + +### ByResourceId +``` +Update-AzStackHCIVmVirtualMachine -ResourceId [-ProvisionVMAgent] [-ProvisionVMConfigAgent] + [-VmMemoryInMB ] [-VmProcessor ] [-VmSize ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The operation to update a virtual machine instance. + +## EXAMPLES + +### Example 1: Update the Size of the Virtual Machine. +```powershell +Update-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" -VmMemoryInMB "4" +``` + +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` + +This command updates an existing virtual machine in the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual machine + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: VirtualMachineName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProvisionVMAgent +Indicates whether virtual machine agent should be provisioned on the virtual machine. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProvisionVMConfigAgent +Indicates whether virtual machine configuration agent should be provisioned on the virtual machine. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the virtual network. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VmMemoryInMB +RAM in MB for the virtual machine instance + +```yaml +Type: System.Int64 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VmProcessor +number of processors for the virtual machine instance + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VmSize +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + +## NOTES + +## RELATED LINKS diff --git a/src/StackHCI/StackHCIVm.Autorest/Az.StackHCIVm.csproj b/src/StackHCI/StackHCIVm.Autorest/Az.StackHCIVm.csproj new file mode 100644 index 000000000000..c11d9dfb6e82 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/Az.StackHCIVm.csproj @@ -0,0 +1,10 @@ + + + StackHCIVm + StackHCI + StackHCIVm.Autorest + + + + + diff --git a/src/StackHCI/StackHCIVm.Autorest/Az.StackHCIVm.format.ps1xml b/src/StackHCI/StackHCIVm.Autorest/Az.StackHCIVm.format.ps1xml new file mode 100644 index 000000000000..f8351070d555 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/Az.StackHCIVm.format.ps1xml @@ -0,0 +1,4583 @@ + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.StackHciVMIdentity + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.StackHciVMIdentity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ExtensionName + + + ExtensionType + + + GalleryImageName + + + Location + + + LogicalNetworkName + + + MachineName + + + MarketplaceGalleryImageName + + + MetadataName + + + NetworkInterfaceName + + + OSType + + + Publisher + + + ResourceGroupName + + + ResourceUri + + + StorageContainerName + + + SubscriptionId + + + Version + + + VirtualHardDiskName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetail + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetail + + + + + + + + + + + + + + + + + + Code + + + Message + + + Target + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Identity + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Identity + + + + + + + + + + + + + + + PrincipalId + + + TenantId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.LocationData + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.LocationData + + + + + + + + + + + + + + + + + + + + + City + + + CountryOrRegion + + + District + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Operation + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Operation + + + + + + + + + + + + + + + + + + + + + ActionType + + + IsDataAction + + + Name + + + Origin + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.OperationDisplay + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.OperationDisplay + + + + + + + + + + + + + + + + + + + + + Description + + + Operation + + + Provider + + + Resource + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.OperationListResult + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.OperationListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ProxyResource + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ProxyResource + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name + + + SystemDataCreatedAt + + + SystemDataCreatedBy + + + SystemDataCreatedByType + + + SystemDataLastModifiedAt + + + SystemDataLastModifiedBy + + + SystemDataLastModifiedByType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Resource + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Resource + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemData + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemData + + + + + + + + + + + + + + + + + + + + + + + + + + + CreatedAt + + + CreatedBy + + + CreatedByType + + + LastModifiedAt + + + LastModifiedBy + + + LastModifiedByType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResource + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResource + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name + + + SystemDataCreatedAt + + + SystemDataCreatedBy + + + SystemDataCreatedByType + + + SystemDataLastModifiedAt + + + SystemDataLastModifiedBy + + + SystemDataLastModifiedByType + + + Location + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTags + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorDetailAutoGenerated + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorDetailAutoGenerated + + + + + + + + + + + + + + + + + + Code + + + Message + + + Target + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryDiskImage + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryDiskImage + + + + + + + + + + + + SizeInMb + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageIdentifier + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageIdentifier + + + + + + + + + + + + + + + + + + Offer + + + Publisher + + + Sku + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageProperties + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + CloudInitDataSource + + + ContainerId + + + HyperVGeneration + + + ImagePath + + + OSType + + + ProvisioningState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImages + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImages + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Location + + + Name + + + SystemDataCreatedAt + + + SystemDataCreatedBy + + + SystemDataCreatedByType + + + SystemDataLastModifiedAt + + + SystemDataLastModifiedBy + + + SystemDataLastModifiedByType + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImagesListResult + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImagesListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatus + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatus + + + + + + + + + + + + + + + + + + ErrorCode + + + ErrorMessage + + + ProgressPercentage + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusDownloadStatus + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusDownloadStatus + + + + + + + + + + + + DownloadSizeInMb + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusProvisioningStatus + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusProvisioningStatus + + + + + + + + + + + + + + + OperationId + + + Status + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImagesUpdateRequestTags + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImagesUpdateRequestTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersion + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersion + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryOSDiskImage + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryOSDiskImage + + + + + + + + + + + + SizeInMb + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgent + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name + + + SystemDataCreatedAt + + + SystemDataCreatedBy + + + SystemDataCreatedByType + + + SystemDataLastModifiedAt + + + SystemDataLastModifiedBy + + + SystemDataLastModifiedByType + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgentInstallStatus + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgentInstallStatus + + + + + + + + + + + + + + + + + + + + + AgentVersion + + + LastStatusChange + + + Status + + + VMUuid + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgentList + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgentList + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgentProperties + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgentProperties + + + + + + + + + + + + + + + + + + ProvisioningAction + + + ProvisioningState + + + Status + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestCredential + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestCredential + + + + + + + + + + + + + + + Password + + + Username + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HardwareProfileUpdate + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HardwareProfileUpdate + + + + + + + + + + + + + + + + + + MemoryMb + + + Processor + + + VMSize + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HttpProxyConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HttpProxyConfiguration + + + + + + + + + + + + + + + + + + + + + HttpProxy + + + HttpsProxy + + + NoProxy + + + TrustedCa + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HybridIdentityMetadata + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HybridIdentityMetadata + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name + + + SystemDataCreatedAt + + + SystemDataCreatedBy + + + SystemDataCreatedByType + + + SystemDataLastModifiedAt + + + SystemDataLastModifiedBy + + + SystemDataLastModifiedByType + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HybridIdentityMetadataList + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HybridIdentityMetadataList + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HybridIdentityMetadataProperties + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HybridIdentityMetadataProperties + + + + + + + + + + + + + + + + + + ProvisioningState + + + PublicKey + + + ResourceUid + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.InstanceViewStatus + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.InstanceViewStatus + + + + + + + + + + + + + + + + + + + + + + + + Code + + + DisplayStatus + + + Level + + + Message + + + Time + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.InterfaceDnsSettings + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.InterfaceDnsSettings + + + + + + + + + + + + DnsServer + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPConfiguration + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPConfigurationProperties + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPConfigurationProperties + + + + + + + + + + + + + + + + + + Gateway + + + PrefixLength + + + PrivateIPAddress + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPPool + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPPool + + + + + + + + + + + + + + + + + + End + + + Name + + + Start + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPPoolInfo + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPPoolInfo + + + + + + + + + + + + + + + Available + + + Used + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkProperties + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkProperties + + + + + + + + + + + + + + + ProvisioningState + + + VMSwitchName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkPropertiesDhcpOptions + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkPropertiesDhcpOptions + + + + + + + + + + + + DnsServer + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworks + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworks + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Location + + + Name + + + SystemDataCreatedAt + + + SystemDataCreatedBy + + + SystemDataCreatedByType + + + SystemDataLastModifiedAt + + + SystemDataLastModifiedBy + + + SystemDataLastModifiedByType + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworksListResult + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworksListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkStatus + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkStatus + + + + + + + + + + + + + + + ErrorCode + + + ErrorMessage + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkStatusProvisioningStatus + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkStatusProvisioningStatus + + + + + + + + + + + + + + + OperationId + + + Status + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworksUpdateRequestTags + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworksUpdateRequestTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageProperties + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageProperties + + + + + + + + + + + + + + + + + + + + + + + + CloudInitDataSource + + + ContainerId + + + HyperVGeneration + + + OSType + + + ProvisioningState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImages + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImages + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Location + + + Name + + + SystemDataCreatedAt + + + SystemDataCreatedBy + + + SystemDataCreatedByType + + + SystemDataLastModifiedAt + + + SystemDataLastModifiedBy + + + SystemDataLastModifiedByType + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImagesListResult + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImagesListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatus + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatus + + + + + + + + + + + + + + + + + + ErrorCode + + + ErrorMessage + + + ProgressPercentage + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusDownloadStatus + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusDownloadStatus + + + + + + + + + + + + DownloadSizeInMb + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusProvisioningStatus + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusProvisioningStatus + + + + + + + + + + + + + + + OperationId + + + Status + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImagesUpdateRequestTags + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImagesUpdateRequestTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceProperties + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceProperties + + + + + + + + + + + + + + + MacAddress + + + ProvisioningState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaces + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaces + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Location + + + Name + + + SystemDataCreatedAt + + + SystemDataCreatedBy + + + SystemDataCreatedByType + + + SystemDataLastModifiedAt + + + SystemDataLastModifiedBy + + + SystemDataLastModifiedByType + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfacesListResult + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfacesListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceStatus + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceStatus + + + + + + + + + + + + + + + ErrorCode + + + ErrorMessage + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceStatusProvisioningStatus + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceStatusProvisioningStatus + + + + + + + + + + + + + + + OperationId + + + Status + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfacesUpdateRequestTags + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfacesUpdateRequestTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdate + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdate + + + + + + + + + + + + ComputerName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateLinuxConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateLinuxConfiguration + + + + + + + + + + + + + + + ProvisionVMAgent + + + ProvisionVMConfigAgent + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateWindowsConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateWindowsConfiguration + + + + + + + + + + + + + + + ProvisionVMAgent + + + ProvisionVMConfigAgent + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.Route + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.Route + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RoutePropertiesFormat + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RoutePropertiesFormat + + + + + + + + + + + + + + + AddressPrefix + + + NextHopIPAddress + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTable + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTable + + + + + + + + + + + + + + + Etag + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshPublicKey + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshPublicKey + + + + + + + + + + + + + + + KeyData + + + Path + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerProperties + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerProperties + + + + + + + + + + + + + + + Path + + + ProvisioningState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainers + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainers + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Location + + + Name + + + SystemDataCreatedAt + + + SystemDataCreatedBy + + + SystemDataCreatedByType + + + SystemDataLastModifiedAt + + + SystemDataLastModifiedBy + + + SystemDataLastModifiedByType + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainersListResult + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainersListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerStatus + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerStatus + + + + + + + + + + + + + + + + + + + + + AvailableSizeMb + + + ContainerSizeMb + + + ErrorCode + + + ErrorMessage + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerStatusProvisioningStatus + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerStatusProvisioningStatus + + + + + + + + + + + + + + + OperationId + + + Status + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainersUpdateRequestTags + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainersUpdateRequestTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.Subnet + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.Subnet + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SubnetPropertiesFormat + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SubnetPropertiesFormat + + + + + + + + + + + + + + + + + + + + + AddressPrefix + + + AddressPrefixes + + + IPAllocationMethod + + + Vlan + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskProperties + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + BlockSizeByte + + + ContainerId + + + DiskFileFormat + + + DiskSizeGb + + + Dynamic + + + HyperVGeneration + + + LogicalSectorByte + + + PhysicalSectorByte + + + ProvisioningState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisks + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisks + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Location + + + Name + + + SystemDataCreatedAt + + + SystemDataCreatedBy + + + SystemDataCreatedByType + + + SystemDataLastModifiedAt + + + SystemDataLastModifiedBy + + + SystemDataLastModifiedByType + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisksListResult + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisksListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskStatus + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskStatus + + + + + + + + + + + + + + + ErrorCode + + + ErrorMessage + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskStatusProvisioningStatus + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskStatusProvisioningStatus + + + + + + + + + + + + + + + OperationId + + + Status + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisksUpdateRequestTags + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisksUpdateRequestTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineConfigAgentInstanceView + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineConfigAgentInstanceView + + + + + + + + + + + + VMConfigAgentVersion + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstance + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name + + + SystemDataCreatedAt + + + SystemDataCreatedBy + + + SystemDataCreatedByType + + + SystemDataLastModifiedAt + + + SystemDataLastModifiedBy + + + SystemDataLastModifiedByType + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceListResult + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceProperties + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceProperties + + + + + + + + + + + + + + + + + + ProvisioningState + + + ResourceUid + + + VMId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesHardwareProfile + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesHardwareProfile + + + + + + + + + + + + + + + + + + MemoryMb + + + Processor + + + VMSize + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig + + + + + + + + + + + + + + + + + + MaximumMemoryMb + + + MinimumMemoryMb + + + TargetMemoryBuffer + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfile + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfile + + + + + + + + + + + + + + + + + + AdminPassword + + + AdminUsername + + + ComputerName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileLinuxConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileLinuxConfiguration + + + + + + + + + + + + + + + + + + DisablePasswordAuthentication + + + ProvisionVMAgent + + + ProvisionVMConfigAgent + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileWindowsConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileWindowsConfiguration + + + + + + + + + + + + + + + + + + + + + EnableAutomaticUpdate + + + ProvisionVMAgent + + + ProvisionVMConfigAgent + + + TimeZone + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesSecurityProfile + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesSecurityProfile + + + + + + + + + + + + + + + EnableTpm + + + SecurityType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesSecurityProfileUefiSettings + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesSecurityProfileUefiSettings + + + + + + + + + + + + SecureBootEnabled + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfile + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfile + + + + + + + + + + + + VMConfigStoragePathId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileOSDisk + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileOSDisk + + + + + + + + + + + + OSType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceStatus + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceStatus + + + + + + + + + + + + + + + + + + ErrorCode + + + ErrorMessage + + + PowerState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceStatusProvisioningStatus + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceStatusProvisioningStatus + + + + + + + + + + + + + + + OperationId + + + Status + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentConfiguration + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentConfiguration + + + + + + + + + + + + + + + + + + + + + + + + + + + ConfigMode + + + ExtensionsEnabled + + + GuestConfigurationEnabled + + + IncomingConnectionsPort + + + ProxyBypass + + + ProxyUrl + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentUpgrade + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentUpgrade + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CorrelationId + + + DesiredVersion + + + EnableAutomaticUpgrade + + + LastAttemptDesiredVersion + + + LastAttemptMessage + + + LastAttemptStatus + + + LastAttemptTimestamp + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentVersion + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentVersion + + + + + + + + + + + + + + + + + + AgentVersion1 + + + DownloadLink + + + OSType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentVersionsList + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentVersionsList + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.CloudMetadata + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.CloudMetadata + + + + + + + + + + + + Provider + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ConfigurationExtension + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ConfigurationExtension + + + + + + + + + + + + Publisher + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.DetectedProperties + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.DetectedProperties + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ExtensionTargetProperties + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ExtensionTargetProperties + + + + + + + + + + + + TargetVersion + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ExtensionValue + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ExtensionValue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name + + + SystemDataCreatedAt + + + SystemDataCreatedBy + + + SystemDataCreatedByType + + + SystemDataLastModifiedAt + + + SystemDataLastModifiedBy + + + SystemDataLastModifiedByType + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ExtensionValueProperties + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ExtensionValueProperties + + + + + + + + + + + + + + + + + + ExtensionType + + + Publisher + + + Version + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.HybridIdentityMetadataAutoGenerated + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.HybridIdentityMetadataAutoGenerated + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name + + + SystemDataCreatedAt + + + SystemDataCreatedBy + + + SystemDataCreatedByType + + + SystemDataLastModifiedAt + + + SystemDataLastModifiedBy + + + SystemDataLastModifiedByType + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.HybridIdentityMetadataListAutoGenerated + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.HybridIdentityMetadataListAutoGenerated + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.HybridIdentityMetadataPropertiesAutoGenerated + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.HybridIdentityMetadataPropertiesAutoGenerated + + + + + + + + + + + + + + + PublicKey + + + VMId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPAddress + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPAddress + + + + + + + + + + + + + + + Address + + + Version + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.Machine + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.Machine + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Location + + + Name + + + SystemDataCreatedAt + + + SystemDataCreatedBy + + + SystemDataCreatedByType + + + SystemDataLastModifiedAt + + + SystemDataLastModifiedBy + + + SystemDataLastModifiedByType + + + Kind + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtension + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtension + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Location + + + Name + + + SystemDataCreatedAt + + + SystemDataCreatedBy + + + SystemDataCreatedByType + + + SystemDataLastModifiedAt + + + SystemDataLastModifiedBy + + + SystemDataLastModifiedByType + + + ResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceView + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceView + + + + + + + + + + + + + + + Name + + + TypeHandlerVersion + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceViewStatus + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceViewStatus + + + + + + + + + + + + + + + + + + + + + + + + Code + + + DisplayStatus + + + Level + + + Message + + + Time + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionProperties + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + AutoUpgradeMinorVersion + + + EnableAutomaticUpgrade + + + ForceUpdateTag + + + ProvisioningState + + + Publisher + + + TypeHandlerVersion + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionsListResult + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionsListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdateProperties + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdateProperties + + + + + + + + + + + + + + + + + + + + + + + + AutoUpgradeMinorVersion + + + EnableAutomaticUpgrade + + + ForceUpdateTag + + + Publisher + + + TypeHandlerVersion + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineListResult + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineProperties + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AdFqdn + + + AgentVersion + + + ClientPublicKey + + + DisplayName + + + DnsFqdn + + + DomainName + + + LastStatusChange + + + MachineFqdn + + + MssqlDiscovered + + + OSName + + + OSSku + + + OSType + + + OSVersion + + + ParentClusterResourceId + + + PrivateLinkScopeResourceId + + + ProvisioningState + + + Status + + + VMId + + + VMUuid + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineUpdate + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineUpdate + + + + + + + + + + + + Kind + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineUpdateProperties + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineUpdateProperties + + + + + + + + + + + + + + + ParentClusterResourceId + + + PrivateLinkScopeResourceId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OperationValue + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OperationValue + + + + + + + + + + + + + + + + + + IsDataAction + + + Name + + + Origin + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OperationValueDisplay + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OperationValueDisplay + + + + + + + + + + + + + + + + + + + + + Description + + + Operation + + + Provider + + + Resource + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfile + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfile + + + + + + + + + + + + ComputerName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettings + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettings + + + + + + + + + + + + + + + AssessmentMode + + + PatchMode + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ResourceUpdateTags + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ResourceUpdateTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatus + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatus + + + + + + + + + + + + + + + StartupType + + + Status + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.SubnetAutoGenerated + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.SubnetAutoGenerated + + + + + + + + + + + + AddressPrefix + + + + + + + + \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/Az.StackHCIVm.psd1 b/src/StackHCI/StackHCIVm.Autorest/Az.StackHCIVm.psd1 new file mode 100644 index 000000000000..ce9f05d34861 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/Az.StackHCIVm.psd1 @@ -0,0 +1,24 @@ +@{ + GUID = '7389f67c-ec9d-4c13-9c9a-308834413af6' + RootModule = './Az.StackHCIVm.psm1' + ModuleVersion = '1.1.0' + CompatiblePSEditions = 'Core', 'Desktop' + Author = 'Microsoft Corporation' + CompanyName = 'Microsoft Corporation' + Copyright = 'Microsoft Corporation. All rights reserved.' + Description = 'Microsoft Azure PowerShell: StackHciVM cmdlets' + PowerShellVersion = '5.1' + DotNetFrameworkVersion = '4.7.2' + RequiredAssemblies = './bin/Az.StackHCIVm.private.dll' + FormatsToProcess = './Az.StackHCIVm.format.ps1xml' + FunctionsToExport = 'Add-AzStackHCIVmVirtualMachineDataDisk', 'Add-AzStackHCIVmVirtualMachineNetworkInterface', 'Get-AzStackHCIVmImage', 'Get-AzStackHCIVmLogicalNetwork', 'Get-AzStackHCIVmNetworkInterface', 'Get-AzStackHCIVmStoragePath', 'Get-AzStackHCIVmVirtualHardDisk', 'Get-AzStackHCIVmVirtualMachine', 'New-AzStackHCIVmImage', 'New-AzStackHCIVmLogicalNetwork', 'New-AzStackHCIVmNetworkInterface', 'New-AzStackHCIVmStoragePath', 'New-AzStackHCIVmVirtualHardDisk', 'New-AzStackHCIVmVirtualMachine', 'Remove-AzStackHCIVmImage', 'Remove-AzStackHCIVmLogicalNetwork', 'Remove-AzStackHCIVmNetworkInterface', 'Remove-AzStackHCIVmStoragePath', 'Remove-AzStackHCIVmVirtualHardDisk', 'Remove-AzStackHCIVmVirtualMachine', 'Remove-AzStackHCIVmVirtualMachineDataDisk', 'Remove-AzStackHCIVmVirtualMachineNetworkInterface', 'Restart-AzStackHCIVmVirtualMachine', 'Start-AzStackHCIVmVirtualMachine', 'Stop-AzStackHCIVmVirtualMachine', 'Update-AzStackHCIVmImage', 'Update-AzStackHCIVmLogicalNetwork', 'Update-AzStackHCIVmNetworkInterface', 'Update-AzStackHCIVmStoragePath', 'Update-AzStackHCIVmVirtualHardDisk', 'Update-AzStackHCIVmVirtualMachine', '*' + AliasesToExport = '*' + PrivateData = @{ + PSData = @{ + Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'StackHciVM' + LicenseUri = 'https://aka.ms/azps-license' + ProjectUri = 'https://github.com/Azure/azure-powershell' + ReleaseNotes = '' + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/Az.StackHCIVm.psm1 b/src/StackHCI/StackHCIVm.Autorest/Az.StackHCIVm.psm1 new file mode 100644 index 000000000000..989c71f8ed80 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/Az.StackHCIVm.psm1 @@ -0,0 +1,115 @@ +# region Generated + # ---------------------------------------------------------------------------------- + # 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. + # ---------------------------------------------------------------------------------- + # Load required Az.Accounts module + $accountsName = 'Az.Accounts' + $accountsModule = Get-Module -Name $accountsName + if(-not $accountsModule) { + $localAccountsPath = Join-Path $PSScriptRoot 'generated\modules' + if(Test-Path -Path $localAccountsPath) { + $localAccounts = Get-ChildItem -Path $localAccountsPath -Recurse -Include 'Az.Accounts.psd1' | Select-Object -Last 1 + if($localAccounts) { + $accountsModule = Import-Module -Name ($localAccounts.FullName) -Scope Global -PassThru + } + } + if(-not $accountsModule) { + $hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'2.7.5' } | Measure-Object).Count -gt 0 + if($hasAdequateVersion) { + $accountsModule = Import-Module -Name $accountsName -MinimumVersion 2.7.5 -Scope Global -PassThru + } + } + } + + if(-not $accountsModule) { + Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. For installation instructions, please see: https://learn.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop + } elseif (($accountsModule.Version -lt [System.Version]'2.7.5') -and (-not $localAccounts)) { + Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to add the switch '-RegenerateSupportModule' when executing 'test-module.ps1'. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop + } + Write-Information "Loaded Module '$($accountsModule.Name)'" + + # Load the private module dll + $null = Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.StackHCIVm.private.dll') + + # Get the private module's instance + $instance = [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module]::Instance + + # 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 + + + # 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 + + # Export proxy cmdlet scripts + $exportsPath = Join-Path $PSScriptRoot './exports' + $directories = Get-ChildItem -Directory -Path $exportsPath + $profileDirectory = $null + if($instance.ProfileName) { + if(($directories | ForEach-Object { $_.Name }) -contains $instance.ProfileName) { + $profileDirectory = $directories | Where-Object { $_.Name -eq $instance.ProfileName } + } else { + # Don't export anything if the profile doesn't exist for the module + $exportsPath = $null + Write-Warning "Selected Azure profile '$($instance.ProfileName)' does not exist for module '$($instance.Name)'. No cmdlets were loaded." + } + } elseif(($directories | Measure-Object).Count -gt 0) { + # 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 + Export-ModuleMember -Function $cmdletNames -Alias (Get-ScriptCmdlet -ScriptFolder $exportsPath -AsAlias) + } + + # Finalize initialization of this module + $instance.Init(); + Write-Information "Loaded Module '$($instance.Name)'" +# endregion diff --git a/src/StackHCI/StackHCIVm.Autorest/Properties/AssemblyInfo.cs b/src/StackHCI/StackHCIVm.Autorest/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..f414c742e39a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/Properties/AssemblyInfo.cs @@ -0,0 +1,28 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Microsoft Azure Powershell - StackHCIVm")] +[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)] +[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)] +[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)] + +[assembly: ComVisible(false)] +[assembly: CLSCompliant(false)] +[assembly: Guid("c0ecaa71-a5f0-4cd8-ae6b-d9a5c839f98a")] +[assembly: AssemblyVersion("0.1.0")] +[assembly: AssemblyFileVersion("0.1.0")] diff --git a/src/StackHCI/StackHCIVm.Autorest/README.md b/src/StackHCI/StackHCIVm.Autorest/README.md new file mode 100644 index 000000000000..3d12d9194943 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/README.md @@ -0,0 +1,647 @@ + +# Az.StackHCIVm +This directory contains the PowerShell module for the StackHciVM service. + +--- +## Status +[![Az.StackHCIVm](https://img.shields.io/powershellgallery/v/Az.StackHCIVm.svg?style=flat-square&label=Az.StackHCIVm "Az.StackHCIVm")](https://www.powershellgallery.com/packages/Az.StackHCIVm/) + +## Info +- Modifiable: yes +- Generated: all +- Committed: yes +- Packaged: yes + +--- +## Detail +This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension. + +## Module Requirements +- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater + +## Authentication +AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent. + +## Development +For information on how to develop for `Az.StackHCIVm`, see [how-to.md](how-to.md). + + +--- + +## Generation Requirements + +Use of the beta version of `autorest.powershell` generator requires the following: + +- [NodeJS LTS](https://nodejs.org) (10.15.x LTS preferred) + - **Note**: It _will not work_ with Node < 10.x. Using 11.x builds may cause issues as they may introduce instability or breaking changes. + > If you want an easy way to install and update Node, [NVS - Node Version Switcher](../nodejs/installing-via-nvs.md) or [NVM - Node Version Manager](../nodejs/installing-via-nvm.md) is recommended. +- [AutoRest](https://aka.ms/autorest) v3 beta
`npm install -g autorest@autorest`
  +- PowerShell 6.0 or greater + - If you don't have it installed, you can use the cross-platform npm package
`npm install -g pwsh`
  +- .NET Core SDK 2.0 or greater + - If you don't have it installed, you can use the cross-platform npm package
`npm install -g dotnet-sdk-2.2`
  + +## Run Generation + +In this directory, run AutoRest: + +> `autorest-beta` + +--- + +### AutoRest Configuration + +> see https://aka.ms/autorest + +```yaml +require: + - $(this-folder)/../../readme.azure.noprofile.md +repo: azure-rest-api-specs +# lock the commit +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/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-03-15-preview/HybridCompute.json + +module-version: 1.1.0 +title: StackHCIVm +service-name: StackHCIVm +subject-prefix: $(service-name) +root-module-name: $(prefix).StackHCI + +inlining-threshold: 50 +resourcegroup-append: true +directive: + - from: swagger-document + where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}"].delete.responses + transform: >- + return { + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + }, + "200": { + "description": "OK" + }, + "202": { + "description": "Accepted" + }, + "204": { + "description": "No content" + } + } + - from: swagger-document + where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}"].delete + transform: >- + $["x-ms-long-running-operation"] = true + + - from: swagger-document + where: $.paths["/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"].delete.responses + transform: >- + return { + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + }, + "200": { + "description": "OK" + }, + "202": { + "description": "Accepted" + }, + "204": { + "description": "No content" + } + } + - from: swagger-document + where: $.paths["/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"].delete + transform: >- + $["x-ms-long-running-operation"] = true + + - from: swagger-document + where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}"].get + transform: >- + $["description"] = "Gets a logical network" + + - from: swagger-document + where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}"].delete.responses + transform: >- + return { + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + }, + "200": { + "description": "OK" + }, + "202": { + "description": "Accepted" + }, + "204": { + "description": "No content" + } + } + - from: swagger-document + where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}"].delete + transform: >- + $["x-ms-long-running-operation"] = true + + - from: swagger-document + where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}"].delete.responses + transform: >- + return { + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + }, + "200": { + "description": "OK" + }, + "202": { + "description": "Accepted" + }, + "204": { + "description": "No content" + } + } + - from: swagger-document + where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}"].delete + transform: >- + $["x-ms-long-running-operation"] = true + + - from: swagger-document + where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}"].delete.responses + transform: >- + return { + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + }, + "200": { + "description": "OK" + }, + "202": { + "description": "Accepted" + }, + "204": { + "description": "No content" + } + } + - from: swagger-document + where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}"].delete + transform: >- + $["x-ms-long-running-operation"] = true + + - from: swagger-document + where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}"].delete.responses + transform: >- + return { + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + }, + "200": { + "description": "OK" + }, + "202": { + "description": "Accepted" + }, + "204": { + "description": "No content" + } + } + - from: swagger-document + where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}"].delete + transform: >- + $["x-ms-long-running-operation"] = true + + - from: swagger-document + where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}"].delete.responses + transform: >- + return { + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + }, + "200": { + "description": "OK" + }, + "202": { + "description": "Accepted" + }, + "204": { + "description": "No content" + } + } + - from: swagger-document + where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}"].delete + transform: >- + $["x-ms-long-running-operation"] = true + + + # Remove the unexpanded parameter set + - where: + variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$|^GetViaIdentity$ + remove: true + - where: + parameter-name: DefaultProfile + hide: true + - where: + parameter-name: Break + hide: true + - where: + parameter-name: HttpPipelineAppend + hide: true + - where: + parameter-name: HttpPipelinePrepend + hide: true + - where: + parameter-name: Proxy + hide: true + - where: + parameter-name: ProxyCredential + hide: true + - where: + parameter-name: ProxyUseDefaultCredentials + hide: true + - where: + verb: New + parameter-name: ExtendedLocationName + set: + parameter-name: CustomLocationId + - where: + verb: New + parameter-name: ExtendedLocationType + hide: true + set: + default: + script: '"CustomLocation"' + - where: + parameter-name: SubscriptionId + set: + default: + name: SubscriptionId Default + description: Gets the SubscriptionId from the current context. + script: '(Get-AzContext).Subscription.Id' + - where: + verb: New + parameter-name: IdentifierOffer + set: + parameter-name: Offer + - where: + verb: New + parameter-name: IdentifierPublisher + set: + parameter-name: Publisher + - where: + verb: New + parameter-name: IdentifierSku + set: + parameter-name: Sku + - where: + verb: New + parameter-name: VersionName + set: + parameter-name: Version + - where: + verb: New + subject: GalleryImage + hide: true + - where: + verb: New + subject: MarketplaceGalleryImage + hide: true + - where: + verb: Get + subject: GalleryImage + hide: true + - where: + verb: Get + subject: MarketplaceGalleryImage + hide: true + - where: + verb: Remove + subject: GalleryImage + hide: true + - where: + verb: Remove + subject: MarketplaceGalleryImage + hide: true + - where: + verb: Update + subject: GalleryImage + hide: true + - where: + verb: Update + subject: MarketplaceGalleryImage + hide: true + - where: + verb: New + subject: VirtualHardDisk + hide: true + - where: + verb: New + subject: NetworkInterface + hide: true + - where: + verb: New + subject: LogicalNetwork + hide: true + - where: + verb: New + subject: VirtualHardDisk + parameter-name: DiskSizeGb + set: + parameter-name: SizeGb + - where: + verb: New + subject: VirtualHardDisk + parameter-name: ContainerId + set: + parameter-name: StoragePathId + - where: + verb: New + subject: GalleryImage + parameter-name: ContainerId + set: + parameter-name: StoragePathId + - where: + verb: New + subject: MarketplaceGalleryImage + parameter-name: ContainerId + set: + parameter-name: StoragePathId + - where: + verb: New + subject: LogicalNetwork + parameter-name: DhcpOptionDnsServer + set: + parameter-name: DnsServer + - where: + model-name: Subnet + property-name: PropertiesAddressPrefixes + set: + property-name: AddressPrefixes + - where: + verb: New + subject: NetworkInterface + parameter-name: DnsSettingDnsServer + set: + parameter-name: DnsServer + - where: + model-name: IPConfiguration + property-name: PrivateIPAddress + set: + property-name: IPAddress + - where: + model-name: IPConfiguration + property-name: PrivateIPAllocationMethod + set: + property-name: IPAllocationMethod + - where: + subject: VirtualMachineInstance + parameter-name: DynamicMemoryConfigMaximumMemoryMb + set: + parameter-name: DynamicMemoryMaximumMemoryInMb + - where: + subject: VirtualMachineInstance + parameter-name: DynamicMemoryConfigMinimumMemoryMb + set: + parameter-name: DynamicMemoryMinimumMemoryInMb + - where: + verb: New + subject: VirtualMachineInstance + parameter-name: DynamicMemoryConfigTargetMemoryBuffer + set: + parameter-name: DynamicMemoryTargetBuffer + - where: + verb: New + subject: VirtualMachineInstance + parameter-name: HardwareProfileProcessor + set: + parameter-name: VmProcessor + - where: + verb: New + subject: VirtualMachineInstance + parameter-name: HardwareProfileMemoryMb + set: + parameter-name: VmMemory + - where: + verb: New + subject: VirtualMachineInstance + parameter-name: HardwareProfileVMSize + set: + parameter-name: VmSize + - where: + verb: New + subject: VirtualMachineInstance + parameter-name: ImageReferenceId + set: + parameter-name: ImageId + - where: + verb: New + subject: VirtualMachineInstance + parameter-name: OSProfileAdminPassword + set: + parameter-name: AdminPassword + - where: + verb: New + subject: VirtualMachineInstance + parameter-name: OSProfileAdminUsername + set: + parameter-name: AdminUsername + - where: + verb: New + subject: VirtualMachineInstance + parameter-name: OSProfileComputerName + set: + parameter-name: ComputerName + - where: + verb: New + subject: VirtualMachineInstance + parameter-name: OSProfileAdminPassword + set: + parameter-name: AdminPassword + - where: + verb: New + subject: VirtualMachineInstance + parameter-name: OSProfileAdminUsername + set: + parameter-name: AdminUsername + - where: + verb: New + subject: VirtualMachineInstance + parameter-name: LinuxConfigurationDisablePasswordAuthentication + set: + parameter-name: DisablePasswordAuthentication + - where: + verb: New + subject: VirtualMachineInstance + parameter-name: WindowConfigurationEnableAutomaticUpdate + set: + parameter-name: EnableAutomaticUpdate + - where: + verb: New + subject: VirtualMachineInstance + parameter-name: WindowConfigurationTimeZone + set: + parameter-name: TimeZone + - where: + verb: New + subject: VirtualMachineInstance + parameter-name: SecurityProfileEnableTpm + set: + parameter-name: EnableTpm + - where: + verb: New + subject: VirtualMachineInstance + parameter-name: UefiSettingSecureBootEnabled + set: + parameter-name: SecureBootEnabled + - where: + verb: New + subject: VirtualMachineInstance + parameter-name: StorageProfileVMConfigStoragePathId + set: + parameter-name: StoragePathId + - where: + verb: New + subject: StorageContainer + set: + subject: StoragePath + hide: true + - where: + verb: Get + subject: StorageContainer + set: + subject: StoragePath + - where: + verb: Remove + subject: StorageContainer + set: + subject: StoragePath + - where: + verb: Update + subject: StorageContainer + set: + subject: StoragePath + - where: + verb: Remove + subject: VirtualHardDisk + hide: true + - where: + verb: Remove + subject: VirtualMachineInstance + set: + subject: VirtualMachine + hide: true + - where: + verb: Start + subject: VirtualMachineInstance + set: + subject: VirtualMachine + hide: true + - where: + verb: Stop + subject: VirtualMachineInstance + set: + subject: VirtualMachine + hide: true + - where: + verb: Restart + subject: VirtualMachineInstance + set: + subject: VirtualMachine + hide: true + - where: + verb: Get + subject: VirtualMachineInstance + set: + subject: VirtualMachine + hide: true + - where: + verb: New + subject: VirtualMachineInstance + set: + subject: VirtualMachine + hide: true + - where: + verb: Update + subject: VirtualMachineInstance + set: + subject: VirtualMachine + hide: true + - where: + verb: Remove + subject: NetworkInterface + hide: true + - where: + verb: Remove + subject: LogicalNetwork + hide: true + - where: + verb: New + subject: LogicalNetwork + hide: true + - where: + verb: Remove + subject: StoragePath + hide: true + - where: + model-name: LogicalNetwork + property-name: Subnet + set: + property-name: Subnets + - where: + subject: AgentVersion + hide: true + - where: + subject: ExtensionMetadata + hide: true + - where: + subject: GuestAgent + hide: true + - where: + subject: HybridIdentityMetadata + hide: true + - where: + subject: MachineExtension + hide: true + - where: + subject: NetworkProfile + hide: true + - where: + verb: Set + hide: true + - where: + subject: Machine + hide: true + - where: + subject: Extension + hide: true + - where: + subject-prefix: StackHciVM + set: + subject-prefix: StackHCIVm + +``` diff --git a/src/StackHCI/StackHCIVm.Autorest/build-module.ps1 b/src/StackHCI/StackHCIVm.Autorest/build-module.ps1 new file mode 100644 index 000000000000..e11abcbcaee9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/build-module.ps1 @@ -0,0 +1,172 @@ +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$Run, [switch]$Test, [switch]$Docs, [switch]$Pack, [switch]$Code, [switch]$Release, [switch]$Debugger, [switch]$NoDocs) +$ErrorActionPreference = 'Stop' + +if($PSEdition -ne 'Core') { + Write-Error 'This script requires PowerShell Core to execute. [Note] Generated cmdlets will work in both PowerShell Core or Windows PowerShell.' +} + +if(-not $Isolated -and -not $Debugger) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + + if($LastExitCode -ne 0) { + # Build failed. Don't attempt to run the module. + return + } + + if($Test) { + . (Join-Path $PSScriptRoot 'test-module.ps1') + if($LastExitCode -ne 0) { + # Tests failed. Don't attempt to run the module. + return + } + } + + if($Docs) { + . (Join-Path $PSScriptRoot 'generate-help.ps1') + if($LastExitCode -ne 0) { + # Docs generation failed. Don't attempt to run the module. + return + } + } + + if($Pack) { + . (Join-Path $PSScriptRoot 'pack-module.ps1') + if($LastExitCode -ne 0) { + # Packing failed. Don't attempt to run the module. + return + } + } + + $runModulePath = Join-Path $PSScriptRoot 'run-module.ps1' + if($Code) { + . $runModulePath -Code + } elseif($Run) { + . $runModulePath + } else { + Write-Host -ForegroundColor Cyan "To run this module in an isolated PowerShell session, run the 'run-module.ps1' script or provide the '-Run' parameter to this script." + } + return +} + +$binFolder = Join-Path $PSScriptRoot 'bin' +$objFolder = Join-Path $PSScriptRoot 'obj' + +if(-not $Debugger) { + Write-Host -ForegroundColor Green 'Cleaning build folders...' + $null = Remove-Item -Recurse -ErrorAction SilentlyContinue -Path $binFolder, $objFolder + + if((Test-Path $binFolder) -or (Test-Path $objFolder)) { + Write-Host -ForegroundColor Cyan 'Did you forget to exit your isolated module session before rebuilding?' + Write-Error 'Unable to clean ''bin'' or ''obj'' folder. A process may have an open handle.' + } + + Write-Host -ForegroundColor Green 'Compiling module...' + $buildConfig = 'Debug' + if($Release) { + $buildConfig = 'Release' + } + dotnet publish $PSScriptRoot --verbosity quiet --configuration $buildConfig /nologo + if($LastExitCode -ne 0) { + Write-Error 'Compilation failed.' + } + + $null = Remove-Item -Recurse -ErrorAction SilentlyContinue -Path (Join-Path $binFolder 'Debug'), (Join-Path $binFolder 'Release') +} + +$dll = Join-Path $PSScriptRoot 'bin\Az.StackHCIVm.private.dll' +if(-not (Test-Path $dll)) { + Write-Error "Unable to find output assembly in '$binFolder'." +} + +# Load DLL to use build-time cmdlets +$null = Import-Module -Name $dll + +$modulePaths = $dll +$customPsm1 = Join-Path $PSScriptRoot 'custom\Az.StackHCIVm.custom.psm1' +if(Test-Path $customPsm1) { + $modulePaths = @($dll, $customPsm1) +} + +$exportsFolder = Join-Path $PSScriptRoot 'exports' +if(Test-Path $exportsFolder) { + $null = Get-ChildItem -Path $exportsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue +} +$null = New-Item -ItemType Directory -Force -Path $exportsFolder + +$internalFolder = Join-Path $PSScriptRoot 'internal' +if(Test-Path $internalFolder) { + $null = Get-ChildItem -Path $internalFolder -Recurse -Exclude '*.psm1', 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue +} +$null = New-Item -ItemType Directory -Force -Path $internalFolder + +$psd1 = Join-Path $PSScriptRoot './Az.StackHCIVm.psd1' +$guid = Get-ModuleGuid -Psd1Path $psd1 +$moduleName = 'Az.StackHCIVm' +$examplesFolder = Join-Path $PSScriptRoot 'examples' +$null = New-Item -ItemType Directory -Force -Path $examplesFolder + +Write-Host -ForegroundColor Green 'Creating cmdlets for specified models...' +$modelCmdlets = @() +$modelCmdletFolder = Join-Path (Join-Path $PSScriptRoot './custom') 'autogen-model-cmdlets' +if (Test-Path $modelCmdletFolder) { + $null = Remove-Item -Force -Recurse -Path $modelCmdletFolder +} +if ($modelCmdlets.Count -gt 0) { + . (Join-Path $PSScriptRoot 'create-model-cmdlets.ps1') + CreateModelCmdlet($modelCmdlets) +} + +if($NoDocs) { + Write-Host -ForegroundColor Green 'Creating exports...' + Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ExcludeDocs -ExamplesFolder $examplesFolder +} else { + Write-Host -ForegroundColor Green 'Creating exports and docs...' + $moduleDescription = 'Microsoft Azure PowerShell: StackHciVM cmdlets' + $docsFolder = Join-Path $PSScriptRoot 'docs' + if(Test-Path $docsFolder) { + $null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue + } + $null = New-Item -ItemType Directory -Force -Path $docsFolder + $addComplexInterfaceInfo = ![System.Convert]::ToBoolean('true') + Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ModuleDescription $moduleDescription -DocsFolder $docsFolder -ExamplesFolder $examplesFolder -ModuleGuid $guid -AddComplexInterfaceInfo:$addComplexInterfaceInfo +} + +Write-Host -ForegroundColor Green 'Creating format.ps1xml...' +$formatPs1xml = Join-Path $PSScriptRoot './Az.StackHCIVm.format.ps1xml' +Export-FormatPs1xml -FilePath $formatPs1xml + +Write-Host -ForegroundColor Green 'Creating psd1...' +$customFolder = Join-Path $PSScriptRoot 'custom' +Export-Psd1 -ExportsFolder $exportsFolder -CustomFolder $customFolder -Psd1Path $psd1 -ModuleGuid $guid + +Write-Host -ForegroundColor Green 'Creating test stubs...' +$testFolder = Join-Path $PSScriptRoot 'test' +$null = New-Item -ItemType Directory -Force -Path $testFolder +Export-TestStub -ModuleName $moduleName -ExportsFolder $exportsFolder -OutputFolder $testFolder + +Write-Host -ForegroundColor Green 'Creating example stubs...' +Export-ExampleStub -ExportsFolder $exportsFolder -OutputFolder $examplesFolder + +if (Test-Path (Join-Path $PSScriptRoot 'generate-portal-ux.ps1')) +{ + Write-Host -ForegroundColor Green 'Creating ux metadata...' + . (Join-Path $PSScriptRoot 'generate-portal-ux.ps1') +} + +Write-Host -ForegroundColor Green '-------------Done-------------' diff --git a/src/StackHCI/StackHCIVm.Autorest/check-dependencies.ps1 b/src/StackHCI/StackHCIVm.Autorest/check-dependencies.ps1 new file mode 100644 index 000000000000..c29591c7bfe1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/check-dependencies.ps1 @@ -0,0 +1,65 @@ +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$Accounts, [switch]$Pester, [switch]$Resources) +$ErrorActionPreference = 'Stop' + +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +function DownloadModule ([bool]$predicate, [string]$path, [string]$moduleName, [string]$versionMinimum, [string]$requiredVersion) { + if($predicate) { + $module = Get-Module -ListAvailable -Name $moduleName + if((-not $module) -or ($versionMinimum -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -ge [System.Version]$versionMinimum } | Measure-Object).Count -eq 0) -or ($requiredVersion -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -eq [System.Version]$requiredVersion } | Measure-Object).Count -eq 0)) { + $null = New-Item -ItemType Directory -Force -Path $path + Write-Host -ForegroundColor Green "Installing local $moduleName module into '$path'..." + if ($requiredVersion) { + Find-Module -Name $moduleName -RequiredVersion $requiredVersion -Repository PSGallery | Save-Module -Path $path + }elseif($versionMinimum) { + Find-Module -Name $moduleName -MinimumVersion $versionMinimum -Repository PSGallery | Save-Module -Path $path + } else { + Find-Module -Name $moduleName -Repository PSGallery | Save-Module -Path $path + } + } + } +} + +$ProgressPreference = 'SilentlyContinue' +$all = (@($Accounts.IsPresent, $Pester.IsPresent) | Select-Object -Unique | Measure-Object).Count -eq 1 + +$localModulesPath = Join-Path $PSScriptRoot 'generated\modules' +if(Test-Path -Path $localModulesPath) { + $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" +} + +DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '2.7.5' +DownloadModule -predicate ($all -or $Pester) -path $localModulesPath -moduleName 'Pester' -requiredVersion '4.10.1' + +$tools = Join-Path $PSScriptRoot 'tools' +$resourceDir = Join-Path $tools 'Resources' +$resourceModule = Join-Path $HOME '.PSSharedModules\Resources\Az.Resources.TestSupport.psm1' + +if ($Resources.IsPresent -and ((-not (Test-Path -Path $resourceModule)) -or $RegenerateSupportModule.IsPresent)) { + Write-Host -ForegroundColor Green "Building local Resource module used for test..." + Set-Location $resourceDir + $null = autorest .\README.md --use:@autorest/powershell@3.0.414 --output-folder=$HOME/.PSSharedModules/Resources + $null = Copy-Item custom/* $HOME/.PSSharedModules/Resources/custom/ + Set-Location $HOME/.PSSharedModules/Resources + $null = .\build-module.ps1 + Set-Location $PSScriptRoot +} diff --git a/src/StackHCI/StackHCIVm.Autorest/create-model-cmdlets.ps1 b/src/StackHCI/StackHCIVm.Autorest/create-model-cmdlets.ps1 new file mode 100644 index 000000000000..d10a558a12de --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/create-model-cmdlets.ps1 @@ -0,0 +1,183 @@ +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +function CreateModelCmdlet { + + param([string[]]$Models) + + if ($Models.Count -eq 0) + { + return + } + + $ModelCsPath = Join-Path (Join-Path $PSScriptRoot 'generated\api') 'Models' + $OutputDir = Join-Path $PSScriptRoot 'custom\autogen-model-cmdlets' + $null = New-Item -ItemType Directory -Force -Path $OutputDir + if ('Az.StackHCI'.length -gt 0) { + $ModuleName = 'Az.StackHCI' + } else { + $ModuleName = 'Az.StackHCIVm' + } + + $CsFiles = Get-ChildItem -Path $ModelCsPath -Recurse -Filter *.cs + $Content = '' + $null = $CsFiles | ForEach-Object -Process { if ($_.Name.Split('.').count -eq 2 ) + { $Content += get-content $_.fullname -raw + } } + + $Tree = [Microsoft.CodeAnalysis.CSharp.SyntaxFactory]::ParseCompilationUnit($Content) + $Nodes = $Tree.ChildNodes().ChildNodes() + foreach ($Model in $Models) + { + $InterfaceNode = $Nodes | Where-Object { ($_.Keyword.value -eq 'interface') -and ($_.Identifier.value -eq "I$Model") } + if ($InterfaceNode.count -eq 0) { + continue + } + # through a queue, we iterate all the parent models. + $Queue = @($InterfaceNode) + $visited = @("I$Model") + $AllInterfaceNodes = @() + while ($Queue.count -ne 0) + { + $AllInterfaceNodes += $Queue[0] + # Baselist contains the direct parent models. + foreach ($parent in $Queue[0].BaseList.Types) + { + if (($parent.Type.Right.Identifier.Value -ne 'IJsonSerializable') -and (-not $visited.Contains($parent.Type.Right.Identifier.Value))) + { + $Queue = [Array]$Queue + ($Nodes | Where-Object { ($_.Keyword.value -eq 'interface') -and ($_.Identifier.value -eq $parent.Type.Right.Identifier.Value) }) + $visited = [Array]$visited + $parent.Type.Right.Identifier.Value + } + } + $first, $Queue = $Queue + } + + $Namespace = $InterfaceNode.Parent.Name + $ObjectType = $Model + $ObjectTypeWithNamespace = "${Namespace}.${ObjectType}" + # remove duplicated module name + if ($ObjectType.StartsWith('StackHCIVm')) { + $ModulePrefix = '' + } else { + $ModulePrefix = 'StackHCIVm' + } + $OutputPath = Join-Path -ChildPath "New-Az${ModulePrefix}${ObjectType}Object.ps1" -Path $OutputDir + + $ParameterDefineScriptList = New-Object System.Collections.Generic.List[string] + $ParameterAssignScriptList = New-Object System.Collections.Generic.List[string] + foreach ($Node in $AllInterfaceNodes) + { + foreach ($Member in $Node.Members) + { + $Arguments = $Member.AttributeLists.Attributes.ArgumentList.Arguments + $Required = $false + $Description = "" + $Readonly = $False + foreach ($Argument in $Arguments) + { + if ($Argument.NameEquals.Name.Identifier.Value -eq "Required") + { + $Required = $Argument.Expression.Token.Value + } + if ($Argument.NameEquals.Name.Identifier.Value -eq "Description") + { + $Description = $Argument.Expression.Token.Value.Trim('.').replace('"', '`"') + } + if ($Argument.NameEquals.Name.Identifier.Value -eq "Readonly") + { + $Readonly = $Argument.Expression.Token.Value + } + } + if ($Readonly) + { + continue + } + $Identifier = $Member.Identifier.Value + $Type = $Member.Type.ToString().replace('?', '').Split("::")[-1] + $ParameterDefinePropertyList = New-Object System.Collections.Generic.List[string] + if ($Required) + { + $ParameterDefinePropertyList.Add("Mandatory") + } + if ($Description -ne "") + { + $ParameterDefinePropertyList.Add("HelpMessage=`"${Description}.`"") + } + $ParameterDefineProperty = [System.String]::Join(", ", $ParameterDefinePropertyList) + # check whether completer is needed + $completer = ''; + if($Type.Split('.').Split('.')[-2] -eq 'Support') { + # If Type is an array, need to strip [] + $strippedType = $Type.Replace('[]', '') + $completer += "`n [ArgumentCompleter([${strippedType}])]" + } + $ParameterDefineScript = " + [Parameter($ParameterDefineProperty)]${completer} + [${Type}] + `$${Identifier}" + $ParameterDefineScriptList.Add($ParameterDefineScript) + $ParameterAssignScriptList.Add(" + if (`$PSBoundParameters.ContainsKey('${Identifier}')) { + `$Object.${Identifier} = `$${Identifier} + }") + } + } + $ParameterDefineScript = $ParameterDefineScriptList | Join-String -Separator "," + $ParameterAssignScript = $ParameterAssignScriptList | Join-String -Separator "" + + $Script = " +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for ${ObjectType}. +.Description +Create an in-memory object for ${ObjectType}. + +.Outputs +${ObjectTypeWithNamespace} +.Link +https://learn.microsoft.com/powershell/module/${ModuleName}/new-Az${ModulePrefix}${ObjectType}Object +#> +function New-Az${ModulePrefix}${ObjectType}Object { + [OutputType('${ObjectTypeWithNamespace}')] + [CmdletBinding(PositionalBinding=`$false)] + Param( +${ParameterDefineScript} + ) + + process { + `$Object = [${ObjectTypeWithNamespace}]::New() +${ParameterAssignScript} + return `$Object + } +} +" + Set-Content -Path $OutputPath -Value $Script + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Add-AzStackHCIVMVirtualMachineDataDisk.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Add-AzStackHCIVMVirtualMachineDataDisk.ps1 new file mode 100644 index 000000000000..46c694499418 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Add-AzStackHCIVMVirtualMachineDataDisk.ps1 @@ -0,0 +1,142 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to add a data disk to a virtual machine. +.Description +The operation to add a data disk to a virtual machine. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstances + +.Notes +COMPLEX PARAMETER PROPERTIES + +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/add-azstackhcivmvirtualmachinedatadisk +#> + +function Add-AzStackHCIVmVirtualMachineDataDisk { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] + [CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] + param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the VM + ${ResourceId}, + + [Parameter(ParameterSetName='ByName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId')] + [Parameter(ParameterSetName='ByName')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # List of data disks to be attached to the virtual machine passed in Id format + ${DataDiskId}, + + [Parameter(ParameterSetName='ByResourceId')] + [Parameter(ParameterSetName='ByName')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # List of data disks to be attached to the virtual machine passed by Name + ${DataDiskName}, + + [Parameter(ParameterSetName='ByResourceId')] + [Parameter(ParameterSetName='ByName')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource Group of the Data Disks + ${DataDiskResourceGroup} + ) + + if (($ResourceId -match $vmRegex) -or ($Name -and $ResourceGroupName -and $SubscriptionId)){ + if ($ResourceId -match $vmRegex){ + $SubscriptionId = $($Matches['subscriptionId']) + $ResourceGroupName = $($Matches['resourceGroupName']) + $Name = $($Matches['machineName']) + } + $null = $PSBoundParameters.Remove("Name") + $null = $PSBoundParameters.Remove("ResourceGroupName") + $null = $PSBoundParameters.Remove("SubscriptionId") + $null = $PSBoundParameters.Remove("ResourceId") + $resourceUri = "/subscriptions/" + $subscriptionId + "/resourceGroups/" + $ResourceGroupName + "/providers/Microsoft.HybridCompute/machines/" + $Name + $PSBoundParameters.Add("ResourceUri", $resourceUri) + } 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" + } + $StorageProfileDataDisk = [System.Collections.ArrayList]::new() + + if($DataDiskId){ + foreach ($DiskId in $DataDiskId){ + if ($DiskId -notmatch $vhdRegex){ + Write-Error "Invalid Data Disk Id provided: $DiskId." -ErrorAction Stop + } + $DataDisk = @{Id = $DiskId} + [void]$StorageProfileDataDisk.Add($DataDisk) + } + + $null = $PSBoundParameters.Remove("DataDiskId") + + } elseif ($DataDiskName){ + $rg = $ResourceGroupName + if($DataDiskResourceGroup){ + $rg = $DataDiskResourceGroup + } + + foreach ($DiskName in $DataDiskName){ + $DataDiskIdNew = "/subscriptions/$SubscriptionId/resourceGroups/$rg/providers/Microsoft.AzureStackHCI/virtualharddisks/$DiskName" + $DataDisk = @{Id = $DataDiskIdNew} + [void]$StorageProfileDataDisk.Add($DataDisk) + } + + $null = $PSBoundParameters.Remove("DataDiskName") + $null = $PSBoundParameters.Remove("DataDiskResourceGroup") + } + + $vm = Az.StackHCIVm.internal\Get-AzStackHCIVmVirtualMachine @PSBoundParameters + $disks = $vm.StorageProfileDataDisk + + foreach ($disk in $disks){ + $DataDisk = @{Id = $disk.Id} + [void]$StorageProfileDataDisk.Add($DataDisk) + } + + $PSBoundParameters.Add('StorageProfileDataDisk', $StorageProfileDataDisk) + return Az.StackHCIVm.internal\Update-AzStackHCIVmVirtualMachine @PSBoundParameters + } \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Add-AzStackHCIVMVirtualMachineNetworkInterface.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Add-AzStackHCIVMVirtualMachineNetworkInterface.ps1 new file mode 100644 index 000000000000..87687eddcb49 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Add-AzStackHCIVMVirtualMachineNetworkInterface.ps1 @@ -0,0 +1,126 @@ +<# +.Synopsis +The operation to add a network interface to a virtual machine. + +.Description +The operation to add a network interface to a virtual machine. + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/add-azstackhcivmvirtualmachinenetworkinterface +#> + +function Add-AzStackHCIVmVirtualMachineNetworkInterface { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHciVM.Models.Api20230901Preview.IVirtualMachineInstance])] + [CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] + param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Id of the Virtual Machine + ${ResourceId}, + + [Parameter(ParameterSetName='ByName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId')] + [Parameter(ParameterSetName='ByName')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # NetworkInterfaces - list of network interfaces to be attached to the virtual machine in id format + ${NicId}, + + [Parameter(ParameterSetName='ByResourceId')] + [Parameter(ParameterSetName='ByName')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # NetworkInterfaces - list of network interfaces to be attached to the virtual machine in name format + ${NicName}, + + [Parameter(ParameterSetName='ByResourceId')] + [Parameter(ParameterSetName='ByName')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource Group of the Network Interfaces + ${NicResourceGroup} + ) + + if (($ResourceId -match $vmRegex) -or ($Name -and $ResourceGroupName -and $SubscriptionId)){ + if ($ResourceId -match $vmRegex){ + $SubscriptionId = $($Matches['subscriptionId']) + $ResourceGroupName = $($Matches['resourceGroupName']) + $Name = $($Matches['machineName']) + } + $null = $PSBoundParameters.Remove("Name") + $null = $PSBoundParameters.Remove("ResourceGroupName") + $null = $PSBoundParameters.Remove("SubscriptionId") + $null = $PSBoundParameters.Remove("ResourceId") + $resourceUri = "/subscriptions/" + $subscriptionId + "/resourceGroups/" + $ResourceGroupName + "/providers/Microsoft.HybridCompute/machines/" + $Name + $PSBoundParameters.Add("ResourceUri", $resourceUri) + } 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" + } + + $NetworkProfileNetworkInterface = [System.Collections.ArrayList]::new() + if ($NicId){ + foreach ($NId in $NicId){ + if ($NId -notmatch $nicRegex){ + Write-Error "Invalid Nic Id provided: $NId." -ErrorAction Stop + } + $Nic = @{Id = $NId} + [void]$NetworkProfileNetworkInterface.Add($Nic) + } + + $null = $PSBoundParameters.Remove("NicId") + + } elseif ($NicName){ + $rg = $ResourceGroupName + if($NicResourceGroup){ + $rg = $NicResourceGroup + } + + foreach ($NName in $NicName){ + $NicIdNew = "/subscriptions/$SubscriptionId/resourceGroups/$rg/providers/Microsoft.AzureStackHCI/networkinterfaces/$NName" + $Nic = @{Id = $NicIdNew} + [void]$NetworkProfileNetworkInterface.Add($Nic) + } + + $null = $PSBoundParameters.Remove("NicName") + $null = $PSBoundParameters.Remove("NicResourceGroup") + + } + + $vm = Az.StackHCIVm.internal\Get-AzStackHCIVmVirtualMachine @PSBoundParameters + $nics = $vm.NetworkProfileNetworkInterface + + foreach ($nic in $nics){ + $Nic= @{Id = $nic.Id} + [void]$NetworkProfileNetworkInterface.Add($Nic) + } + + $PSBoundParameters.Add('NetworkProfileNetworkInterface', $NetworkProfileNetworkInterface) + return Az.StackHCIVm.internal\Update-AzStackHCIVmVirtualMachine @PSBoundParameters + } \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Az.StackHCIVm.custom.psm1 b/src/StackHCI/StackHCIVm.Autorest/custom/Az.StackHCIVm.custom.psm1 new file mode 100644 index 000000000000..cde4058e8f23 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Az.StackHCIVm.custom.psm1 @@ -0,0 +1,17 @@ +# region Generated + # Load the private module dll + $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.StackHCIVm.private.dll') + + # Load the internal module + $internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.StackHCIVm.internal.psm1' + if(Test-Path $internalModulePath) { + $null = Import-Module -Name $internalModulePath + } + + # Export nothing to clear implicit exports + Export-ModuleMember + + # Export script cmdlets + Get-ChildItem -Path $PSScriptRoot -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } + Export-ModuleMember -Function (Get-ScriptCmdlet -ScriptFolder $PSScriptRoot) -Alias (Get-ScriptCmdlet -ScriptFolder $PSScriptRoot -AsAlias) +# endregion diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Get-AzStackHCIVMNetworkInterface_ByResourceId.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Get-AzStackHCIVMNetworkInterface_ByResourceId.ps1 new file mode 100644 index 000000000000..f6921df42b6c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Get-AzStackHCIVMNetworkInterface_ByResourceId.ps1 @@ -0,0 +1,115 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets a network interface +.Description +Gets a network interface + + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmnetworkinterface +#> +function Get-AzStackHCIVmNetworkInterface_ByResourceId { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces])] +[CmdletBinding( PositionalBinding=$false)] +param( + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Id of the network interface. + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + + +) + process { + + if ($ResourceId -match $nicRegex){ + + $subscriptionId = $($Matches['subscriptionId']) + $resourceGroupName = $($Matches['resourceGroupName']) + $resourceName = $($Matches['nicName']) + $null = $PSBoundParameters.Remove("ResourceId") + $PSBoundParameters.Add("Name", $resourceName) + $PSBoundParameters.Add("ResourceGroupName", $resourceGroupName) + $null = $PSBoundParameters.Remove("SubscriptionId") + $PSBoundParameters.Add("SubscriptionId", $subscriptionId) + + return Az.StackHCIVm\Get-AzStackHCIVmNetworkInterface @PSBoundParameters + + } else { + Write-Error "Resource ID is invalid: $ResourceId" + } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Get-AzStackHCIVMStoragePath_ByResourceId.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Get-AzStackHCIVMStoragePath_ByResourceId.ps1 new file mode 100644 index 000000000000..8f22d9802142 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Get-AzStackHCIVMStoragePath_ByResourceId.ps1 @@ -0,0 +1,115 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets a storage path blah +.Description +Gets a storage path blah + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers + +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmstoragepath +#> +function Get-AzStackHCIVmStoragePath_ByResourceId { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers])] +[CmdletBinding(PositionalBinding=$false)] + +param( + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM ID of the storage path. + ${ResourceId}, + + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + + +) + process { + + if ($ResourceId -match $storagePathRegex){ + + $subscriptionId = $($Matches['subscriptionId']) + $resourceGroupName = $($Matches['resourceGroupName']) + $resourceName = $($Matches['storagePathName']) + $null = $PSBoundParameters.Remove("ResourceId") + $PSBoundParameters.Add("Name", $resourceName) + $PSBoundParameters.Add("ResourceGroupName", $resourceGroupName) + $null = $PSBoundParameters.Remove("SubscriptionId") + $PSBoundParameters.Add("SubscriptionId", $subscriptionId) + + return Az.StackHCIVm\Get-AzStackHCIVmStoragePath @PSBoundParameters + + } else { + Write-Error "Resource ID is invalid: $ResourceId" + } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Get-AzStackHCIVMVirtualHardDisk_ByResourceId.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Get-AzStackHCIVMVirtualHardDisk_ByResourceId.ps1 new file mode 100644 index 000000000000..a4299e5249b0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Get-AzStackHCIVMVirtualHardDisk_ByResourceId.ps1 @@ -0,0 +1,113 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets a virtual hard disk +.Description +Gets a virtual hard disk + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmvirtualharddisk +#> +function Get-AzStackHCIVmVirtualHardDisk_ByResourceId { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks])] +[CmdletBinding( PositionalBinding=$false)] + +param( + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM ID of the virtual hard disk. + ${ResourceId}, + + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + + +) + process { + + if ($ResourceId -match $vhdRegex){ + + $subscriptionId = $($Matches['subscriptionId']) + $resourceGroupName = $($Matches['resourceGroupName']) + $resourceName = $($Matches['vhdName']) + $null = $PSBoundParameters.Remove("ResourceId") + $PSBoundParameters.Add("Name", $resourceName) + $PSBoundParameters.Add("ResourceGroupName", $resourceGroupName) + $null = $PSBoundParameters.Remove("SubscriptionId") + $PSBoundParameters.Add("SubscriptionId", $subscriptionId) + + return Az.StackHCIVm\Get-AzStackHCIVmVirtualHardDisk @PSBoundParameters + + } else { + Write-Error "Resource ID is invalid: $ResourceId" + } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Get-AzStackHCIVMVirtualMachine.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Get-AzStackHCIVMVirtualMachine.ps1 new file mode 100644 index 000000000000..fe1e22515910 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Get-AzStackHCIVMVirtualMachine.ps1 @@ -0,0 +1,158 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets a virtual machine +.Description +Gets a virtual machine + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmvirtualmachine +#> +function Get-AzStackHCIVmVirtualMachine { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.Machine],ParameterSetName='ByResourceGroup' )] + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance],ParameterSetName='ByName' )] + [CmdletBinding( PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] + param( + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Parameter(ParameterSetName='ByResourceGroup', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceGroup')] + [Parameter(ParameterSetName='BySubscription')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM ID of the virtual machine. + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + + ) + process { + if ($PSCmdlet.ParameterSetName -eq "ByName" -or $PSCmdlet.ParameterSetName -eq "ByResourceId"){ + if (($ResourceId -match $vmRegex) -or ($Name -and $ResourceGroupName -and $SubscriptionId)){ + if ($ResourceId -match $vmRegex){ + $SubscriptionId = $($Matches['subscriptionId']) + $ResourceGroupName = $($Matches['resourceGroupName']) + $Name = $($Matches['machineName']) + } + $resourceUri = "/subscriptions/" + $subscriptionId + "/resourceGroups/" + $ResourceGroupName + "/providers/Microsoft.HybridCompute/machines/" + $Name + $PSBoundParameters.Add("ResourceUri", $resourceUri) + $null = $PSBoundParameters.Remove("SubscriptionId") + $null = $PSBoundParameters.Remove("ResourceGroupName") + $null = $PSBoundParameters.Remove("ResourceId") + $null = $PSBoundParameters.Remove("Name") + return Az.StackHCIVm.internal\Get-AzStackHCIVmVirtualMachine @PSBoundParameters + } 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" + } + } elseif ($PSCmdlet.ParameterSetName -eq "ByResourceGroup") { + $allHCIMachines = [System.Collections.ArrayList]::new() + $machines = Az.StackHCIVm.internal\Get-AzStackHCIVmMachine -ResourceGroupName $ResourceGroupName + foreach ($machine in $machines){ + if ($machine.Kind.ToString() -eq "HCI"){ + [void]$allHCIMachines.Add($machine) + } + } + return $allHCIMachines + + } else { + $allHCIMachines = [System.Collections.ArrayList]::new() + $machines = Az.StackHCIVm.internal\Get-AzStackHCIVmMachine -SubscriptionId $SubscriptionId + foreach ($machine in $machines){ + if ($machine.Kind.ToString() -eq "HCI"){ + [void]$allHCIMachines.Add($machine) + } + } + return $allHCIMachines + + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Get-AzStackHCIVmImage.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Get-AzStackHCIVmImage.ps1 new file mode 100644 index 000000000000..9f1f99fa083f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Get-AzStackHCIVmImage.ps1 @@ -0,0 +1,194 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets a gallery image +.Description +Gets a gallery image + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages + +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmimage +#> + +function Get-AzStackHCIVmImage{ + [CmdletBinding(DefaultParameterSetName='BySubscription', PositionalBinding=$false)] + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages])] + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages])] + param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the image + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Parameter(ParameterSetName='ByResourceGroup', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceGroup')] + [Parameter(ParameterSetName='ByResourceId')] + [Parameter(ParameterSetName='BySubscription')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource Id of the Image + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + + process { + + if ($PSCmdlet.ParameterSetName -eq "ByName"){ + $isGalleryImage = $false + $isMarketplaceGalleryImage = $false + + + $galImage = Az.StackHCIVm.internal\Get-AzStackHCIVmGalleryImage @PSBoundParameters -ErrorAction SilentlyContinue + if ($galImage -ne $null){ + $isGalleryImage = $true + } else { + $marketplaceGalImage = Az.StackHCIVm.internal\Get-AzStackHCIVmMarketplaceGalleryImage @PSBoundParameters -ErrorAction SilentlyContinue + if ($marketplaceGalImage -ne $null){ + $isMarketplaceGalleryImage = $true + } + } + + if ($isGalleryImage){ + return $galImage + } + + if ($isMarketplaceGalleryImage){ + return $marketplaceGalImage + } + + Write-Error "An Image with name: $Name does not exist in Resource Group: $ResourceGroupName" -ErrorAction Stop + + } elseif ($PSCmdlet.ParameterSetName -eq "ByResourceId"){ + + if ($ResourceId -match $galImageRegex){ + + $subscriptionId = $($Matches['subscriptionId']) + $resourceGroupName = $($Matches['resourceGroupName']) + $resourceName = $($Matches['imageName']) + $null = $PSBoundParameters.Remove("ResourceId") + $PSBoundParameters.Add("Name", $resourceName) + $PSBoundParameters.Add("ResourceGroupName", $resourceGroupName) + $null = $PSBoundParameters.Remove("SubscriptionId") + $PSBoundParameters.Add("SubscriptionId", $subscriptionId) + + return Az.StackHCIVm.internal\Get-AzStackHCIVmGalleryImage @PSBoundParameters + } elseif ($ResourceId -match $marketplaceGalImageRegex){ + $subscriptionId = $($Matches['subscriptionId']) + $resourceGroupName = $($Matches['resourceGroupName']) + $resourceName = $($Matches['imageName']) + $null = $PSBoundParameters.Remove("ResourceId") + $PSBoundParameters.Add("Name", $resourceName) + $PSBoundParameters.Add("ResourceGroupName", $resourceGroupName) + $null = $PSBoundParameters.Remove("SubscriptionId") + $PSBoundParameters.Add("SubscriptionId", $subscriptionId) + + return Az.StackHCIVm.internal\Get-AzStackHCIVmMarketplaceGalleryImage @PSBoundParameters + } else { + Write-Error "Resource ID is invalid: $ResourceId" + } + + } elseif ($PSCmdlet.ParameterSetName -eq "ByResourceGroup"){ + $allImages = @() + $galImages = Az.StackHCIVm.internal\Get-AzStackHCIVmGalleryImage @PSBoundParameters + $marketplaceGalImages = Az.StackHCIVm.internal\Get-AzStackHCIVmMarketplaceGalleryImage @PSBoundParameters + $allImages = $allImages + $galImages + $allImages = $allImages + $marketplaceGalImages + return $allImages + } + + $allImages = @() + $galImages = Az.StackHCIVm.internal\Get-AzStackHCIVmGalleryImage @PSBoundParameters + $marketplaceGalImages = Az.StackHCIVm.internal\Get-AzStackHCIVmMarketplaceGalleryImage @PSBoundParameters + $allImages = $allImages + $galImages + $allImages = $allImages + $marketplaceGalImages + return $allImages + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Get-AzStackHCIVmLogicalNetwork_ByResourceId2.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Get-AzStackHCIVmLogicalNetwork_ByResourceId2.ps1 new file mode 100644 index 000000000000..6bac5804f7fe --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Get-AzStackHCIVmLogicalNetwork_ByResourceId2.ps1 @@ -0,0 +1,114 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets a logical network +.Description +Gets a logical network + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmlogicalnetwork +#> +function Get-AzStackHCIVmLogicalNetwork_ByResourceId { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHciVM.Models.Api20230901Preview.ILogicalNetworks])] + [CmdletBinding(PositionalBinding=$false)] + + param( + [Microsoft.Azure.PowerShell.Cmdlets.StackHciVM.Category('Path')] + [System.String] + # The ARM ID of the logical network. + ${ResourceId}, + + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + + ) + process { + + if ($ResourceId -match $lnetRegex){ + + $subscriptionId = $($Matches['subscriptionId']) + $resourceGroupName = $($Matches['resourceGroupName']) + $resourceName = $($Matches['logicalNetworkName']) + $null = $PSBoundParameters.Remove("ResourceId") + $PSBoundParameters.Add("Name", $resourceName) + $PSBoundParameters.Add("ResourceGroupName", $resourceGroupName) + $null = $PSBoundParameters.Remove("SubscriptionId") + $PSBoundParameters.Add("SubscriptionId", $subscriptionId) + + return Az.StackHCIVm\Get-AzStackHCIVmLogicalNetwork @PSBoundParameters + + } else { + Write-Error "Resource ID is invalid: $ResourceId" + } + + } + } \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/New-AzStackHCIVMImage.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/New-AzStackHCIVMImage.ps1 new file mode 100644 index 000000000000..51d99679f0d3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/New-AzStackHCIVMImage.ps1 @@ -0,0 +1,337 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create an image. +Please note some properties can be set only during image creation. +.Description +The operation to create an image. +Please note some properties can be set only during image creation. +.Example +PS C:\> {{ Add code here }} + +{{ Add output here }} +.Example +PS C:\> {{ Add code here }} + +{{ Add output here }} + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages +.Notes +COMPLEX PARAMETER PROPERTIES + +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmimage +#> +function New-AzStackHCIVmImage{ + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages],ParameterSetName='Marketplace' )] + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages],ParameterSetName='MarketplaceURN' )] + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages],ParameterSetName='GalleryImage' )] + [CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] + param( + + [Parameter(ParameterSetName='Marketplace', Mandatory)] + [Parameter(ParameterSetName='GalleryImage', Mandatory)] + [Parameter(ParameterSetName='MarketplaceURN',Mandatory)] + [Alias('ImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the Image + #The name must start and end with an alphanumeric character and must contain all alphanumeric characters or ‘-‘, ‘.’, or ‘_’. The max length can be 80 characters and the minimum length is 1 character. + ${Name}, + + [Parameter(ParameterSetName='Marketplace', Mandatory)] + [Parameter(ParameterSetName='GalleryImage', Mandatory)] + [Parameter(ParameterSetName='MarketplaceURN', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Marketplace')] + [Parameter(ParameterSetName='GalleryImage')] + [Parameter(ParameterSetName='MarketplaceURN')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Marketplace', Mandatory)] + [Parameter(ParameterSetName='GalleryImage', Mandatory)] + [Parameter(ParameterSetName='MarketplaceURN', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter(ParameterSetName='Marketplace')] + [Parameter(ParameterSetName='GalleryImage')] + [Parameter(ParameterSetName='MarketplaceURN')] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource] + # Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + ${CloudInitDataSource}, + + + [Parameter(ParameterSetName='Marketplace', Mandatory)] + [Parameter(ParameterSetName='GalleryImage', Mandatory)] + [Parameter(ParameterSetName='MarketplaceURN', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The ARM Id of the extended location to create image resource in. + ${CustomLocationId}, + + [Parameter(ParameterSetName='GalleryImage', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Local path of image that the image should be created from. + # This parameter is required for non marketplace images. + ${ImagePath}, + + [Parameter(ParameterSetName='GalleryImage', Mandatory)] + [Parameter(ParameterSetName='Marketplace', Mandatory)] + [Parameter(ParameterSetName='MarketplaceURN', Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes] + # Operating system type that the gallery image uses [Windows, Linux] + ${OSType}, + + [Parameter(ParameterSetName='Marketplace', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the marketplae gallery image definition offer. + ${Offer}, + + [Parameter(ParameterSetName='Marketplace', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the marketplace gallery image definition publisher. + ${Publisher}, + + [Parameter(ParameterSetName='Marketplace', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the marketplace gallery image definition SKU. + ${Sku}, + + [Parameter(ParameterSetName='Marketplace')] + [Parameter(ParameterSetName='GalleryImage')] + [Parameter(ParameterSetName='MarketplaceURN')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage Container Name of the storage container to be used for gallery image + ${StoragePathName}, + + [Parameter(ParameterSetName='Marketplace')] + [Parameter(ParameterSetName='GalleryImage')] + [Parameter(ParameterSetName='MarketplaceURN')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource Group of the Storage Path. The Default value is the Resource Group of the Image. + ${StoragePathResourceGroup}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage ContainerID of the storage container to be used for gallery image + ${StoragePathId}, + + [Parameter(ParameterSetName='GalleryImage')] + [Parameter(ParameterSetName='Marketplace')] + [Parameter(ParameterSetName='MarketplaceURN')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter(ParameterSetName='MarketplaceURN', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The URN of the marketplace gallery image. + ${URN}, + + [Parameter(ParameterSetName='Marketplace', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The version of the marketplace gallery image. + ${Version}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + + ) + + if (-Not ($name -match $imageNameRegex )) { + Write-Error "Invalid Name for image provided: $name" -ErrorAction Stop + } + + if ($CustomLocationId -notmatch $customLocationRegex){ + Write-Error "Invalid CustomLocationId: $CustomLocationId" -ErrorAction Stop + } + if ($OSType){ + if ($OSType.ToString().ToLower() -eq "windows"){ + $PSBoundParameters['OSType'] = 'Windows' + + } + elseif ($OSType.ToString().ToLower() -eq "linux"){ + $PSBoundParameters['OSType'] = 'Linux' + } + else { + Write-Error "Invalid OSType provided: $OSType. Expected values are 'Windows' or 'Linux'." -ErrorAction Stop + } + } + + #cloudinitdatassouce + if ($CloudInitDataSource){ + if ($CloudInitDataSource.ToString().ToLower() -eq "nocloud"){ + $PSBoundParameters['CloudInitDataSource'] = 'NoCloud' + + } + elseif ($CloudInitDataSource.ToString().ToLower() -eq "azure"){ + $PSBoundParameters['CloudInitDataSource'] = 'Azure' + } + else { + Write-Error "Invalid CloudInitDataSource provided: $CloudInitDataSource. Expected values are 'NoCloud' or 'Azure'." -ErrorAction Stop + } + + } + + if ($HyperVGeneration){ + if ($HyperVGeneration.ToString().ToLower() -eq "v1"){ + $PSBoundParameters['HyperVGeneration'] = 'V1' + + } + elseif ($HyperVGeneration.ToString().ToLower() -eq "v2"){ + $PSBoundParameters['HyperVGeneration'] = 'V2' + } + else { + Write-Error "Invalid HyperVGeneration provided: $HyperVGeneration. Expected values are 'V1' or 'V2'." -ErrorAction Stop + } + + } + + if ($StoragePathName){ + if ($StoragePathResourceGroup){ + $StoragePathId = "/subscriptions/$SubscriptionId/resourceGroups/$StoragePathResourceGroup/providers/Microsoft.AzureStackHCI/storagecontainers/$StoragePathName" + } else { + $StoragePathId = "/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.AzureStackHCI/storagecontainers/$StoragePathName" + } + + $PSBoundParameters.Add('StoragePathId', $StoragePathId) + $null = $PSBoundParameters.Remove("StoragePathName") + $null = $PSBoundParameters.Remove("StoragePathResourceGroup") + } + + + if ($PSCmdlet.ParameterSetName -eq "Marketplace") + { + return Az.StackHCIVm.internal\New-AzStackHCIVmMarketplaceGalleryImage @PSBoundParameters + + } elseif ($PSCmdlet.ParameterSetName -eq "MarketplaceURN") { + if ($URN -match $urnRegex){ + $publisher = $Matches.publisher.ToLower() + $offer = $Matches.offer.ToLower() + $sku = $Matches.sku.ToLower() + $version = $Matches.version.ToLower() + + $null = $PSBoundParameters.Remove("URN") + $PSBoundParameters.Add('Publisher', $publisher) + $PSBoundParameters.Add('Offer', $offer) + $PSBoundParameters.Add('Sku', $sku) + $PSBoundParameters.Add('Version', $version) + } else { + Write-Error "Invalid URN provided: $URN. Valid URN format is Publisher:Offer:Sku:Version ." -ErrorAction Stop + } + + return Az.StackHCIVm.internal\New-AzStackHCIVmMarketplaceGalleryImage @PSBoundParameters + + } + + if ($PSCmdlet.ParameterSetName -eq "GalleryImage") + { + + return Az.StackHCIVm.internal\New-AzStackHCIVmGalleryImage @PSBoundParameters + } + + + +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/New-AzStackHCIVMLogicalNetwork_New.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/New-AzStackHCIVMLogicalNetwork_New.ps1 new file mode 100644 index 000000000000..ba641646d458 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/New-AzStackHCIVMLogicalNetwork_New.ps1 @@ -0,0 +1,346 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a logical network. +Please note some properties can be set only during logical network creation. +.Description +The operation to create or update a logical network. +Please note some properties can be set only during logical network creation. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +SUBNET : Subnet - list of subnets under the logical network + [AddressPrefix ]: The address prefix for the subnet: Cidr for this subnet - IPv4, IPv6. + [IPAllocationMethod ]: IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic' + [IPConfigurationReference ]: IPConfigurationReferences - list of IPConfigurationReferences + [Id ]: IPConfigurationID + [IPPool ]: network associated pool of IP Addresses + [End ]: End of the IP address pool + [Name ]: Name of the IP-Pool + [Start ]: Start of the IP address pool + [Type ]: Type of the IP Pool [vm, vippool] + [Name ]: Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + [PropertiesAddressPrefixes ]: List of address prefixes for the subnet. + [Route ]: Collection of routes contained within a route table. + [AddressPrefix ]: The destination CIDR to which the route applies. + [Name ]: Name - name of the subnet + [NextHopIPAddress ]: The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance. + [Vlan ]: Vlan to use for the subnet +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmlogicalnetwork +#> + +function New-AzStackHCIVmLogicalNetwork { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks])] + [CmdletBinding( PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] + param( + [Parameter(Mandatory)] + [Alias('LogicalNetworkName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual network + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # The list of DNS servers IP addresses. + ${DnsServer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Name of the network switch to be used for VMs + ${VMSwitchName}, + + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # List of address prefixes for the subnet. + $AddressPrefix, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The IP address allocation method. Possible values include: 'Static', 'Dynamic' + $IpAllocationMethod, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # End of the ip address pool + $IpPoolEnd, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Start of the ip address pool + $IpPoolStart, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPPoolTypeEnum])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Ip pool type + $IpPoolType, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Collections.Hashtable[]] + # Network associated pool of IP Addresses + $IpPool, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Collections.Hashtable[]] + # Collection of routes contained within a route table. + $Route, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Name of the subnet + $SubnetName, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Collections.Hashtable[]] + # List of subnets under the virtual network + $Subnet, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # Vlan to use for the subnet + $Vlan , + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + + ) + + if ($Name -notmatch $vnetNameRegex){ + Write-Error "Invalid Name: $Name. The name must start with an alphanumeric character, contain all alphanumeric characters or '-' or '_' or '.' and end with an alphanumeric character or '_'. The max length is 64 characters." -ErrorAction Stop + } + + if ($CustomLocationId -notmatch $customLocationRegex){ + Write-Error "Invalid CustomLocationId: $CustomLocationId" -ErrorAction Stop + } + + if ($DnsServer){ + foreach ($DnsServ in $DnsServer){ + if ($DnsServ -notmatch $ipv4Regex){ + Write-Error "Invalid ipaddress provided for Dns Servers : $DnsServ." -ErrorAction Stop + } + } + } + + if ($Subnet){ + Confirm-Subnets -Subnets $Subnet + + } else{ + $SubnetNew = @{} + if ($IpAllocationMethod){ + if ($IpAllocationMethod.ToLower() -ne "dynamic" -and $IpAllocationMethod.ToLower() -ne "static"){ + Write-Error "Invalid Ip Allocation method provided: $IpAllocationMethod. Accepted values are 'dynamic' or 'static'" -ErrorAction Stop + } + $IpAllocationMethod = $IpAllocationMethod.ToLower() + + if ($IpAllocationMethod -eq "static"){ + $SubnetNew["IPAllocationMethod"] = 'Static' + if (-Not $AddressPrefix){ + Write-Error "Invalid Configuration for Static IpAllocationMethod. AddressPrefix are required for Static IpAllocationMethod." -ErrorAction Stop + } + } + } else { + $SubnetNew["IPAllocationMethod"] = 'Dynamic' + } + + if ($IpPoolStart -and $IpPoolEnd){ + if($IpPoolStart -notmatch $ipv4Regex){ + Write-Error "Invalid Ip Address provided : $IpPoolStart" -ErrorAction Stop + } + + if($IpPoolEnd -notmatch $ipv4Regex){ + Write-Error "Invalid Ip Address provided : $IpPoolEnd" -ErrorAction Stop + } + $IpPoolNew = @{End = $IpPoolEnd; Start = $IpPoolStart} + if ($IpPoolType){ + $IpPoolType = $IpPoolType.ToLower() + if ($IpPoolType -ne "vm" -and $IpPoolType -ne "vippool"){ + Write-Error "Invalid IpPoolType provided: $IpPoolType. Accepted values are 'vm' and 'vippool'." -ErrorAction Stop + } + $IpPoolNew['Type'] = $IpPoolType + } + $SubnetNew["IPPool"] = @($IpPoolNew) + } elseif ($IpPoolStart -or $IpPoolEnd){ + Write-Error "Both IpPoolStart and IpPoolEnd must be specified together." -ErrorAction Stop + } + + if ($IpPool){ + Confirm-IpPools -IpPools $IpPool + $SubnetNew["IPPool"] = $IpPool + } + + if($Vlan){ + if ($Vlan -gt 4094 -or $Vlan -lt 1){ + Write-Error "Invalid value for Vlan : $Vlan. Valid range is 1-4094" -ErrorAction Stop + } + $SubnetNew["Vlan"] = $Vlan + } + + if ($SubnetName){ + if ($SubnetName -notmatch $subnetNameRegex){ + Write-Error "Invalid SubnetName: $SubnetName. The name must start with an alphanumeric character, contain all alphanumeric characters or '-' or '_' or '.' and end with an alphanumeric character or '_'. The max length is 80 characters." -ErrorAction Stop + } + $SubnetNew["Name"] = $SubnetName + } + + if ($AddressPrefix){ + foreach ($addPrefix in $AddressPrefix){ + if ($addPrefix -notmatch $cidrRegex){ + Write-Error "Invalid AddressPrefix: $addPrefix. Please use valid CIDR format." -ErrorAction Stop + } + } + + if ($AddressPrefix.length -eq 1){ + $SubnetNew["AddressPrefix"] = $AddressPrefix[0] + } else { + $SubnetNew["AddressPrefixes"] = $AddressPrefix + } + + } + + if ($Route){ + Confirm-Routes -Routes $Route + $SubnetNew["Route"] = $Route + + } + + $null = $PSBoundParameters.Remove("IpAllocationMethod") + $null = $PSBoundParameters.Remove("IpPoolStart") + $null = $PSBoundParameters.Remove("IpPoolEnd") + $null = $PSBoundParameters.Remove("IpPoolType") + $null = $PSBoundParameters.Remove("AddressPrefix") + $null = $PSBoundParameters.Remove("Vlan") + $null = $PSBoundParameters.Remove("SubnetName") + $null = $PSBoundParameters.Remove("IpPool") + $null = $PSBoundParameters.Remove("Route") + $PSBoundParameters.Add("Subnet", $SubnetNew) + + } + + return Az.StackHCIVm.internal\New-AzStackHCIVmLogicalNetwork @PSBoundParameters + } + \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/New-AzStackHCIVMNetworkInterface_New.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/New-AzStackHCIVMNetworkInterface_New.ps1 new file mode 100644 index 000000000000..3d61249bf5b4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/New-AzStackHCIVMNetworkInterface_New.ps1 @@ -0,0 +1,278 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a network interface. +Please note some properties can be set only during network interface creation. +.Description +The operation to create or update a network interface. +Please note some properties can be set only during network interface creation. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +IPCONFIGURATION : IPConfigurations - A list of IPConfigurations of the network interface. + [IPAddress ]: PrivateIPAddress - Private IP address of the IP configuration. + [Name ]: Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + [SubnetId ]: ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmnetworkinterface +#> +function New-AzStackHCIVmNetworkInterface { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces])] +[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('NetworkInterfaceName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the Network Interface + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # List of DNS server IP Addresses for the interface + ${DnsServer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # PrivateIPAddress - Private IP address of the IP configuration. + ${IpAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # MacAddress - The MAC address of the network interface. + ${MacAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The ARM resource id of the Subnet. + ${SubnetId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the Subnet. + ${SubnetName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource Group of the Subnet. + ${SubnetResourceGroup}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Collections.Hashtable[]] + # A list of IPConfigurations of the network interface. + ${IpConfiguration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + +) + + if ($Name -notmatch $nicNameRegex){ + Write-Error "Invalid Name: $Name. The name must start with an alphanumeric character, contain all alphanumeric characters or '-' or '_' or '.' and end with an alphanumeric character or '_'. The max length is 80 characters." -ErrorAction Stop + } + if ($CustomLocationId -notmatch $customLocationRegex){ + Write-Error "Invalid CustomLocationId: $CustomLocationId" -ErrorAction Stop + } + + $null = $PSBoundParameters.Remove("MacAddress") + $null = $PSBoundParameters.Remove("DnsServer") + $null = $PSBoundParameters.Remove("Tag") + + + if (-Not $IpConfiguration){ + $IpConfig = @{} + if ($SubnetName){ + $rg = $ResourceGroupName + if ($SubnetResourceGroup){ + $rg = $SubnetResourceGroup + } + $SubnetId = "/subscriptions/$SubscriptionId/resourceGroups/$rg/providers/Microsoft.AzureStackHCI/logicalNetworks/$SubnetName" + $null = $PSBoundParameters.Remove("SubnetName") + $null = $PSBoundParameters.Remove("SubnetResourceGroup") + } + + if (-Not $SubnetId){ + Write-Error "No Subnet provided. Either IpConfigurations or SubnetId or SubnetName is required." -ErrorAction Stop + } else { + if ($SubnetId -notmatch $vnetRegex){ + Write-Error "Invalid SubnetId: $SubnetId" -ErrorAction Stop + } + } + + $null = $PSBoundParameters.Remove("Name") + $null = $PSBoundParameters.Remove("ResourceGroupName") + $null = $PSBoundParameters.Remove("SubscriptionId") + $null = $PSBoundParameters.Remove("Location") + $null = $PSBoundParameters.Remove("CustomLocationId") + $null = $PSBoundParameters.Remove("SubnetId") + $null = $PSBoundParameters.Remove("IpAddress") + + $PSBoundParameters.Add("ResourceId", $SubnetId) + $subnet = Az.StackHCIVm\Get-AzStackHCIVmLogicalNetwork @PSBoundParameters + + + if ($subnet -eq $null) { + Write-Error "A Logical Network with id : $SubnetId does not exist." -ErrorAction Stop + } + + $IpConfig["SubnetId"] = $SubnetId + + $null = $PSBoundParameters.Remove("ResourceId") + $PSBoundParameters.Add("Name", $Name) + $PSBoundParameters.Add("ResourceGroupName", $ResourceGroupName) + $PSBoundParameters.Add("SubscriptionId", $SubscriptionId) + $PSBoundParameters.Add("Location", $Location) + $PSBoundParameters.Add("CustomLocationId", $CustomLocationId) + + + + if ($IpAddress){ + if ($IpAddress -notmatch $ipv4Regex){ + Write-Error "Invalid Ip Address provided : $IpAddress" -ErrorAction Stop + } + $IpConfig["IPAddress"] = $IpAddress + } + + + $PSBoundParameters.Add("IPConfiguration", $IpConfig) + + } + + if ($MacAddress){ + if ($MacAddress -notmatch $macAddressRegex){ + Write-Error "Invalid MacAddress: $MacAddress." -ErrorAction Stop + } + $PSBoundParameters.Add("MacAddress", $MacAddress) + } + + if ($DnsServer){ + foreach ($DnsServ in $DnsServer){ + if ($DnsServ -notmatch $ipv4Regex){ + Write-Error "Invalid ipaddress provided for Dns Servers : $DnsServ." -ErrorAction Stop + } + } + $PSBoundParameters.Add("DnsServer", $DnsServer) + } + + if ($Tag){ + $PSBoundParameters.Add("Tag", $Tag) + } + return Az.StackHCIVm.internal\New-AzStackHCIVmNetworkInterface @PSBoundParameters + +} diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/New-AzStackHCIVMStoragePath_New.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/New-AzStackHCIVMStoragePath_New.ps1 new file mode 100644 index 000000000000..996285931ba9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/New-AzStackHCIVMStoragePath_New.ps1 @@ -0,0 +1,151 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a storage container. +Please note some properties can be set only during storage container creation. +.Description +The operation to create or update a storage container. +Please note some properties can be set only during storage container creation. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmstoragepath +#> +function New-AzStackHCIVmStoragePath{ +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers])] +[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('StorageContainerName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the storage container + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Path of the storage container on the disk + ${Path}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + +) + if ($Name -notmatch $storagePathNameRegex){ + Write-Error "Invalid Name: $Name. The Storage Path name must start with an alphanumeric character, contain all alphanumeric characters or '-' or '_' or '.' and end with an alphanumeric character or '_'. The max length is 80 characters." -ErrorAction Stop + } + + if ($CustomLocationId -notmatch $customLocationRegex){ + Write-Error "Invalid CustomLocationId: $CustomLocationId" -ErrorAction Stop + } + + + return Az.StackHCIVm.internal\New-AzStackHCIVmStoragePath @PSBoundParameters + +} diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/New-AzStackHCIVMVirtualHardDisk_New.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/New-AzStackHCIVMVirtualHardDisk_New.ps1 new file mode 100644 index 000000000000..1d6f25b9043d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/New-AzStackHCIVMVirtualHardDisk_New.ps1 @@ -0,0 +1,249 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a virtual hard disk. +Please note some properties can be set only during virtual hard disk creation. +.Description +The operation to create or update a virtual hard disk. +Please note some properties can be set only during virtual hard disk creation. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmvirtualharddisk +#> +function New-AzStackHCIVmVirtualHardDisk { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks])] +[CmdletBinding(PositionalBinding=$false,SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('VirtualHardDiskName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual hard disk. + # Must contain all alphanumeric characters or ‘-’ or ‘_’. Max length is 80 characters, and min length is 1 character. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # The block size, in bytes, of the virtual hard disk. + ${BlockSizeByte}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage ContainerID of the storage container to be used for VHD + ${StoragePathId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage Container Name to be used for the VHD + ${StoragePathName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage Container resource group. The resource group of the virtual hard disk will be used if this value is not provided. + ${StoragePathResourceGroup}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The ARM Id of the extended location to create virtual hard disk resource in. + ${CustomLocationId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat] + # The format of the actual VHD file [vhd, vhdx] + ${DiskFileFormat}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # Size of the disk in GB + ${SizeGb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Boolean for enabling dynamic sizing on the virtual hard disk + ${Dynamic}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration] + # The hypervisor generation of the Virtual Machine [V1, V2] + ${HyperVGeneration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # Logical Sector Bytes of the Disk + ${LogicalSectorByte}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # Physical Sector Bytes of the Disk + ${PhysicalSectorByte}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + + if (-Not ($Name -match $vhdNameRegex)){ + Write-Error "Invalid Name: $Name. The name must contain all alphanumeric characters or '-' or '_'. The max length is 80 characters." -ErrorAction Stop + } + + if ($CustomLocationId -notmatch $customLocationRegex){ + Write-Error "Invalid CustomLocationId: $CustomLocationId" -ErrorAction Stop + } + + if ($DiskFileFormat){ + if ($DiskFileFormat.ToString().ToLower() -ne "vhd" -and $DiskFileFormat.ToString().ToLower() -ne "vhdx"){ + Write-Error "Invalid disk file format provided. Allowed values are 'vhd' and 'vhdx'. " -ErrorAction Stop + } + } + + + if ($LogicalSectorByte){ + if ($LogicalSectorByte -ne 512 -and $LogicalSectorByte -ne 4096){ + Write-Error "Invalid value for logical sector bytes provided. Allowed values are 512 and 4096. " -ErrorAction Stop + } + } + + + if ($PhysicalSectorByte){ + if ($PhysicalSectorByte -ne 512 -and $PhysicalSectorByte -ne 4096){ + Write-Error "Invalid value for physical sector bytes provided. Allowed values are 512 and 4096'. " -ErrorAction Stop + } + } + + if ($SizeGb){ + if ($SizeGb -gt 4095){ + Write-Error "Maximum value for $SizeGb is 4095." -ErrorAction Stop + } + } + + if($StoragePathId){ + if (-Not ($StoragePathId -match $storagePathRegex)){ + Write-Error "Invalid resource ID provided for storage path $StoragePathId " -ErrorAction Stop + } + } elseif ($StoragePathName){ + if ($StoragePathResourceGroup){ + $StoragePathId = "/subscriptions/$SubscriptionId/resourceGroups/$StoragePathResourceGroup/providers/Microsoft.AzureStackHCI/storagecontainers/$StoragePathName" + } else { + $StoragePathId= "/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.AzureStackHCI/storagecontainers/$StoragePathName" + } + $PSBoundParameters.Add('StoragePathId', $StoragePathId) + $null = $PSBoundParameters.Remove("StoragePathName") + $null = $PSBoundParameters.Remove("StoragePathResourceGroup") + } + + return Az.StackHCIVm.internal\New-AzStackHCIVmVirtualHardDisk @PSBoundParameters + +} + diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/New-AzStackHCIVMVirtualMachine_New.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/New-AzStackHCIVMVirtualMachine_New.ps1 new file mode 100644 index 000000000000..eaeb7510a5f7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/New-AzStackHCIVMVirtualMachine_New.ps1 @@ -0,0 +1,694 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a virtual machine. +Please note some properties can be set only during virtual machine creation. +.Description +The operation to create or update a virtual machine. +Please note some properties can be set only during virtual machine creation. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +LINUXCONFIGURATIONSSHPUBLICKEY : PublicKeys - The list of SSH public keys used to authenticate with linux based VMs. + [KeyData ]: KeyData - SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. For creating ssh keys, see [Create SSH keys on Linux and Mac for Li nux VMs in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-mac-create-ssh-keys?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). + [Path ]: Path - Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file. Example: /home/user/.ssh/authorized_keys + +NETWORKPROFILENETWORKINTERFACE : NetworkInterfaces - list of network interfaces to be attached to the virtual machine + [Id ]: ID - Resource Id of the network interface + +STORAGEPROFILEDATADISK : adds data disks to the virtual machine + [Id ]: Resource ID of the data disk + +WINDOWSCONFIGURATIONSSHPUBLICKEY : PublicKeys - The list of SSH public keys used to authenticate with linux based VMs. + [KeyData ]: KeyData - SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. For creating ssh keys, see [Create SSH keys on Linux and Mac for Li nux VMs in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-mac-create-ssh-keys?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). + [Path ]: Path - Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file. Example: /home/user/.ssh/authorized_keys +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmvirtualmachine +#> +function New-AzStackHCIVmVirtualMachine { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] + [CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] + param( + [Parameter(Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # Maximum Dynamic Memory + ${DynamicMemoryMaximumMemoryInMb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # Minimum Dynamic Memory + ${DynamicMemoryMinimumMemoryInMb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # Defines the amount of extra memory that should be reserved for a virtual machine at runtime, as a percentage of the total memory that the virtual machine is thought to need. + # This only applies to virtual systems with dynamic memory enabled. + # This property can be in the range of 5 to 2000. + ${DynamicMemoryTargetBuffer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # RAM in MB for the virtual machine + ${VmMemoryInMB}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # Number of processors for the virtual machine + ${VmProcessor}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum] + # Size of the VM. Can be a Predefined size or Custom. Possible Predefined Sizes include - Custom,Standard_A2_v2,Standard_A4_v2,Standard_D16s_v3,Standard_D2s_v3,Standard_D32s_v3,Standard_D4s_v3,Standard_D8s_v3,Standard_DS13_v2,Standard_DS2_v2,Standard_DS3_v2,Standard_DS4_v2,Standard_DS5_v2,Standard_K8S2_v1,Standard_K8S3_v1,Standard_K8S4_v1,Standard_K8S5_v1,Standard_K8S_v1,Standard_NK12,Standard_NK6,Standard_NV12, StandardNv6 + + ${VmSize}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType] + # The identity type. + ${IdentityType}, + + [Parameter(ParameterSetName='ByImageId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource ID of the image to create the VM with. + ${ImageId}, + + [Parameter(ParameterSetName='ByImageName',Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Name of the image to create the VM with. + ${ImageName}, + + [Parameter(ParameterSetName='ByImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource group of the image to create the VM from. + ${ImageResourceGroup}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # DisablePasswordAuthentication - whether password authentication should be disabled + ${DisablePasswordAuthentication}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine creation process. VM Agent is provsioned by default. Please pass -ProvisionVMAgent:$false to disable. + ${ProvisionVMAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether virtual machine configuration agent should be provisioned on the virtual machine. When this property is not specified, default behavior is to set it to true. VM Config Agent is provisioned by default. Please pass -ProvisionVMConfigAgent:$false to disable. + ${ProvisionVMConfigAgent}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # NetworkInterfaces - list of network interfaces to be attached to the virtual machine in ARM Id format. + ${NicId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # NetworkInterfaces - list of network interfaces to be attached to the virtual machine in name format. + ${NicName}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # NetworkInterfaces - Resource Group of Network Interfaces. + ${NicResourceGroup}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # Data Disks - List of data disks to be attached to the virtual machine in id format. + ${DataDiskId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # Data Disks - List of data disks to be attached to the virtual machine in name format . + ${DataDiskName}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Data Disks - Resource Group of Data Disks. + ${DataDiskResourceGroup}, + + [Parameter(ParameterSetName='ByOsDiskId',Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource ID of the OS disk + ${OSDiskId}, + + [Parameter(ParameterSetName='ByOsDiskName',Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Name of the OS disk + ${OSDiskName}, + + [Parameter(ParameterSetName='ByOsDiskName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource Group of the OS disk + ${OSDiskResourceGroup}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # AdminPassword - admin password + ${AdminPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # AdminUsername - admin username + ${AdminUsername}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # ComputerName - name of the computer + ${ComputerName}, + + [Parameter(Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # OsType - string specifying whether the OS is Linux or Windows + ${OsType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether or not to enable TPM + ${EnableTpm}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # PublicKeys - The list of SSH public keys used to authenticate with VMs + ${SshPublicKey}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Id of the storage container that hosts the VM configuration file + ${StoragePathId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Name of the storage container that hosts the VM configuration file + ${StoragePathName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage Container resource group. The resource group of the virtual machine will be used if this value is not provided. + ${StoragePathResourceGroup}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Specifies whether secure boot should be enabled on the virtual machine. + ${SecureBootEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Specifies Whether to EnableAutomaticUpdates on the machine. + ${EnableAutomaticUpdate}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # TimeZone for the virtual machine + ${TimeZone}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + ) + + #name + if ($Name -notmatch $machineNameRegex){ + Write-Error "Invalid Name: $Name. The name must start with an alphanumeric character, contain all alphanumeric characters or '-' or '_' or '.' and end with an alphanumeric character. The max length is 64 characters." -ErrorAction Stop + } + + if ($CustomLocationId -notmatch $customLocationRegex){ + Write-Error "Invalid CustomLocationId: $CustomLocationId" -ErrorAction Stop + } + + $PSBoundParameters.Add("Kind", "HCI") + $PSBoundParameters.Add("IdentityType", "SystemAssigned") + $null = $PSBoundParameters.Remove("DynamicMemoryMaximumMemory") + $null = $PSBoundParameters.Remove("DynamicMemoryMinimumMemory") + $null = $PSBoundParameters.Remove("DynamicMemoryTargetBuffer") + $null = $PSBoundParameters.Remove("VmMemoryInMB") + $null = $PSBoundParameters.Remove("VmProcessor") + $null = $PSBoundParameters.Remove("VmSize") + $null = $PSBoundParameters.Remove("NicId") + $null = $PSBoundParameters.Remove("NicName") + $null = $PSBoundParameters.Remove("NicResourceGroup") + $null = $PSBoundParameters.Remove("CustomLocationId") + $null = $PSBoundParameters.Remove("ImageId") + $null = $PSBoundParameters.Remove("ImageName") + $null = $PSBoundParameters.Remove("ImageResourceGroup") + $null = $PSBoundParameters.Remove("DisablePasswordAuthentication") + $null = $PSBoundParameters.Remove("ProvisionVMAgent") + $null = $PSBoundParameters.Remove("ProvisionVMConfigAgent") + $null = $PSBoundParameters.Remove("DataDiskId") + $null = $PSBoundParameters.Remove("DataDiskName") + $null = $PSBoundParameters.Remove("DataDiskResourceGroup") + $null = $PSBoundParameters.Remove("OSDiskId") + $null = $PSBoundParameters.Remove("OSDiskName") + $null = $PSBoundParameters.Remove("OSDiskResourceGroup") + $null = $PSBoundParameters.Remove("AdminPassword") + $null = $PSBoundParameters.Remove("AdminUsername") + $null = $PSBoundParameters.Remove("ComputerName") + $null = $PSBoundParameters.Remove("EnableTpm") + $null = $PSBoundParameters.Remove("SshPublicKey") + $null = $PSBoundParameters.Remove("SecureBootEnabled") + $null = $PSBoundParameters.Remove("StoragePathResourceGroup") + $null = $PSBoundParameters.Remove("StoragePathName") + $null = $PSBoundParameters.Remove("StoragePathId") + $null = $PSBoundParameters.Remove("EnableAutomaticUpdate") + $null = $PSBoundParameters.Remove("TimeZone") + $null = $PSBoundParameters.Remove("NoWait") + $null = $PSBoundParameters.Remove("AsJob") + + if ($OsType.ToString().ToLower() -eq "windows"){ + $null = $PSBoundParameters.Remove("OsType") + $PSBoundParameters.Add('OSType', "Windows") + } elseif ($OsType.ToString().ToLower() -eq "linux"){ + $null = $PSBoundParameters.Remove("OsType") + $PSBoundParameters.Add('OSType', "Linux") + } else { + Write-Error "Invalid OSType provided: $OsType. Accepted Values are 'Windows' and 'Linux'" -ErrorAction Stop + } + + + Az.StackHCIVm.internal\New-AzStackHCIVmMachine @PSBoundParameters | Out-Null + + if ($PSCmdlet.ParameterSetName -eq "ByImageId"){ + if($ImageId -notmatch $marketplaceGalImageRegex -and $ImageId -notmatch $galImageRegex){ + Write-Error "Invalid ImageId: $ImageId" -ErrorAction Stop + } + $PSBoundParameters.Add('ImageId', $ImageId) + } elseif ($PSCmdlet.ParameterSetName -eq "ByImageName"){ + $rg = $ResourceGroupName + if($ImageResourceGroup){ + $rg = $ImageResourceGroup + } + $isGalleryImage = $false + $isMarketplaceGalleryImage = $false + + $galImage = Az.StackHCIVm.internal\Get-AzStackHCIVmGalleryImage -Name $ImageName -ResourceGroupName $rg -SubscriptionId $SubscriptionId -ErrorAction SilentlyContinue + if($galImage -eq $null){ + $marketplaceGalImage = Az.StackHCIVm.internal\Get-AzStackHCIVmMarketplaceGalleryImage -Name $ImageName -ResourceGroupName $rg -SubscriptionId $SubscriptionId -ErrorAction SilentlyContinue + if ($marketplacegalImage -eq $null){ + Write-Error "An Image with name: $ImageName does not exist in Resource Group: $rg" -ErrorAction Stop + } else { + $isMarketplaceGalleryImage = $true + } + + } else{ + $isGalleryImage = $true + } + + if ($isGalleryImage){ + $ImageId = "/subscriptions/$SubscriptionId/resourceGroups/$rg/providers/Microsoft.AzureStackHCI/galleryimages/$ImageName" + } else { + $ImageId = "/subscriptions/$SubscriptionId/resourceGroups/$rg/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/$ImageName" + } + + $null = $PSBoundParameters.Remove("ImageResourceGroup") + $null = $PSBoundParameters.Remove("ImageName") + $PSBoundParameters.Add('ImageId', $ImageId) + + } elseif ($PSCmdlet.ParameterSetName -eq "ByOsDiskId"){ + if($OSDiskId -notmatch $vhdRegex){ + Write-Error "Invalid OSDiskId : $OSDiskId" -ErrorAction Stop + } + } elseif ($PSCmdlet.ParameterSetName -eq "ByOsDiskName"){ + if ($OSDiskResourceGroup){ + $OSDiskId = "/subscriptions/$SubscriptionId/resourceGroups/$OSDiskResourceGroup/providers/Microsoft.AzureStackHCI/virtualharddisks/$OSDiskName" + } else { + $OSDiskId = "/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.AzureStackHCI/virtualharddisks/$OSDiskName" + } + $PSBoundParameters.Add('OSDiskId', $OSDiskId) + $null = $PSBoundParameters.Remove("OSDiskResourceGroup") + $null = $PSBoundParameters.Remove("OSDiskName") + + } else { + Write-Error "Either Image or OS Disk is required. " -ErrorAction Stop + } + + if ($VmSize){ + if($VmSize.ToString().ToLower() -eq "default"){ + Write-Error "Invalid VM Size provided. 'Default' is not a supported VmSize." -ErrorAction Stop + } + if($VmSize.ToString().ToLower() -eq "custom"){ + if (-Not ($VmProcessor -and $VmMemoryInMB)){ + Write-Error "VmMemory and VmProcessor required for Custom VmSize" -ErrorAction Stop + } + $PSBoundParameters.Add("VmMemory", $VmMemoryInMB) + $PSBoundParameters.Add("VmProcessor", $VmProcessor) + } else { + if ($VmProcessor -or $VmMemoryInMB){ + Write-Error "VmMemory and VmProcessor will be ignored. Please specify Custom for VMSize." -ErrorAction Continue + $null = $PSBoundParameters.Remove("VmProcessor") + $null = $PSBoundParameters.Remove("VmMemoryInMB") + } + } + } + + if ($NicId){ + $NetworkProfileNetworkInterface = [System.Collections.ArrayList]::new() + foreach ($NId in $NicId){ + if ($NId -notmatch $nicRegex){ + Write-Error "Invalid Nic Id provided: $NId." -ErrorAction Stop + } + + $nic = Az.StackHCIVm\Get-AzStackHCIVmNetworkInterface -ResourceId $NId -ErrorAction SilentlyContinue + if ($nic -eq $null){ + Write-Error "A Network Interface with id: $NId does not exist." -ErrorAction Stop + } + + $NetworkInterface = @{Id = $NId} + [void]$NetworkProfileNetworkInterface.Add($NetworkInterface) + } + $null = $PSBoundParameters.Remove("NicId") + $PSBoundParameters.Add('NetworkProfileNetworkInterface', $NetworkProfileNetworkInterface) + } elseif ($NicName){ + $rg = $ResourceGroupName + if($NicResourceGroup){ + $rg = $NicResourceGroup + } + + $NetworkProfileNetworkInterface = [System.Collections.ArrayList]::new() + foreach ($NName in $NicName){ + $NicIdNew = "/subscriptions/$SubscriptionId/resourceGroups/$rg/providers/Microsoft.AzureStackHCI/networkinterfaces/$NName" + $nic = Az.StackHCIVm\Get-AzStackHCIVmNetworkInterface -ResourceId $NicIdNew -ErrorAction SilentlyContinue + + if ($nic -eq $null){ + Write-Error "A Network Interface with id: $NicIdNew does not exist." -ErrorAction Stop + } + + $NetworkInterface = @{Id = $NicIdNew} + [void]$NetworkProfileNetworkInterface.Add($NetworkInterface) + } + $null = $PSBoundParameters.Remove("NicName") + $null = $PSBoundParameters.Remove("NicResourceGroup") + + $PSBoundParameters.Add('NetworkProfileNetworkInterface', $NetworkProfileNetworkInterface) + } + if ($OsType.ToString().ToLower() -eq "windows"){ + $OsType = "Windows" + if($ComputerName){ + if ($ComputerName.length -gt 15 -or $ComputerName -match $allDigitsRegex -or $ComputerName -match $invalidCharactersComputerName){ + Write-Error "Invalid Computer Name : $ComputerName." -ErrorAction Stop + } + } + if ($DisablePasswordAuthentication.IsPresent){ + $null = $PSBoundParameters.Remove('DisablePasswordAuthentication') + } + + $PSBoundParameters.Add("WindowConfigurationProvisionVMAgent", $true) + $PSBoundParameters.Add("WindowConfigurationProvisionVMConfigAgent", $true) + if(-not $ProvisionVMAgent){ + $null = $PSBoundParameters.Remove("WindowConfigurationProvisionVMAgent") + } + if (-not $ProvisionVMConfigAgent){ + $null = $PSBoundParameters.Remove("WindowConfigurationProvisionVMConfigAgent") + } + $null = $PSBoundParameters.Remove("ProvisionVMAgent") + $null = $PSBoundParameters.Remove("ProvisionVMConfigAgent") + + + if ($SshPublicKey){ + $WindowsConfigurationSshPublicKey = [System.Collections.ArrayList]::new() + foreach ($key in $SshPublicKey){ + $keyData = Get-Content -Path $key + $WindowsKey = @{KeyData = $keyData} + [void]$WindowsConfigurationSshPublicKey.Add($WindowsKey) + } + $null = $PSBoundParameters.Remove('SshPublicKey') + $PSBoundParameters.Add("WindowsConfigurationSshPublicKey", $WindowsConfigurationSshPublicKey) + } + } elseif ($OsType.ToString().ToLower() -eq "linux"){ + $OsType = "Linux" + if ($ComputerName.length -gt 64 -or $ComputerName -match $allDigitsRegex -or $ComputerName -match $invalidCharactersComputerName){ + Write-Error "Invalid Computer Name : $ComputerName." -ErrorAction Stop + } + if ($EnableAutomaticUpdates.IsPresent){ + $null = $PSBoundParameters.Remove('EnableAutomaticUpdates') + } + if ($TimeZone){ + $null = $PSBoundParameters.Remove('TimeZone') + } + $PSBoundParameters.Add("LinuxConfigurationProvisionVMAgent", $true) + $PSBoundParameters.Add("LinuxConfigurationProvisionVMConfigAgent", $true) + if(-not $ProvisionVMAgent){ + $null = $PSBoundParameters.Remove("LinuxConfigurationProvisionVMAgent") + } + if (-not $ProvisionVMConfigAgent){ + $null = $PSBoundParameters.Remove("LinuxConfigurationProvisionVMConfigAgent") + } + $null = $PSBoundParameters.Remove("ProvisionVMAgent") + $null = $PSBoundParameters.Remove("ProvisionVMConfigAgent") + + + if ($SshPublicKey){ + $LinuxConfigurationSshPublicKey = [System.Collections.ArrayList]::new() + foreach ($key in $SshPublicKey){ + $keyData = Get-Content -Path $key + $LinuxKey = @{KeyData = $keyData} + [void]$LinuxConfigurationSshPublicKey.Add($LinuxKey) + } + $null = $PSBoundParameters.Remove('SshPublicKey') + $PSBoundParameters.Add("LinuxConfigurationSshPublicKey", $LinuxConfigurationSshPublicKey) + } + } else { + Write-Error "Invalid OSType provided: $OsType. Accepted Values are 'Windows' and 'Linux'" -ErrorAction Stop + } + + if($StoragePathId){ + if($StoragePathId -notmatch $storagePathRegex){ + Write-Error "Invalid StoragePathId: $StoragePathId" -ErrorAction Stop + } + } elseif ($StoragePathName){ + if ($StoragePathResourceGroup){ + $ContainerId = "/subscriptions/$SubscriptionId/resourceGroups/$StoragePathResourceGroup/providers/Microsoft.AzureStackHCI/storagecontainers/$StoragePathName" + } else { + $ContainerId = "/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.AzureStackHCI/storagecontainers/$StoragePathName" + } + $PSBoundParameters.Add('StoragePathId', $ContainerId) + $null = $PSBoundParameters.Remove("StoragePathName") + $null = $PSBoundParameters.Remove("StoragePathReourceGroup") + } + + + if ($DataDiskId){ + $StorageProfileDataDisk = [System.Collections.ArrayList]::new() + foreach ($DiskId in $DataDiskId){ + if ($DiskId -notmatch $vhdRegex){ + Write-Error "Invalid Data Disk Id provided: $DiskId." -ErrorAction Stop + } + $DataDisk = @{Id = $DiskId} + [void]$StorageProfileDataDisk.Add($DataDisk) + } + $null = $PSBoundParameters.Remove("DataDiskId") + $PSBoundParameters.Add('StorageProfileDataDisk', $StorageProfileDataDisk) + } elseif ($DataDiskName){ + $rg = $ResourceGroupName + if($DataDiskResourceGroup){ + $rg = $DataDiskResourceGroup + } + + $StorageProfileDataDisk = [System.Collections.ArrayList]::new() + foreach ($DiskName in $DataDiskName){ + $DataDiskIdNew = "/subscriptions/$SubscriptionId/resourceGroups/$rg/providers/Microsoft.AzureStackHCI/virtualharddisks/$DiskName" + $DataDisk = @{Id = $DataDiskIdNew} + [void]$StorageProfileDataDisk.Add($DataDisk) + } + $null = $PSBoundParameters.Remove("DataDiskName") + $null = $PSBoundParameters.Remove("DataDiskResourceGroup") + $PSBoundParameters.Add('StorageProfileDataDisk', $StorageProfileDataDisk) + } + $resourceUri = "/subscriptions/" + $subscriptionId + "/resourceGroups/" + $resourceGroupName + "/providers/Microsoft.HybridCompute/machines/" + $Name + $PSBoundParameters.Add("ResourceUri", $resourceUri) + $PSBoundParameters.Add("CustomLocationId", $CustomLocationId) + $PSBoundParameters.Add("OSDiskOstype", $OsType) + $PSBoundParameters.Add('VmSize', $VmSize) + if ($ComputerName){ + $PSBoundParameters.Add('ComputerName', $ComputerName) + } + if ($AdminUsername){ + $PSBoundParameters.Add('AdminUsername', $AdminUsername) + } + if ($AdminPassword){ + $PSBoundParameters.Add('AdminPassword', $AdminPassword) + } + if ($DynamicMemoryMaximumMemory){ + $PSBoundParameters.Add('DynamicMemoryMaximumMemory', $DynamicMemoryMaximumMemory) + } + if ($DynamicMemoryMinimumMemory){ + $PSBoundParameters.Add('DynamicMemoryMinimumMemory', $DynamicMemoryMinimumMemory) + } + if ($DynamicMemoryTargetBuffer){ + $PSBoundParameters.Add('DynamicMemoryTargetBuffer', $DynamicMemoryTargetBuffer) + } + if ($EnableTpm.IsPresent){ + $PSBoundParameters.Add('EnableTpm', $EnableTpm) + } + IF($SecureBootEnabled.IsPresent){ + $PSBoundParameters.Add('SecureBootEnabled', $SecureBootEnabled) + } + $null = $PSBoundParameters.Remove("Name") + $null = $PSBoundParameters.Remove("ResourceGroupName") + $null = $PSBoundParameters.Remove("SubscriptionId") + $null = $PSBoundParameters.Remove("ResourceId") + $null = $PSBoundParameters.Remove("NicResourceGroup") + $null = $PSBoundParameters.Remove("NicName") + $null = $PSBoundParameters.Remove("Kind") + $null = $PSBoundParameters.Remove("Location") + $null = $PSBoundParameters.Remove("OSType") + $null = $PSBoundParameters.Remove("IdentityType") + return Az.StackHCIVm.internal\New-AzStackHCIVmVirtualMachine @PSBoundParameters +} + diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/README.md b/src/StackHCI/StackHCIVm.Autorest/custom/README.md new file mode 100644 index 000000000000..bc3b0f6a0965 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/README.md @@ -0,0 +1,41 @@ +# Custom +This directory contains custom implementation for non-generated cmdlets for the `Az.StackHCIVm` 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.StackHCIVm.custom.psm1`. This file should not be modified. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: yes + +## Details +For `Az.StackHCIVm` to use custom cmdlets, it does this two different ways. We **highly recommend** creating script cmdlets, as they are easier to write and allow access to the other exported cmdlets. C# cmdlets *cannot access exported cmdlets*. + +For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.StackHCIVm.private.dll`. The names of the cmdlets (methods) and files must follow the `[cmdletName]_[variantName]` syntax used for generated cmdlets. The `variantName` is used as the `ParameterSetName`, so use something appropriate that doesn't clash with already created variant or parameter set names. You cannot use the `ParameterSetName` property in the `Parameter` attribute on C# cmdlets. Each cmdlet must be separated into variants using the same pattern as seen in the `generated/cmdlets` folder. + +For script cmdlets, these are loaded via the `Az.StackHCIVm.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. + +## Purpose +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. + +## Usage +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: +- Break +- DefaultProfile +- HttpPipelineAppend +- HttpPipelinePrepend +- Proxy +- ProxyCredential +- ProxyUseDefaultCredentials + +These provide functionality to our HTTP pipeline and other useful features. In script, you can forward these parameters using `$PSBoundParameters` to the other cmdlets you're calling within `Az.StackHCIVm`. For C#, follow the usage seen in the `ProcessRecordAsync` method. + +### Attributes +For processing the cmdlets, we've created some additional attributes: +- `Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.DescriptionAttribute` + - 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. +- `Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.DoNotExportAttribute` + - Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.StackHCIVm`. +- `Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExportAttribute` + - Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.StackHCIVm`. For more information, see [README.md](..\internal/README.md) in the `..\internal` folder. +- `Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ProfileAttribute` + - Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules. \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHCIVMImage.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHCIVMImage.ps1 new file mode 100644 index 000000000000..2d6c96f344ba --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHCIVMImage.ps1 @@ -0,0 +1,141 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete an image. +.Description +The operation to delete an image. + +.Outputs +System.Boolean + +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmimage +#> + +function Remove-AzStackHCIVmImage{ + [OutputType([System.Boolean])] + [CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] + param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the gallery image + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the image. + ${ResourceId}, + + [Parameter(HelpMessage='Forces the cmdlet to remove the network interface without prompting for confirmation.')] + [System.Management.Automation.SwitchParameter] + ${Force} + ) + + + Write-Warning("Running this command will delete the image.") + $isGalleryImage = $false + $isMarketplaceGalleryImage = $false + + if ($PSCmdlet.ParameterSetName -eq "ByName"){ + $isGalleryImage = $false + $isMarketplaceGalleryImage = $false + + + $galImage = Az.StackHCIVm.internal\Get-AzStackHCIVmGalleryImage -Name $Name -ResourceGroupName $ResourceGroupName -ErrorAction SilentlyContinue + if ($galImage -ne $null){ + $isGalleryImage = $true + } else { + $marketplaceGalImage = Az.StackHCIVm.internal\Get-AzStackHCIVmMarketplaceGalleryImage -Name $Name -ResourceGroupName $ResourceGroupName -ErrorAction SilentlyContinue + if ($marketplaceGalImage -ne $null){ + $isMarketplaceGalleryImage = $true + } + } + + if (!$isGalleryImage -and !$isMarketplaceGalleryImage ){ + Write-Error "An Image with name: $Name does not exist in Resource Group: $ResourceGroupName" -ErrorAction Stop + } + + + + } elseif ($PSCmdlet.ParameterSetName -eq "ByResourceId"){ + + if ($ResourceId -match $galImageRegex){ + + $subscriptionId = $($Matches['subscriptionId']) + $resourceGroupName = $($Matches['resourceGroupName']) + $resourceName = $($Matches['imageName']) + $null = $PSBoundParameters.Remove("ResourceId") + $PSBoundParameters.Add("Name", $resourceName) + $PSBoundParameters.Add("ResourceGroupName", $resourceGroupName) + $null = $PSBoundParameters.Remove("SubscriptionId") + $PSBoundParameters.Add("SubscriptionId", $subscriptionId) + + $isGalleryImage = $true + + } elseif ($ResourceId -match $marketplaceGalImageRegex){ + $subscriptionId = $($Matches['subscriptionId']) + $resourceGroupName = $($Matches['resourceGroupName']) + $resourceName = $($Matches['imageName']) + $null = $PSBoundParameters.Remove("ResourceId") + $PSBoundParameters.Add("Name", $resourceName) + $PSBoundParameters.Add("ResourceGroupName", $resourceGroupName) + $null = $PSBoundParameters.Remove("SubscriptionId") + $PSBoundParameters.Add("SubscriptionId", $subscriptionId) + + $isMarketplaceGalleryImage = $true + + } else { + Write-Error "Resource ID is invalid: $ResourceId" -ErrorAction Stop + } + } + + if ($PSCmdlet.ShouldProcess($PSBoundParameters['Name']) -and ($Force -or $PSCmdlet.ShouldContinue("Delete this image?", "Confirm"))) + { + if ($PSBoundParameters.ContainsKey("Force")) { + $null = $PSBoundParameters.Remove("Force") + } + + if ($isMarketplaceGalleryImage) + { + return Az.StackHCIVm.internal\Remove-AzStackHCIVmMarketplaceGalleryImage @PSBoundParameters + } + + if ($isGalleryImage) + { + return Az.StackHCIVm.internal\Remove-AzStackHCIVmGalleryImage @PSBoundParameters + } + } + +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHCIVMVirtualMachineDataDisk.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHCIVMVirtualMachineDataDisk.ps1 new file mode 100644 index 000000000000..86106e649bfe --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHCIVMVirtualMachineDataDisk.ps1 @@ -0,0 +1,158 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a data disk from a virtual machine. +.Description +The operation to delete a data disk from a virtual machine. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualmachinedatadisk +#> + +function Remove-AzStackHCIVmVirtualMachineDataDisk { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] + [CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] + param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual machine. + ${ResourceId}, + + [Parameter(ParameterSetName='ByName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId')] + [Parameter(ParameterSetName='ByName')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # Data Disks - list of data disks to be removed from the virtual machine in id format. + ${DataDiskId}, + + [Parameter(ParameterSetName='ByResourceId')] + [Parameter(ParameterSetName='ByName')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # Data Disks - list of data disks to be removed from the virtual machine in name format. + ${DataDiskName}, + + [Parameter(ParameterSetName='ByResourceId')] + [Parameter(ParameterSetName='ByName')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource Group of the Data Disks. + ${DataDiskResourceGroup} + ) + + if (($ResourceId -match $vmRegex) -or ($Name -and $ResourceGroupName -and $SubscriptionId)){ + if ($ResourceId -match $vmRegex){ + $SubscriptionId = $($Matches['subscriptionId']) + $ResourceGroupName = $($Matches['resourceGroupName']) + $Name = $($Matches['machineName']) + } + $null = $PSBoundParameters.Remove("Name") + $null = $PSBoundParameters.Remove("ResourceGroupName") + $null = $PSBoundParameters.Remove("SubscriptionId") + $null = $PSBoundParameters.Remove("ResourceId") + $resourceUri = "/subscriptions/" + $subscriptionId + "/resourceGroups/" + $ResourceGroupName + "/providers/Microsoft.HybridCompute/machines/" + $Name + $PSBoundParameters.Add("ResourceUri", $resourceUri) + } 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" -ErrorAction Stop + } + + + $NewStorageProfileDataDisk = [System.Collections.ArrayList]::new() + $diskList = [System.Collections.ArrayList]::new() + $VM = Az.StackHCIVm.internal\Get-AzStackHCIVmVirtualMachine -ResourceUri $resourceUri + if ($VM.StorageProfileDataDisk.Id.GetType() -eq [System.String]){ + [void]$diskList.add($VM.StorageProfileDataDisk.Id) + } else { + $diskList = [System.Collections.ArrayList]$VM.StorageProfileDataDisk.Id + } + + if ($DataDiskId){ + $DataDisks = $PSBoundParameters['DataDiskId'] + $null = $PSBoundParameters.Remove("DataDiskId") + + foreach ($DataDisk in $DataDisks){ + $diskName = ($DataDisk -split "/")[8] + if ($DataDisk -in $diskList) { + [void]$diskList.Remove($DataDisk) + } elseif ( $diskName -in $diskList){ + [void]$diskList.Remove($diskName) + } else { + Write-Error "Data Disk is not currently attached: $DataDisk" + } + } + + $PSBoundParameters.Add('StorageProfileDataDisk', $StorageProfileDataDisk) + + } elseif ($DataDiskName){ + $rg = $ResourceGroupName + if($DataDiskResourceGroup){ + $rg = $DataDiskResourceGroup + } + + $null = $PSBoundParameters.Remove("DataDiskName") + $null = $PSBoundParameters.Remove("DataDiskResourceGroup") + + foreach ($DiskName in $DataDiskName){ + $DiskId = "/subscriptions/$SubscriptionId/resourceGroups/$rg/providers/Microsoft.AzureStackHCI/virtualHardDisks/$DiskName" + if ($DiskId -in $diskList) { + [void]$diskList.Remove($DiskId) + } elseif ($DiskName -in $diskList) { + [void]$diskList.Remove($DiskName) + } else { + Write-Error "Data Disk is not currently attached: $DiskName" + } + } + + } + + foreach ($disk in $diskList){ + $DataDisk = @{Id = $disk} + [void]$NewStorageProfileDataDisk.Add($DataDisk) + } + + $PSBoundParameters.Add('StorageProfileDataDisk', $NewStorageProfileDataDisk) + + + return Az.StackHCIVm.internal\Update-AzStackHCIVmVirtualMachine @PSBoundParameters + } diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHCIVMVirtualMachineNetworkInterface.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHCIVMVirtualMachineNetworkInterface.ps1 new file mode 100644 index 000000000000..87078da7089c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHCIVMVirtualMachineNetworkInterface.ps1 @@ -0,0 +1,157 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a network interface from a virtual machine. +.Description +The operation to delete a network interface from a virtual machine. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualmachinenetworkinterface +#> + +function Remove-AzStackHCIVmVirtualMachineNetworkInterface { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] + [CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] + param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual machine. + ${ResourceId}, + + [Parameter(ParameterSetName='ByName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId')] + [Parameter(ParameterSetName='ByName')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # NetworkInterfaces - list of network interfaces to be attached from the virtual machine in id format. + ${NicId}, + + [Parameter(ParameterSetName='ByResourceId')] + [Parameter(ParameterSetName='ByName')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # NetworkInterfaces - list of network interfaces to be removed from the virtual machine in name format. + ${NicName}, + + [Parameter(ParameterSetName='ByResourceId')] + [Parameter(ParameterSetName='ByName')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # NetworkInterfaces - resource group of the network interfaces + ${NicResourceGroup} + ) + + if (($ResourceId -match $vmRegex) -or ($Name -and $ResourceGroupName -and $SubscriptionId)){ + if ($ResourceId -match $vmRegex){ + $SubscriptionId = $($Matches['subscriptionId']) + $ResourceGroupName = $($Matches['resourceGroupName']) + $Name = $($Matches['machineName']) + } + $null = $PSBoundParameters.Remove("Name") + $null = $PSBoundParameters.Remove("ResourceGroupName") + $null = $PSBoundParameters.Remove("SubscriptionId") + $null = $PSBoundParameters.Remove("ResourceId") + $resourceUri = "/subscriptions/" + $subscriptionId + "/resourceGroups/" + $ResourceGroupName + "/providers/Microsoft.HybridCompute/machines/" + $Name + $PSBoundParameters.Add("ResourceUri", $resourceUri) + } 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" + } + + $NewNetworkProfileNetworkInterface = [System.Collections.ArrayList]::new() + $nicList = [System.Collections.ArrayList]::new() + $VM = Az.StackHCIVm.internal\Get-AzStackHCIVmVirtualMachine -ResourceUri $resourceUri + + if ($VM.NetworkProfileNetworkInterface.Id.GetType() -eq [System.String]){ + [void]$nicList.add($VM.NetworkProfileNetworkInterface.Id) + } else { + $nicList = [System.Collections.ArrayList]$VM.NetworkProfileNetworkInterface.Id + } + + if ($NicId){ + $NicId = $PSBoundParameters['NicId'] + $null = $PSBoundParameters.Remove("NicId") + + foreach ($NId in $NicId){ + $nicName = ($NId -split "/")[8] + if ($NId -in $nicList){ + $nicList.Remove($NId) + } elseif ($nicName -in $nicList){ + $nicList.Remove($nicName) + } else { + Write-Error "Network Interface not currently attached: $NId" + } + } + + } elseif ($NicName){ + $rg = $ResourceGroupName + if($NicResourceGroup){ + $rg = $NicResourceGroup + } + + $null = $PSBoundParameters.Remove("NicName") + $null = $PSBoundParameters.Remove("NicResourceGroup") + + + foreach ($NName in $NicName){ + $NId = "/subscriptions/$SubscriptionId/resourceGroups/$rg/providers/Microsoft.AzureStackHCI/networkInterfaces/$NName" + if ($NId -in $nicList){ + [void]$nicList.Remove($NId) + } elseif ($NName -in $nicList) { + $nicList.Remove($NName) + } else { + Write-Error "Network Interface not currently attached: $NName" + } + } + + } + + foreach ($nic in $nicList){ + $Nic = @{Id = $nic} + [void]$NewNetworkProfileNetworkInterface.Add($Nic) + } + + + $PSBoundParameters.Add('NetworkProfileNetworkInterface', $NewNetworkProfileNetworkInterface) + + return Az.StackHCIVm.internal\Update-AzStackHCIVmVirtualMachine @PSBoundParameters + } \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHCIVmVirtualHardDisk_New.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHCIVmVirtualHardDisk_New.ps1 new file mode 100644 index 000000000000..8771493f8a76 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHCIVmVirtualHardDisk_New.ps1 @@ -0,0 +1,104 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a virtual hard disk. +.Description +The operation to delete a virtual hard disk. + +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualharddisk +#> +function Remove-AzStackHCIVmVirtualHardDisk { + [OutputType([System.Boolean])] + [CmdletBinding(PositionalBinding=$false, SupportsShouldProcess=$true, ConfirmImpact='Medium')] + param( + [Parameter(ParameterSetName='ByName',Mandatory)] + [Alias('VirtualHardDiskName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual hard disk + ${Name}, + + [Parameter(ParameterSetName='ByName',Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId',Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual hard disk. + ${ResourceId}, + + [Parameter(HelpMessage='Forces the cmdlet to remove the virtual hard disk without prompting for confirmation.')] + [System.Management.Automation.SwitchParameter] + ${Force} + + ) + + + + process { + + Write-Warning("Running this command will delete the virtual hard disk.") + + if ($PSCmdlet.ParameterSetName -eq "ByResourceId"){ + if ($ResourceId -match $vhdRegex){ + + $subscriptionId = $($Matches['subscriptionId']) + $resourceGroupName = $($Matches['resourceGroupName']) + $resourceName = $($Matches['vhdName']) + $null = $PSBoundParameters.Remove("ResourceId") + $PSBoundParameters.Add("Name", $resourceName) + $PSBoundParameters.Add("ResourceGroupName", $resourceGroupName) + $null = $PSBoundParameters.Remove("SubscriptionId") + $PSBoundParameters.Add("SubscriptionId", $subscriptionId) + + } else { + Write-Error "Resource ID is invalid: $ResourceId" -ErrorAction Stop + } + } + if ($PSCmdlet.ShouldProcess($PSBoundParameters['Name']) -and ($Force -or $PSCmdlet.ShouldContinue("Delete this virtual hard disk?", "Confirm"))) + { + if ($PSBoundParameters.ContainsKey("Force")) { + $null = $PSBoundParameters.Remove("Force") + } + + Az.StackHCIVm.internal\Remove-AzStackHCIVmVirtualHardDisk @PSBoundParameters + } + + } + + + +} + \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHCIVmVirtualMachine_New.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHCIVmVirtualMachine_New.ps1 new file mode 100644 index 000000000000..c5fc706950c3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHCIVmVirtualMachine_New.ps1 @@ -0,0 +1,191 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a virtual machine. +.Description +The operation to delete a virtual machine. + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHCIVmIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the hybridIdentityMetadata. + [Name ]: The name of the machine where the extension should be created or updated. + [NetworkInterfaceName ]: Name of the network interface + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [VirtualHardDiskName ]: Name of the virtual hard disk + [VirtualMachineName ]: Name of the virtual machine + [VirtualNetworkName ]: Name of the virtual network +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualmachine +#> +function Remove-AzStackHCIVmVirtualMachine { + [OutputType([System.Boolean])] + [CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] + param( + [Parameter(ParameterSetName='ByName',Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName',Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHCIVmIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='ByResourceId',Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual machine. + ${ResourceId}, + + [Parameter(HelpMessage='Forces the cmdlet to remove the virtual machine without prompting for confirmation.')] + [System.Management.Automation.SwitchParameter] + ${Force}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + + ) + + process { + Write-Warning("Running this command will delete the virtual machine.") + if ($Force -or $PSCmdlet.ShouldContinue("Delete this virtual machine?", "Confirm")) + { + if ($PSCmdlet.ParameterSetName -eq "ByResourceId"){ + if ($ResourceId -match $vmRegex) { + $SubscriptionId = $($Matches['subscriptionId']) + $ResourceGroupName = $($Matches['resourceGroupName']) + $Name = $($Matches['machineName']) + $resourceUri = "/subscriptions/" + $subscriptionId + "/resourceGroups/" + $resourceGroupName + "/providers/Microsoft.HybridCompute/machines/" + $Name + } else { + Write-Error "Resource ID is invalid: $ResourceId" -ErrorAction Stop + } + } + if ($PSCmdlet.ParameterSetName -eq "ByName"){ + if ($SubscriptionId -and $ResourceGroupName -and $Name){ + $resourceUri = "/subscriptions/" + $SubscriptionId + "/resourceGroups/" + $ResourceGroupName + "/providers/Microsoft.HybridCompute/machines/" + $Name + } else { + Write-Error "One or more input parameters are invalid. Name is $name, resource group name is $resourcegroupname, subscription id is $subscriptionid" + } + } + + $null = $PSBoundParameters.Remove("ResourceId") + $null = $PSBoundParameters.Remove("Name") + $null = $PSBoundParameters.Remove("SubscriptionId") + $null = $PSBoundParameters.Remove("ResourceGroupName") + $null = $PSBoundParameters.Remove("Force") + $PSBoundParameters.Add("ResourceUri", $resourceUri) + Az.StackHCIVm.internal\Remove-AzStackHCIVmVirtualMachine @PSBoundParameters + + $PSBoundParameters.Add("SubscriptionId", $SubscriptionId) + $PSBoundParameters.Add("ResourceGroupName", $ResourceGroupName) + $PSBoundParameters.Add("Name", $Name) + $null = $PSBoundParameters.Remove("ResourceUri") + Az.StackHCIVm.internal\Remove-AzStackHCIVmMachine @PSBoundParameters + } + } +} + \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHciVMLogicalNetwork_New.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHciVMLogicalNetwork_New.ps1 new file mode 100644 index 000000000000..86c12cd4d811 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHciVMLogicalNetwork_New.ps1 @@ -0,0 +1,96 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a logical network. +.Description +The operation to delete a logical network. + +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + + +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmlogicalnetwork +#> +function Remove-AzStackHCIVmLogicalNetwork { + [OutputType([System.Boolean])] + [CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] + param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('LogicalNetworkName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual network + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId',Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual network. + ${ResourceId}, + + [Parameter(ParameterSetName='ByResourceId')] + [Parameter(ParameterSetName='Delete')] + [Parameter(HelpMessage='Forces the cmdlet to remove the virtual network without prompting for confirmation.')] + [System.Management.Automation.SwitchParameter] + ${Force} + ) + + Write-Warning("Running this command will delete the logical network.") + if ($PSCmdlet.ParameterSetName -eq "ByResourceId"){ + if ($ResourceId -match $lnetRegex){ + $subscriptionId = $($Matches['subscriptionId']) + $resourceGroupName = $($Matches['resourceGroupName']) + $resourceName = $($Matches['logicalNetworkName']) + $null = $PSBoundParameters.Remove("ResourceId") + $PSBoundParameters.Add("Name", $resourceName) + $PSBoundParameters.Add("ResourceGroupName", $resourceGroupName) + $null = $PSBoundParameters.Remove("SubscriptionId") + $PSBoundParameters.Add("SubscriptionId", $subscriptionId) + + + } else { + Write-Error "Resource ID is invalid: $ResourceId" -ErrorAction Stop + } + } + if ($PSCmdlet.ShouldProcess($PSBoundParameters['Name']) -and ($Force -or $PSCmdlet.ShouldContinue("Delete this logical network?", "Confirm"))) + { + if ($PSBoundParameters.ContainsKey("Force")) { + $null = $PSBoundParameters.Remove("Force") + } + + Az.StackHCIVm.internal\Remove-AzStackHCIVmLogicalNetwork @PSBoundParameters + } + +} + \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHciVMNetworkInterface_New.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHciVMNetworkInterface_New.ps1 new file mode 100644 index 000000000000..29206c4ae062 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHciVMNetworkInterface_New.ps1 @@ -0,0 +1,114 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a network interface. +.Description +The operation to delete a network interface. + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHCIVmIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the hybridIdentityMetadata. + [Name ]: The name of the machine where the extension should be created or updated. + [NetworkInterfaceName ]: Name of the network interface + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [VirtualHardDiskName ]: Name of the virtual hard disk + [VirtualMachineName ]: Name of the virtual machine + [VirtualNetworkName ]: Name of the virtual network +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmnetworkinterface +#> +function Remove-AzStackHCIVmNetworkInterface { + [OutputType([System.Boolean])] + [CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] + param( + [Parameter(ParameterSetName='ByName',Mandatory)] + [Alias('NetworkInterfaceName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the network interface + ${Name}, + + [Parameter(ParameterSetName='ByName',Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId',Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the network interface. + ${ResourceId}, + + [Parameter(HelpMessage='Forces the cmdlet to remove the network interface without prompting for confirmation.')] + [System.Management.Automation.SwitchParameter] + ${Force} + ) + + Write-Warning("Running this command will delete the network interface.") + if ($PSCmdlet.ParameterSetName -eq "ByResourceId"){ + if ($ResourceId -match $nicRegex){ + + $subscriptionId = $($Matches['subscriptionId']) + $resourceGroupName = $($Matches['resourceGroupName']) + $resourceName = $($Matches['nicName']) + $null = $PSBoundParameters.Remove("ResourceId") + $PSBoundParameters.Add("Name", $resourceName) + $PSBoundParameters.Add("ResourceGroupName", $resourceGroupName) + $null = $PSBoundParameters.Remove("SubscriptionId") + $PSBoundParameters.Add("SubscriptionId", $subscriptionId) + + } else { + Write-Error "Resource ID is invalid: $ResourceId" -ErrorAction Stop + } + } + if ($PSCmdlet.ShouldProcess($PSBoundParameters['Name']) -and ($Force -or $PSCmdlet.ShouldContinue("Delete this network interface?", "Confirm"))) + { + if ($PSBoundParameters.ContainsKey("Force")) { + $null = $PSBoundParameters.Remove("Force") + } + + Az.StackHCIVm.internal\Remove-AzStackHCIVmNetworkInterface @PSBoundParameters + } + + + +} + \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHciVMStoragePath_New.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHciVMStoragePath_New.ps1 new file mode 100644 index 000000000000..3aa2c11dad7c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Remove-AzStackHciVMStoragePath_New.ps1 @@ -0,0 +1,200 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a storage container. +.Description +The operation to delete a storage container. + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHCIVmIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the hybridIdentityMetadata. + [Name ]: The name of the machine where the extension should be created or updated. + [NetworkInterfaceName ]: Name of the network interface + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [VirtualHardDiskName ]: Name of the virtual hard disk + [VirtualMachineName ]: Name of the virtual machine + [VirtualNetworkName ]: Name of the virtual network +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmstoragepath +#> +function Remove-AzStackHCIVmStoragePath { + [OutputType([System.Boolean])] + [CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] + param( + [Parameter(ParameterSetName='ByName',Mandatory)] + [Alias('StorageContainerName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the storage container + ${Name}, + + [Parameter(ParameterSetName='ByName',Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHCIVmIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='ByResourceId',Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the storage path. + ${ResourceId}, + + [Parameter(HelpMessage='Forces the cmdlet to remove the storage path without prompting for confirmation.')] + [System.Management.Automation.SwitchParameter] + ${Force}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceId')] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceId')] + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceId')] + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceId')] + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceId')] + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceId')] + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + ) + + Write-Warning("Running this command will delete the storage path.") + + if ($PSCmdlet.ParameterSetName -eq "ByResourceId"){ + if ($ResourceId -match $storagePathRegex){ + + $subscriptionId = $($Matches['subscriptionId']) + $resourceGroupName = $($Matches['resourceGroupName']) + $resourceName = $($Matches['storagePathName']) + $null = $PSBoundParameters.Remove("ResourceId") + $PSBoundParameters.Add("Name", $resourceName) + $PSBoundParameters.Add("ResourceGroupName", $resourceGroupName) + $null = $PSBoundParameters.Remove("SubscriptionId") + $PSBoundParameters.Add("SubscriptionId", $subscriptionId) + + } else { + Write-Error "Resource ID is invalid: $ResourceId" + } + } + + if ($PSCmdlet.ShouldProcess($PSBoundParameters['Name']) -and ($Force -or $PSCmdlet.ShouldContinue("Delete this storage path?", "Confirm"))) + { + if ($PSBoundParameters.ContainsKey("Force")) { + $null = $PSBoundParameters.Remove("Force") + } + + Az.StackHCIVm.internal\Remove-AzStackHCIVmStoragePath @PSBoundParameters + } +} + \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Restart-AzStackHCIVMVirtualMachine_New.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Restart-AzStackHCIVMVirtualMachine_New.ps1 new file mode 100644 index 000000000000..bf354ea4b1b8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Restart-AzStackHCIVMVirtualMachine_New.ps1 @@ -0,0 +1,139 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to restart a virtual machine instance. +.Description +The operation to restart a virtual machine instance. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Notes +COMPLEX PARAMETER PROPERTIES + +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/restart-azstackhcivmvirtualmachine +#> +function Restart-AzStackHCIVmVirtualMachine { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] + [CmdletBinding( PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] + param( + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual machine. + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + + ) + if (($ResourceId -match $vmRegex) -or ($Name -and $ResourceGroupName -and $SubscriptionId)){ + if ($ResourceId -match $vmRegex){ + $SubscriptionId = $($Matches['subscriptionId']) + $ResourceGroupName = $($Matches['resourceGroupName']) + $Name = $($Matches['machineName']) + } + $resourceUri = "/subscriptions/" + $subscriptionId + "/resourceGroups/" + $ResourceGroupName + "/providers/Microsoft.HybridCompute/machines/" + $Name + $PSBoundParameters.Add("ResourceUri", $resourceUri) + $null = $PSBoundParameters.Remove("SubscriptionId") + $null = $PSBoundParameters.Remove("ResourceGroupName") + $null = $PSBoundParameters.Remove("ResourceId") + $null = $PSBoundParameters.Remove("Name") + return Az.StackHCIVm.internal\Restart-AzStackHCIVmVirtualMachine @PSBoundParameters + } 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" + } +} + \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Start-AzStackHCIVMVirtualMachine_New.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Start-AzStackHCIVMVirtualMachine_New.ps1 new file mode 100644 index 000000000000..60e7bb6974de --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Start-AzStackHCIVMVirtualMachine_New.ps1 @@ -0,0 +1,139 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to start a virtual machine instance. +.Description +The operation to start a virtual machine instance. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Notes +COMPLEX PARAMETER PROPERTIES + + +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/start-azstackhcivmvirtualmachine +#> +function Start-AzStackHCIVmVirtualMachine { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] + [CmdletBinding( PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] + param( + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual machine. + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + + ) + if (($ResourceId -match $vmRegex) -or ($Name -and $ResourceGroupName -and $SubscriptionId)){ + if ($ResourceId -match $vmRegex){ + $SubscriptionId = $($Matches['subscriptionId']) + $ResourceGroupName = $($Matches['resourceGroupName']) + $Name = $($Matches['machineName']) + } + $resourceUri = "/subscriptions/" + $subscriptionId + "/resourceGroups/" + $ResourceGroupName + "/providers/Microsoft.HybridCompute/machines/" + $Name + $PSBoundParameters.Add("ResourceUri", $resourceUri) + $null = $PSBoundParameters.Remove("SubscriptionId") + $null = $PSBoundParameters.Remove("ResourceGroupName") + $null = $PSBoundParameters.Remove("ResourceId") + $null = $PSBoundParameters.Remove("Name") + return Az.StackHCIVm.internal\Start-AzStackHCIVmVirtualMachine @PSBoundParameters + } 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" + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Stop-AzStackHCIVMVirtualMachine_New.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Stop-AzStackHCIVMVirtualMachine_New.ps1 new file mode 100644 index 000000000000..2afd2e19c7e6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Stop-AzStackHCIVMVirtualMachine_New.ps1 @@ -0,0 +1,141 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to stop a virtual machine instance. +.Description +The operation to stop a virtual machine instance. + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHCIVmIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/stop-azstackhcivmvirtualmachine +#> +function Stop-AzStackHCIVmVirtualMachine { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] + [CmdletBinding( PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] + param( + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual machine. + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + + ) + if (($ResourceId -match $vmRegex) -or ($Name -and $ResourceGroupName -and $SubscriptionId)){ + if ($ResourceId -match $vmRegex){ + $SubscriptionId = $($Matches['subscriptionId']) + $ResourceGroupName = $($Matches['resourceGroupName']) + $Name = $($Matches['machineName']) + } + $resourceUri = "/subscriptions/" + $subscriptionId + "/resourceGroups/" + $ResourceGroupName + "/providers/Microsoft.HybridCompute/machines/" + $Name + $PSBoundParameters.Add("ResourceUri", $resourceUri) + $null = $PSBoundParameters.Remove("SubscriptionId") + $null = $PSBoundParameters.Remove("ResourceGroupName") + $null = $PSBoundParameters.Remove("ResourceId") + $null = $PSBoundParameters.Remove("Name") + return Az.StackHCIVm.internal\Stop-AzStackHCIVmVirtualMachine @PSBoundParameters + } 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" + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Update-AzStackHCIVMImage.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Update-AzStackHCIVMImage.ps1 new file mode 100644 index 000000000000..cd9d10a8ceaf --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Update-AzStackHCIVMImage.ps1 @@ -0,0 +1,119 @@ +<# +.Synopsis +The operation to update an image. + +.Description +The operation to update an image. +Please note some properties can be set only during image creation. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20221215Preview.IGalleryImages +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20221215Preview.IMarketplaceGalleryImages +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmimage +#> + +function Update-AzStackHCIVmImage{ + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages],ParameterSetName='Marketplace' )] + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages],ParameterSetName='GalleryImage' )] + [CmdletBinding(DefaultParameterSetName='GalleryImage', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] + + param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the gallery image + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the image. + ${ResourceId}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag} + +) + + process { + if ($PSCmdlet.ParameterSetName -eq "ByName"){ + + $isGalleryImage = $false + $isMarketplaceGalleryImage = $false + + + $galImage = Az.StackHCIVm.internal\Get-AzStackHCIVmGalleryImage -Name $Name -ResourceGroupName $ResourceGroupName -SubscriptionId $SubscriptionId -ErrorAction SilentlyContinue + if ($galImage -ne $null){ + $isGalleryImage = $true + } else { + $marketplaceGalImage = Az.StackHCIVm.internal\Get-AzStackHCIVmMarketplaceGalleryImage -Name $Name -ResourceGroupName $ResourceGroupName -SubscriptionId $SubscriptionId -ErrorAction SilentlyContinue + if ($marketplaceGalImage -ne $null){ + $isMarketplaceGalleryImage = $true + }else{ + Write-Error "An Image with name: $Name does not exist in Resource Group: $ResourceGroupName" -ErrorAction Stop + } + } + + + if ($isGalleryImage){ + return Az.StackHCIVm.internal\Update-AzStackHCIVmGalleryImage @PSBoundParameters + } + + if ($isMarketplaceGalleryImage){ + return Az.StackHCIVm.internal\Update-AzStackHCIVmMarketplaceGalleryImage @PSBoundParameters + } + + } elseif ($PSCmdlet.ParameterSetName -eq "ByResourceId"){ + + if ($ResourceId -match $galImageRegex){ + + $subscriptionId = $($Matches['subscriptionId']) + $resourceGroupName = $($Matches['resourceGroupName']) + $resourceName = $($Matches['imageName']) + $null = $PSBoundParameters.Remove("ResourceId") + $PSBoundParameters.Add("Name", $resourceName) + $PSBoundParameters.Add("ResourceGroupName", $resourceGroupName) + $null = $PSBoundParameters.Remove("SubscriptionId") + $PSBoundParameters.Add("SubscriptionId", $subscriptionId) + + return Az.StackHCIVm.internal\Update-AzStackHCIVmGalleryImage @PSBoundParameters + + } elseif ($ResourceId -match $marketplaceGalImageRegex){ + $subscriptionId = $($Matches['subscriptionId']) + $resourceGroupName = $($Matches['resourceGroupName']) + $resourceName = $($Matches['imageName']) + $null = $PSBoundParameters.Remove("ResourceId") + $PSBoundParameters.Add("Name", $resourceName) + $PSBoundParameters.Add("ResourceGroupName", $resourceGroupName) + $null = $PSBoundParameters.Remove("SubscriptionId") + $PSBoundParameters.Add("SubscriptionId", $subscriptionId) + + return Az.StackHCIVm.internal\Update-AzStackHCIVmMarketplaceGalleryImage @PSBoundParameters + + } else { + Write-Error "Resource ID is invalid: $ResourceId" + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Update-AzStackHCIVMLogicalNetwork_ByResourceId.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Update-AzStackHCIVMLogicalNetwork_ByResourceId.ps1 new file mode 100644 index 000000000000..a01ffd01211d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Update-AzStackHCIVMLogicalNetwork_ByResourceId.ps1 @@ -0,0 +1,70 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update a logical network. +.Description +The operation to update a logical network. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmlogicalnetwork +#> +function Update-AzStackHCIVmLogicalNetwork_ByResourceId { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks])] +[CmdletBinding(PositionalBinding=$false)] + +param( + + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual network. + ${ResourceId}, + + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag} + + + +) + process { + + if ($ResourceId -match $lnetRegex){ + + $subscriptionId = $($Matches['subscriptionId']) + $resourceGroupName = $($Matches['resourceGroupName']) + $resourceName = $($Matches['logicalNetworkName']) + $null = $PSBoundParameters.Remove("ResourceId") + $PSBoundParameters.Add("Name", $resourceName) + $PSBoundParameters.Add("ResourceGroupName", $resourceGroupName) + $null = $PSBoundParameters.Remove("SubscriptionId") + $PSBoundParameters.Add("SubscriptionId", $subscriptionId) + + return Az.StackHCIVm\Update-AzStackHCIVmLogicalNetwork @PSBoundParameters + + } else { + Write-Error "Resource ID is invalid: $ResourceId" + } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Update-AzStackHCIVMNetworkInterface_ByResourceId.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Update-AzStackHCIVMNetworkInterface_ByResourceId.ps1 new file mode 100644 index 000000000000..0cb6800df3cb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Update-AzStackHCIVMNetworkInterface_ByResourceId.ps1 @@ -0,0 +1,68 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update a network interface. +.Description +The operation to update a network interface. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmnetworkinterface +#> +function Update-AzStackHCIVmNetworkInterface_ByResourceId { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces])] +[CmdletBinding(PositionalBinding=$false)] + +param( + + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the network interface. + ${ResourceId}, + + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag} + +) + process { + + if ($ResourceId -match $nicRegex){ + + $subscriptionId = $($Matches['subscriptionId']) + $resourceGroupName = $($Matches['resourceGroupName']) + $resourceName = $($Matches['nicName']) + $null = $PSBoundParameters.Remove("ResourceId") + $PSBoundParameters.Add("Name", $resourceName) + $PSBoundParameters.Add("ResourceGroupName", $resourceGroupName) + $null = $PSBoundParameters.Remove("SubscriptionId") + $PSBoundParameters.Add("SubscriptionId", $subscriptionId) + + return Az.StackHCIVm\Update-AzStackHCIVmNetworkInterface @PSBoundParameters + + } else { + Write-Error "Resource ID is invalid: $ResourceId" + } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Update-AzStackHCIVMStoragePath_ByResourceId.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Update-AzStackHCIVMStoragePath_ByResourceId.ps1 new file mode 100644 index 000000000000..834e78fa355b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Update-AzStackHCIVMStoragePath_ByResourceId.ps1 @@ -0,0 +1,70 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update a storage path. +.Description +The operation to update a storage path. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVStorageContainers + +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmstoragepath +#> +function Update-AzStackHCIVmStoragePath_ByResourceId { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers])] +[CmdletBinding(PositionalBinding=$false)] + +param( + + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the storage path. + ${ResourceId}, + + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag} + + + +) + process { + + if ($ResourceId -match $storagePathRegex){ + + $subscriptionId = $($Matches['subscriptionId']) + $resourceGroupName = $($Matches['resourceGroupName']) + $resourceName = $($Matches['storagePathName']) + $null = $PSBoundParameters.Remove("ResourceId") + $PSBoundParameters.Add("Name", $resourceName) + $PSBoundParameters.Add("ResourceGroupName", $resourceGroupName) + $null = $PSBoundParameters.Remove("SubscriptionId") + $PSBoundParameters.Add("SubscriptionId", $subscriptionId) + + return Az.StackHCIVm\Update-AzStackHCIVmStoragePath @PSBoundParameters + + } else { + Write-Error "Resource ID is invalid: $ResourceId" + } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Update-AzStackHCIVMVirtualHardDisk_ByResourceId.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Update-AzStackHCIVMVirtualHardDisk_ByResourceId.ps1 new file mode 100644 index 000000000000..bca2d9810845 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Update-AzStackHCIVMVirtualHardDisk_ByResourceId.ps1 @@ -0,0 +1,68 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update a virtual hard disk. +.Description +The operation to update a virtual hard disk. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks + +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmvirtualharddisks +#> +function Update-AzStackHCIVmVirtualHardDisk_ByResourceId { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks])] +[CmdletBinding(PositionalBinding=$false)] + +param( + + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual hard disk . + ${ResourceId}, + + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag} + +) + process { + + if ($ResourceId -match $vhdRegex){ + + $subscriptionId = $($Matches['subscriptionId']) + $resourceGroupName = $($Matches['resourceGroupName']) + $resourceName = $($Matches['vhdName']) + $null = $PSBoundParameters.Remove("ResourceId") + $PSBoundParameters.Add("Name", $resourceName) + $PSBoundParameters.Add("ResourceGroupName", $resourceGroupName) + $null = $PSBoundParameters.Remove("SubscriptionId") + $PSBoundParameters.Add("SubscriptionId", $subscriptionId) + + return Az.StackHCIVm\Update-AzStackHCIVmVirtualHardDisk @PSBoundParameters + + } else { + Write-Error "Resource ID is invalid: $ResourceId" + } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/Update-AzStackHCIVMVirtualMachine_New.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/Update-AzStackHCIVMVirtualMachine_New.ps1 new file mode 100644 index 000000000000..ca7bfddbf832 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/Update-AzStackHCIVMVirtualMachine_New.ps1 @@ -0,0 +1,209 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update a virtual machine instance. +.Description +The operation to update a virtual machine instance. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Notes +COMPLEX PARAMETER PROPERTIES + + + +NETWORKPROFILENETWORKINTERFACE : NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + [Id ]: ID - Resource ID of the network interface + +STORAGEPROFILEDATADISK : adds data disks to the virtual machine instance for the update call + [Id ]: +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmvirtualmachine +#> +function Update-AzStackHCIVmVirtualMachine { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] + [CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] + + param( + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual network. + ${ResourceId}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether virtual machine agent should be provisioned on the virtual machine. + ${ProvisionVMAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether virtual machine configuration agent should be provisioned on the virtual machine. + ${ProvisionVMConfigAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # RAM in MB for the virtual machine instance + ${VmMemoryInMB}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # number of processors for the virtual machine instance + ${VmProcessor}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum] + # . + ${VmSize}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + + + ) + process { + + if (($ResourceId -match $vmRegex) -or ($Name -and $ResourceGroupName -and $SubscriptionId)){ + if ($ResourceId -match $vmRegex){ + $SubscriptionId = $($Matches['subscriptionId']) + $ResourceGroupName = $($Matches['resourceGroupName']) + $Name = $($Matches['machineName']) + } + $resourceUri = "/subscriptions/" + $subscriptionId + "/resourceGroups/" + $ResourceGroupName + "/providers/Microsoft.HybridCompute/machines/" + $Name + $PSBoundParameters.Add("ResourceUri", $resourceUri) + if ($VmMemoryInMB) + { + $PSBoundParameters.Add("HardwareProfileMemoryMb", $VmMemoryInMB) + $null = $PSBoundParameters.Remove("VmMemoryInMB") + } + if ($VmProcessor) + { + $PSBoundParameters.Add("HardwareProfileProcessor", $VmProcessor) + $null = $PSBoundParameters.Remove("VmProcessor") + } + if ($VmSize) + { + $PSBoundParameters.Add("HardwareProfileVMSize", $VmSize) + $null = $PSBoundParameters.Remove("VmSize") + } + + if ($ProvisionVMAgent){ + $PSBoundParameters.Add("LinuxConfigurationProvisionVMAgent", $true) + $PSBoundParameters.Add("WindowConfigurationProvisionVMAgent", $true) + } + if ($ProvisionVMConfigAgent){ + $PSBoundParameters.Add("LinuxConfigurationProvisionVMConfigAgent", $true) + $PSBoundParameters.Add("WindowConfigurationProvisionVMConfigAgent", $true) + } + + $null = $PSBoundParameters.Remove("ProvisionVMAgent") + $null = $PSBoundParameters.Remove("ProvisionVMConfigAgent") + + + $null = $PSBoundParameters.Remove("SubscriptionId") + $null = $PSBoundParameters.Remove("ResourceGroupName") + $null = $PSBoundParameters.Remove("ResourceId") + $null = $PSBoundParameters.Remove("Name") + return Az.StackHCIVm.internal\Update-AzStackHCIVmVirtualMachine @PSBoundParameters + } 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" + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/utilities/NetworkInterfaceValidations.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/utilities/NetworkInterfaceValidations.ps1 new file mode 100644 index 000000000000..a08f692e3555 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/utilities/NetworkInterfaceValidations.ps1 @@ -0,0 +1,39 @@ +function Confirm-IpConfigrations{ +[Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.DoNotExportAttribute()] +param( + [Parameter()] + [System.Collections.Hashtable[]] + $IpConfigurations +) + foreach ($IpConfig in $IpConfigurations){ + foreach ($Key in $IpConfig.Keys){ + if($Key.ToLower() -eq "gateway"){ + if ($IpConfig[$Key] -notmatch $ipv4Regex){ + Write-Error "Invalid Gateway Address : $IpConfig[$Key]" -ErrorAction Stop + } + } elseif ($Key.ToLower() -eq "name"){ + + } elseif ($Key.ToLower() -eq "prefixlength"){ + if ($IpConfig[$Key] -gt 32 -and $IpConfig[$Key] -lt 0){ + Write-Error "Invalid Prefix Length : $IpConfig[$Key] " -ErrorAction Stop + } + } elseif ($Key.ToLower() -eq "ipaddress") { + if ($IpConfig[$Key] -notmatch $ipv4Regex){ + Write-Error "Invalid Ip Address provided : $IpConfig[$Key]" -ErrorAction Stop + } + } elseif ($Key.ToLower() -eq "ipallocationmethod"){ + if ($IpConfig[$Key].ToLower() -ne "dynamic" -and $IpConfig[$Key].ToLower() -ne "static"){ + Write-Error "Invalid Ip Allocation method provided: $IpConfig[$Key]. Accepted values are 'Dynamic' or 'Static'" -ErrorAction Stop + } + } elseif ($Key.ToLower() -eq "subnetid"){ + if ($IpConfig[$Key]-notmatch $vnetRegex){ + Write-Error "Invalid SubnetId: $IpConfig[$Key]" -ErrorAction Stop + } + } else { + Write-Error "Invalid Key specified in IpConfigurations object: $IpConfig[$Key]" -ErrorAction Stop + } + + } + } + +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/utilities/RegExValidations.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/utilities/RegExValidations.ps1 new file mode 100644 index 000000000000..5350b75b5998 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/utilities/RegExValidations.ps1 @@ -0,0 +1,26 @@ +$lnetRegex = "(?i)^/?subscriptions/(?[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})/resourceGroups/(?[-\w\._\(\)]{1,90})/providers/Microsoft.AzureStackHCI/logicalnetworks/(?[a-zA-Z0-9][-._a-zA-Z0-9]{0,62}[_a-zA-Z0-9])$" +$galImageRegex = "(?i)^/?subscriptions/(?[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})/resourceGroups/(?[-\w\._\(\)]{1,90})/providers/Microsoft.AzureStackHCI/galleryimages/(?[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[a-zA-Z0-9])$" +$marketplaceGalImageRegex = "(?i)^/?subscriptions/(?[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})/resourceGroups/(?[-\w\._\(\)]{1,90})/providers/Microsoft.AzureStackHCI/marketplacegalleryimages/(?[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[a-zA-Z0-9])$" +$vhdRegex = "(?i)^/?subscriptions/(?[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})/resourceGroups/(?[-\w\._\(\)]{1,90})/providers/Microsoft.AzureStackHCI/virtualharddisks/(?[-_a-zA-Z0-9]{1,80})$" +$nicRegex = "(?i)^/?subscriptions/(?[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})/resourceGroups/(?[-\w\._\(\)]{1,90})/providers/Microsoft.AzureStackHCI/networkinterfaces/(?[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9])$" +$vmRegex = "(?i)^/?subscriptions/(?[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})/resourceGroups/(?[-\w\._\(\)]{1,90})/providers/Microsoft.HybridCompute/machines/(?[a-zA-Z0-9][-._a-zA-Z0-9]{0,62}[a-zA-Z0-9])/providers/Microsoft.AzureStackHCI/VirtualMachineInstances/default$" +$storagePathRegex = "(?i)^/?subscriptions/(?[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})/resourceGroups/(?[-\w\._\(\)]{1,90})/providers/Microsoft.AzureStackHCI/storagecontainers/(?[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9])$" +$customLocationRegex = "(?i)^/?subscriptions/(?[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})/resourceGroups/(?[-\w\._\(\)]{1,90})/providers/Microsoft.ExtendedLocation/customLocations/(?[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9])$" + +$imageNameRegex = "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[a-zA-Z0-9]$" +$nicNameRegex = "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$" +$storagePathNameRegex = "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$" +$vhdNameRegex = "^[-_a-zA-Z0-9]{1,80}$" +$machineNameRegex = "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,62}[a-zA-Z0-9]$" +$vnetNameRegex = "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,62}[_a-zA-Z0-9]$" +$subnetNameRegex = "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$" + +$ipv4Regex = "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" +$cidrRegex = "^([0-9]{1,3}\.){3}[0-9]{1,3}\/\b(([0-9]|[1-2][0-9]|3[0-2]))?$" +$macAddressRegex = "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})|([0-9a-fA-F]{4}\\.[0-9a-fA-F]{4}\\.[0-9a-fA-F]{4})$" + +$allDigitsRegex = "^[0-9]$" +$invalidCharactersComputerName = "[`~!@#$%^&*()=+_\[\]\{\}\\|;:.'`"<>/?]" + + +$urnRegex = "(?i)^(?[-._a-zA-Z0-9]+):(?[-._a-zA-Z0-9]+):(?[-._a-zA-Z0-9]+):(?[-._a-zA-Z0-9]+)$" diff --git a/src/StackHCI/StackHCIVm.Autorest/custom/utilities/VirtualNetworkValidations.ps1 b/src/StackHCI/StackHCIVm.Autorest/custom/utilities/VirtualNetworkValidations.ps1 new file mode 100644 index 000000000000..e0ff796856e5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/custom/utilities/VirtualNetworkValidations.ps1 @@ -0,0 +1,104 @@ +function Confirm-IpPools{ +[Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.DoNotExportAttribute()] +param( + [Parameter()] + [System.Collections.Hashtable[]] + $IpPools +) + + foreach ($IpPool in $IpPools){ + foreach ($Key in $IpPool.Keys){ + if($Key.ToLower() -eq "end"){ + if ($IpPool[$Key] -notmatch $ipv4Regex){ + Write-Error "Invalid ipaddress provided for IpPoolEnd : $IpPool[$Key]." -ErrorAction Stop + } + } elseif ($Key.ToLower() -eq "start"){ + if ($IpPool[$Key] -notmatch $ipv4Regex){ + Write-Error "Invalid ipaddress provided for IpPoolStart : $IpPool[$Key]." -ErrorAction Stop + } + + } elseif($Key.ToLower() -eq "type"){ + if ($IpPool[$Key] -ne "vm" -and $IpPool[$Key] -ne "vippool"){ + Write-Error "Invalid IpPoolType provided: $IpPool[$Key]. Accepted values are 'vm' and 'vippool'." -ErrorAction Stop + } + + } else { + Write-Error "Invalid Key specified in IpPool object. Accpeted values are 'Start', 'End', and 'Type'." -ErrorAction Stop + } + } + } +} + +function Confirm-Routes{ +[Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.DoNotExportAttribute()] +param( + [Parameter()] + [System.Collections.Hashtable[]] + $Routes +) + + foreach ($Route in $Routes){ + foreach ($Key in $Route.Keys){ + if($Key.ToLower() -eq "addressprefix"){ + if ($Route[$Key] -notmatch $cidrRegex){ + Write-Error "Invalid ipaddress provided for AddressPrefix for route : $Route[$Key]." -ErrorAction Stop + } + } elseif ($Key.ToLower() -eq "name"){ + if ($Route[$Key] -notmatch $subnetNameRegex){ + Write-Error "Invalid subnet name provided for route: $Route[$Key]." -ErrorAction Stop + } + + } elseif($Key.ToLower() -eq "nexthopipaddress"){ + if ($Route[$Key] -notmatch $ipv4Regex){ + Write-Error "Invalid ipaddress provided for NextHopIPAddress for route: $Route[$Key]." -ErrorAction Stop + } + + } else { + Write-Error "Invalid Key specified in IpPool object. Accpeted values are 'AddressPrefix', 'Name', and 'NextHopIPAddress'." -ErrorAction Stop + } + } + } +} + +function Confirm-Subnets{ +[Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.DoNotExportAttribute()] +param( + [Parameter()] + [System.Collections.Hashtable[]] + $Subnets +) + foreach ($Subnet in $Subnets){ + foreach ($Key in $Subnet.Keys){ + if($Key.ToLower() -eq "addressprefix"){ + if ($Subnet[$Key] -notmatch $cidrRegex){ + Write-Error "Invalid ipaddress provided for AddressPrefix for subnet : $Subnet[$Key]." -ErrorAction Stop + } + } elseif ($Key.ToLower() -eq "ipallocationmethod"){ + if ($Subnet[$Key] -ne "Dynamic" -and $Subnet[$Key] -ne "Static"){ + Write-Error "Invalid Ip Allocation method provided: $IpAllocationMethod. Accepted values are 'Dynamic' or 'Static'" -ErrorAction Stop + } + } elseif ($Key.ToLower() -eq "ippool"){ + Confirm-IpPools -IpPools $Subnet[$Key] + } elseif ($Key.ToLower() -eq "addressprefixes"){ + foreach ($addressPrefix in $Subnet[$Key]){ + if ($addressPrefix -notmatch $cidrRegex){ + Write-Error "Invalid AddressPrefix: $addressPrefix. Please use valid CIDR format." -ErrorAction Stop + } + } + } elseif ($Key.ToLower() -eq "name"){ + if ($Subnet[$Key] -notmatch $subnetNameRegex){ + Write-Error "Invalid SubnetName: $Subnet[$Key]. The name must start with an alphanumeric character, contain all alphanumeric characters or '-' or '_' or '.' and end with an alphanumeric character or '_'. The max length is 80 characters." -ErrorAction Stop + } + } elseif ($Key.ToLower() -eq "route"){ + Confirm-Routes -Routes $Subnet[$Key] + } elseif ($Key.ToLower() -eq "vlan"){ + if ($Subnet[$Key] -gt 4094 -or $Subnet[$Key] -lt 1){ + Write-Error "Invalid value for Vlan : $Subnet[$Key]. Valid range is 1-4094" + } + } else { + Write-Error "Invalid Key specified in Subnet object: $Subnet." + } + + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Add-AzStackHCIVmVirtualMachineDataDisk.md b/src/StackHCI/StackHCIVm.Autorest/docs/Add-AzStackHCIVmVirtualMachineDataDisk.md new file mode 100644 index 000000000000..34ef6d5e12fe --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Add-AzStackHCIVmVirtualMachineDataDisk.md @@ -0,0 +1,198 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/add-azstackhcivmvirtualmachinedatadisk +schema: 2.0.0 +--- + +# Add-AzStackHCIVmVirtualMachineDataDisk + +## SYNOPSIS +The operation to add a data disk to a virtual machine. + +## SYNTAX + +### ByResourceId (Default) +``` +Add-AzStackHCIVmVirtualMachineDataDisk -ResourceId [-DataDiskId ] + [-DataDiskName ] [-DataDiskResourceGroup ] [-Confirm] [-WhatIf] [] +``` + +### ByName +``` +Add-AzStackHCIVmVirtualMachineDataDisk -Name -ResourceGroupName [-SubscriptionId ] + [-DataDiskId ] [-DataDiskName ] [-DataDiskResourceGroup ] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +The operation to add a data disk to a virtual machine. + +## EXAMPLES + +### Example 1: Add a Data Disk to a Virtual Machine +```powershell + Add-AzStackHCIVmVirtualMachineDataDisk -Name 'testVm' -ResourceGroupName 'test-rg' -DataDiskName 'testVhd' + +``` + +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` + +This command attaches a data disk to the virtual machine in the specified resource group. + +## PARAMETERS + +### -DataDiskId +List of data disks to be attached to the virtual machine passed in Id format + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataDiskName +List of data disks to be attached to the virtual machine passed by Name + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataDiskResourceGroup +Resource Group of the Data Disks + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual machine + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: VirtualMachineName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the VM + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Add-AzStackHCIVmVirtualMachineNetworkInterface.md b/src/StackHCI/StackHCIVm.Autorest/docs/Add-AzStackHCIVmVirtualMachineNetworkInterface.md new file mode 100644 index 000000000000..7e03806e9abc --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Add-AzStackHCIVmVirtualMachineNetworkInterface.md @@ -0,0 +1,198 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/add-azstackhcivmvirtualmachinenetworkinterface +schema: 2.0.0 +--- + +# Add-AzStackHCIVmVirtualMachineNetworkInterface + +## SYNOPSIS +The operation to add a network interface to a virtual machine. + +## SYNTAX + +### ByResourceId (Default) +``` +Add-AzStackHCIVmVirtualMachineNetworkInterface -ResourceId [-NicId ] [-NicName ] + [-NicResourceGroup ] [-Confirm] [-WhatIf] [] +``` + +### ByName +``` +Add-AzStackHCIVmVirtualMachineNetworkInterface -Name -ResourceGroupName + [-SubscriptionId ] [-NicId ] [-NicName ] [-NicResourceGroup ] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +The operation to add a network interface to a virtual machine. + +## EXAMPLES + +### Example 1: Add a Network Interface to a Virtual Machine +```powershell +Add-AzStackHCIVmVirtualMachineNetworkInterface -Name 'testVm' -ResourceGroupName 'test-rg' -NicName 'testNic' + +``` + +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` + +This command attaches a network interface to the virtual machine in the specified resource group. + +## PARAMETERS + +### -Name +Name of the virtual machine + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: VirtualMachineName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicId +NetworkInterfaces - list of network interfaces to be attached to the virtual machine in id format + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicName +NetworkInterfaces - list of network interfaces to be attached to the virtual machine in name format + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicResourceGroup +Resource Group of the Network Interfaces + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Id of the Virtual Machine + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Az.StackHCIVm.md b/src/StackHCI/StackHCIVm.Autorest/docs/Az.StackHCIVm.md new file mode 100644 index 000000000000..025d869882d2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Az.StackHCIVm.md @@ -0,0 +1,112 @@ +--- +Module Name: Az.StackHCIVm +Module Guid: 7389f67c-ec9d-4c13-9c9a-308834413af6 +Download Help Link: https://learn.microsoft.com/powershell/module/az.stackhcivm +Help Version: 1.0.0.0 +Locale: en-US +--- + +# Az.StackHCIVm Module +## Description +Microsoft Azure PowerShell: StackHciVM cmdlets + +## Az.StackHCIVm Cmdlets +### [Add-AzStackHCIVmVirtualMachineDataDisk](Add-AzStackHCIVmVirtualMachineDataDisk.md) +The operation to add a data disk to a virtual machine. + +### [Add-AzStackHCIVmVirtualMachineNetworkInterface](Add-AzStackHCIVmVirtualMachineNetworkInterface.md) +The operation to add a network interface to a virtual machine. + +### [Get-AzStackHCIVmImage](Get-AzStackHCIVmImage.md) +Gets a gallery image + +### [Get-AzStackHCIVmLogicalNetwork](Get-AzStackHCIVmLogicalNetwork.md) +Gets a logical network + +### [Get-AzStackHCIVmNetworkInterface](Get-AzStackHCIVmNetworkInterface.md) +Gets a network interface + +### [Get-AzStackHCIVmStoragePath](Get-AzStackHCIVmStoragePath.md) +Gets a storage container + +### [Get-AzStackHCIVmVirtualHardDisk](Get-AzStackHCIVmVirtualHardDisk.md) +Gets a virtual hard disk + +### [Get-AzStackHCIVmVirtualMachine](Get-AzStackHCIVmVirtualMachine.md) +Gets a virtual machine + +### [New-AzStackHCIVmImage](New-AzStackHCIVmImage.md) +The operation to create an image. +Please note some properties can be set only during image creation. + +### [New-AzStackHCIVmLogicalNetwork](New-AzStackHCIVmLogicalNetwork.md) +The operation to create or update a logical network. +Please note some properties can be set only during logical network creation. + +### [New-AzStackHCIVmNetworkInterface](New-AzStackHCIVmNetworkInterface.md) +The operation to create or update a network interface. +Please note some properties can be set only during network interface creation. + +### [New-AzStackHCIVmStoragePath](New-AzStackHCIVmStoragePath.md) +The operation to create or update a storage container. +Please note some properties can be set only during storage container creation. + +### [New-AzStackHCIVmVirtualHardDisk](New-AzStackHCIVmVirtualHardDisk.md) +The operation to create or update a virtual hard disk. +Please note some properties can be set only during virtual hard disk creation. + +### [New-AzStackHCIVmVirtualMachine](New-AzStackHCIVmVirtualMachine.md) +The operation to create or update a virtual machine. +Please note some properties can be set only during virtual machine creation. + +### [Remove-AzStackHCIVmImage](Remove-AzStackHCIVmImage.md) +The operation to delete an image. + +### [Remove-AzStackHCIVmLogicalNetwork](Remove-AzStackHCIVmLogicalNetwork.md) +The operation to delete a logical network. + +### [Remove-AzStackHCIVmNetworkInterface](Remove-AzStackHCIVmNetworkInterface.md) +The operation to delete a network interface. + +### [Remove-AzStackHCIVmStoragePath](Remove-AzStackHCIVmStoragePath.md) +The operation to delete a storage container. + +### [Remove-AzStackHCIVmVirtualHardDisk](Remove-AzStackHCIVmVirtualHardDisk.md) +The operation to delete a virtual hard disk. + +### [Remove-AzStackHCIVmVirtualMachine](Remove-AzStackHCIVmVirtualMachine.md) +The operation to delete a virtual machine. + +### [Remove-AzStackHCIVmVirtualMachineDataDisk](Remove-AzStackHCIVmVirtualMachineDataDisk.md) +The operation to delete a data disk from a virtual machine. + +### [Remove-AzStackHCIVmVirtualMachineNetworkInterface](Remove-AzStackHCIVmVirtualMachineNetworkInterface.md) +The operation to delete a network interface from a virtual machine. + +### [Restart-AzStackHCIVmVirtualMachine](Restart-AzStackHCIVmVirtualMachine.md) +The operation to restart a virtual machine instance. + +### [Start-AzStackHCIVmVirtualMachine](Start-AzStackHCIVmVirtualMachine.md) +The operation to start a virtual machine instance. + +### [Stop-AzStackHCIVmVirtualMachine](Stop-AzStackHCIVmVirtualMachine.md) +The operation to stop a virtual machine instance. + +### [Update-AzStackHCIVmImage](Update-AzStackHCIVmImage.md) +The operation to update an image. + +### [Update-AzStackHCIVmLogicalNetwork](Update-AzStackHCIVmLogicalNetwork.md) +The operation to update a logical network. + +### [Update-AzStackHCIVmNetworkInterface](Update-AzStackHCIVmNetworkInterface.md) +The operation to update a network interface. + +### [Update-AzStackHCIVmStoragePath](Update-AzStackHCIVmStoragePath.md) +The operation to update a storage container. + +### [Update-AzStackHCIVmVirtualHardDisk](Update-AzStackHCIVmVirtualHardDisk.md) +The operation to update a virtual hard disk. + +### [Update-AzStackHCIVmVirtualMachine](Update-AzStackHCIVmVirtualMachine.md) +The operation to update a virtual machine instance. + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Get-AzStackHCIVmImage.md b/src/StackHCI/StackHCIVm.Autorest/docs/Get-AzStackHCIVmImage.md new file mode 100644 index 000000000000..4bc21fef371c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Get-AzStackHCIVmImage.md @@ -0,0 +1,176 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmimage +schema: 2.0.0 +--- + +# Get-AzStackHCIVmImage + +## SYNOPSIS +Gets a gallery image + +## SYNTAX + +### BySubscription (Default) +``` +Get-AzStackHCIVmImage [-SubscriptionId ] [-DefaultProfile ] [-NoWait] [] +``` + +### ByName +``` +Get-AzStackHCIVmImage -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [-NoWait] [] +``` + +### ByResourceGroup +``` +Get-AzStackHCIVmImage -ResourceGroupName [-SubscriptionId ] [-DefaultProfile ] + [-NoWait] [] +``` + +### ByResourceId +``` +Get-AzStackHCIVmImage -ResourceId [-SubscriptionId ] [-DefaultProfile ] [-NoWait] + [] +``` + +## DESCRIPTION +Gets a gallery image + +## EXAMPLES + +### Example 1: Get an Image +```powershell +Get-AzStackHCIVmImage -Name "testimage" -ResourceGroupName "test-rg" +``` + +```output +Name ResourceGroupName +---- ----------------- +testImage test-rg +``` + +This command gets a specific image in the specified resource group. + +### Example 2: List all Images in a Resource Group +```powershell +Get-AzStackHCIVmImage -ResourceGroupName 'test-rg' +``` + +```output +Name ResourceGroupName +---- ----------------- +testImage test-rg +``` + +This command lists all images in the specified resource group. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the image + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName, ByResourceGroup +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource Id of the Image + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Get-AzStackHCIVmLogicalNetwork.md b/src/StackHCI/StackHCIVm.Autorest/docs/Get-AzStackHCIVmLogicalNetwork.md new file mode 100644 index 000000000000..9502cb624488 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Get-AzStackHCIVmLogicalNetwork.md @@ -0,0 +1,175 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmlogicalnetwork +schema: 2.0.0 +--- + +# Get-AzStackHCIVmLogicalNetwork + +## SYNOPSIS +Gets a logical network + +## SYNTAX + +### List1 (Default) +``` +Get-AzStackHCIVmLogicalNetwork [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### ByResourceId +``` +Get-AzStackHCIVmLogicalNetwork [-ResourceId ] [-DefaultProfile ] [-NoWait] + [] +``` + +### Get +``` +Get-AzStackHCIVmLogicalNetwork -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### List +``` +Get-AzStackHCIVmLogicalNetwork -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets a logical network + +## EXAMPLES + +### Example 1: Get a Logical Network +```powershell +Get-AzStackHCIVmLogicalNetwork -Name 'testLnet' -ResourceGroupName 'test-rg' +``` + +```output +Name ResourceGroupName +---- ----------------- +testLnet test-rg +``` + +This command gets a specific logical network in the specified resource group. + +### Example 2: List all Logical Networks in a Resource Group +```powershell +Get-AzStackHCIVmLogicalNetwork -ResourceGroupName 'test-rg' +``` + +```output +Name ResourceGroupName +---- ----------------- +testLnet test-rg +``` + +This command lists all logical networks in the specified resource group. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the logical network + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: LogicalNetworkName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM ID of the logical network. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Get-AzStackHCIVmNetworkInterface.md b/src/StackHCI/StackHCIVm.Autorest/docs/Get-AzStackHCIVmNetworkInterface.md new file mode 100644 index 000000000000..4fa11cb78325 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Get-AzStackHCIVmNetworkInterface.md @@ -0,0 +1,176 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmnetworkinterface +schema: 2.0.0 +--- + +# Get-AzStackHCIVmNetworkInterface + +## SYNOPSIS +Gets a network interface + +## SYNTAX + +### List1 (Default) +``` +Get-AzStackHCIVmNetworkInterface [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### ByResourceId +``` +Get-AzStackHCIVmNetworkInterface [-ResourceId ] [-DefaultProfile ] [-NoWait] + [] +``` + +### Get +``` +Get-AzStackHCIVmNetworkInterface -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### List +``` +Get-AzStackHCIVmNetworkInterface -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets a network interface + +## EXAMPLES + +### Example 1: Get a Network Interface +```powershell +Get-AzStackHCIVmNetworkInterface -Name 'testNic' -ResourceGroupName 'test-rg' +``` + +```output +Name ResourceGroupName +---- ----------------- +testNic test-rg +``` + +This command gets a specific network interface in the specified resource group. + +### Example 2: List all Logical Networks in a Resource Group +```powershell +Get-AzStackHCIVmNetworkInterface -ResourceGroupName 'test-rg' +``` + +```output +Name ResourceGroupName +---- ----------------- +testNic test-rg +``` + +This command lists all network interfaces in the specified resource group. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the network interface + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: NetworkInterfaceName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Id of the network interface. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Get-AzStackHCIVmStoragePath.md b/src/StackHCI/StackHCIVm.Autorest/docs/Get-AzStackHCIVmStoragePath.md new file mode 100644 index 000000000000..57cb41eaa88a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Get-AzStackHCIVmStoragePath.md @@ -0,0 +1,174 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmstoragepath +schema: 2.0.0 +--- + +# Get-AzStackHCIVmStoragePath + +## SYNOPSIS +Gets a storage container + +## SYNTAX + +### List1 (Default) +``` +Get-AzStackHCIVmStoragePath [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### ByResourceId +``` +Get-AzStackHCIVmStoragePath [-ResourceId ] [-DefaultProfile ] [-NoWait] [] +``` + +### Get +``` +Get-AzStackHCIVmStoragePath -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### List +``` +Get-AzStackHCIVmStoragePath -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets a storage container + +## EXAMPLES + +### Example 1: Get a Storage Path +```powershell +Get-AzStackHCIVmStoragePath -Name "testStoragePath" -ResourceGroupName "test-rg" +``` + +```output +Name ResourceGroupName +---- ----------------- +testStoragePath test-rg +``` + +This command gets a specific storage path in the specified resource group. + +### Example 2: List all Storage Paths in a Resource Group +```powershell +Get-AzStackHCIVmStoragePath -ResourceGroupName "test-rg" +``` + +```output +Name ResourceGroupName +---- ----------------- +testStoragePath test-rg +``` + +This command lists all storage paths in the specified resource group. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the storage container + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: StorageContainerName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM ID of the storage path. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Get-AzStackHCIVmVirtualHardDisk.md b/src/StackHCI/StackHCIVm.Autorest/docs/Get-AzStackHCIVmVirtualHardDisk.md new file mode 100644 index 000000000000..b506623e8a78 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Get-AzStackHCIVmVirtualHardDisk.md @@ -0,0 +1,175 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmvirtualharddisk +schema: 2.0.0 +--- + +# Get-AzStackHCIVmVirtualHardDisk + +## SYNOPSIS +Gets a virtual hard disk + +## SYNTAX + +### List1 (Default) +``` +Get-AzStackHCIVmVirtualHardDisk [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### ByResourceId +``` +Get-AzStackHCIVmVirtualHardDisk [-ResourceId ] [-DefaultProfile ] [-NoWait] + [] +``` + +### Get +``` +Get-AzStackHCIVmVirtualHardDisk -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### List +``` +Get-AzStackHCIVmVirtualHardDisk -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets a virtual hard disk + +## EXAMPLES + +### Example 1: Get a Virtual Hard Disk +```powershell +Get-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" +``` + +```output +Name ResourceGroupName +---- ----------------- +testVhd test-rg +``` + +This command gets a specific virtual hard disk in the specified resource group. + +### Example 2: List all Virtual Hard Disks in a Resource Group +```powershell +Get-AzStackHCIVmVirtualHardDisk -ResourceGroupName "test-rg" +``` + +```output +Name ResourceGroupName +---- ----------------- +testVhd test-rg +``` + +This command lists all virtual hard disks in the specified resource group. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual hard disk + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: VirtualHardDiskName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM ID of the virtual hard disk. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Get-AzStackHCIVmVirtualMachine.md b/src/StackHCI/StackHCIVm.Autorest/docs/Get-AzStackHCIVmVirtualMachine.md new file mode 100644 index 000000000000..40691bf8978e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Get-AzStackHCIVmVirtualMachine.md @@ -0,0 +1,208 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmvirtualmachine +schema: 2.0.0 +--- + +# Get-AzStackHCIVmVirtualMachine + +## SYNOPSIS +Gets a virtual machine + +## SYNTAX + +### BySubscription (Default) +``` +Get-AzStackHCIVmVirtualMachine [-SubscriptionId ] [-DefaultProfile ] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### ByName +``` +Get-AzStackHCIVmVirtualMachine -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### ByResourceGroup +``` +Get-AzStackHCIVmVirtualMachine -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### ByResourceId +``` +Get-AzStackHCIVmVirtualMachine -ResourceId [-DefaultProfile ] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +Gets a virtual machine + +## EXAMPLES + +### Example 2: Get a Virtual Machine. +```powershell +Get-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" +``` + +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` + +This commnad gets a virtual machine in a specified resource group. + +### Example 2: List Virtual Machines in a Resource Group +```powershell +Get-AzStackHCIVmVirtualMachine -ResourceGroupName "test-rg" +``` + +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` + +This command lists all virtual machines in a resource group. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual machine + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: VirtualMachineName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName, ByResourceGroup +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM ID of the virtual machine. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: ByName, ByResourceGroup, BySubscription +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.Machine + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/New-AzStackHCIVmImage.md b/src/StackHCI/StackHCIVm.Autorest/docs/New-AzStackHCIVmImage.md new file mode 100644 index 000000000000..71d74836c56f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/New-AzStackHCIVmImage.md @@ -0,0 +1,441 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmimage +schema: 2.0.0 +--- + +# New-AzStackHCIVmImage + +## SYNOPSIS +The operation to create an image. +Please note some properties can be set only during image creation. + +## SYNTAX + +### MarketplaceURN (Default) +``` +New-AzStackHCIVmImage -Name -ResourceGroupName -CustomLocationId -Location + -OSType -URN [-SubscriptionId ] + [-CloudInitDataSource ] [-StoragePathId ] [-StoragePathName ] + [-StoragePathResourceGroup ] [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] + [-Confirm] [-WhatIf] [] +``` + +### GalleryImage +``` +New-AzStackHCIVmImage -Name -ResourceGroupName -CustomLocationId + -ImagePath -Location -OSType [-SubscriptionId ] + [-CloudInitDataSource ] [-StoragePathId ] [-StoragePathName ] + [-StoragePathResourceGroup ] [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] + [-Confirm] [-WhatIf] [] +``` + +### Marketplace +``` +New-AzStackHCIVmImage -Name -ResourceGroupName -CustomLocationId -Location + -Offer -OSType -Publisher -Sku -Version + [-SubscriptionId ] [-CloudInitDataSource ] [-StoragePathId ] + [-StoragePathName ] [-StoragePathResourceGroup ] [-Tag ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to create an image. +Please note some properties can be set only during image creation. + +## EXAMPLES + +### Example 1: Create a Gallery Image +```powershell +New-AzStackHCIVmImage -Name "testImage" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -ImagePath "C:\ClusterStorage\Volume1\Ubunut.vhdx" -OSType "Linux" -Location "eastus" +``` + +```output +Name ResourceGroupName +---- ----------------- +testImage test-rg +``` + +This command creates a gallery image from a local path. + +### Example 2: Create a Marketplace Gallery Image +```powershell +New-AzStackHCIVmImage -Name "testMarketplaceImage" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -Offer "windowsserver" -Publisher "MicrosoftWindowsServer" -Sku "2022-Datacenter" -Version "latest" -OSType "Windows" +``` + +```output +Name ResourceGroupName +---- ----------------- +testMarketplaceImage test-rg +``` + +This command creates a marketplace gallery image using the specified offer , publisher, sku and version. + +### Example 3: {Create a Marketplace Gallery Image From URN +```powershell +New-AzStackHCIVmImage -Name "testMarketplaceImageURN" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -URN "microsoftwindowsserver:windowsserver:2022-datacenter:latest" -OSType "Windows" +``` + +```output +Name ResourceGroupName +---- ----------------- +testMarketplaceImageURN test-rg +``` + +This command creates a marketplace gallery image using the specified urn. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CloudInitDataSource +Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomLocationId +The ARM Id of the extended location to create image resource in. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ImagePath +Local path of image that the image should be created from. + +This parameter is required for non marketplace images. + +```yaml +Type: System.String +Parameter Sets: GalleryImage +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +The geo-location where the resource lives + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the Image +The name must start and end with an alphanumeric character and must contain all alphanumeric characters or ‘-‘, ‘.’, or ‘_’. +The max length can be 80 characters and the minimum length is 1 character. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: ImageName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Offer +The name of the marketplae gallery image definition offer. + +```yaml +Type: System.String +Parameter Sets: Marketplace +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OSType +Operating system type that the gallery image uses [Windows, Linux] + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Publisher +The name of the marketplace gallery image definition publisher. + +```yaml +Type: System.String +Parameter Sets: Marketplace +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Sku +The name of the marketplace gallery image definition SKU. + +```yaml +Type: System.String +Parameter Sets: Marketplace +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoragePathId +Storage ContainerID of the storage container to be used for gallery image + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoragePathName +Storage Container Name of the storage container to be used for gallery image + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoragePathResourceGroup +Resource Group of the Storage Path. +The Default value is the Resource Group of the Image. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -URN +The URN of the marketplace gallery image. + +```yaml +Type: System.String +Parameter Sets: MarketplaceURN +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Version +The version of the marketplace gallery image. + +```yaml +Type: System.String +Parameter Sets: Marketplace +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/New-AzStackHCIVmLogicalNetwork.md b/src/StackHCI/StackHCIVm.Autorest/docs/New-AzStackHCIVmLogicalNetwork.md new file mode 100644 index 000000000000..12e7c1df5a18 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/New-AzStackHCIVmLogicalNetwork.md @@ -0,0 +1,406 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmlogicalnetwork +schema: 2.0.0 +--- + +# New-AzStackHCIVmLogicalNetwork + +## SYNOPSIS +The operation to create or update a logical network. +Please note some properties can be set only during logical network creation. + +## SYNTAX + +``` +New-AzStackHCIVmLogicalNetwork -Name -ResourceGroupName -CustomLocationId + -Location [-SubscriptionId ] [-AddressPrefix ] [-DnsServer ] + [-IpAllocationMethod ] [-IpPool ] [-IpPoolEnd ] [-IpPoolStart ] + [-IpPoolType ] [-Route ] [-Subnet ] [-SubnetName ] + [-Tag ] [-Vlan ] [-VMSwitchName ] [-DefaultProfile ] [-AsJob] [-NoWait] + [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to create or update a logical network. +Please note some properties can be set only during logical network creation. + +## EXAMPLES + +### Example 1: Create a Logical Network +```powershell +New-AzStackHCIVmLogicalNetwork -Name "testLnet" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -VmSwitchName "testswitch" +``` + +```output +Name ResourceGroupName +---- ----------------- +testLnet test-rg +``` + +This command creates a logical network in the specified resource group. + +## PARAMETERS + +### -AddressPrefix +List of address prefixes for the subnet. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomLocationId +The name of the extended location. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DnsServer +The list of DNS servers IP addresses. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IpAllocationMethod +The IP address allocation method. +Possible values include: 'Static', 'Dynamic' + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IpPool +Network associated pool of IP Addresses + +```yaml +Type: System.Collections.Hashtable[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IpPoolEnd +End of the ip address pool + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IpPoolStart +Start of the ip address pool + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IpPoolType +Ip pool type + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +The geo-location where the resource lives + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual network + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: LogicalNetworkName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Route +Collection of routes contained within a route table. + +```yaml +Type: System.Collections.Hashtable[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Subnet +List of subnets under the virtual network + +```yaml +Type: System.Collections.Hashtable[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubnetName +Name of the subnet + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Vlan +Vlan to use for the subnet + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VMSwitchName +Name of the network switch to be used for VMs + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/New-AzStackHCIVmNetworkInterface.md b/src/StackHCI/StackHCIVm.Autorest/docs/New-AzStackHCIVmNetworkInterface.md new file mode 100644 index 000000000000..1d3214a9dfe2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/New-AzStackHCIVmNetworkInterface.md @@ -0,0 +1,329 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmnetworkinterface +schema: 2.0.0 +--- + +# New-AzStackHCIVmNetworkInterface + +## SYNOPSIS +The operation to create or update a network interface. +Please note some properties can be set only during network interface creation. + +## SYNTAX + +``` +New-AzStackHCIVmNetworkInterface -Name -ResourceGroupName -CustomLocationId + -Location [-SubscriptionId ] [-DnsServer ] [-IpAddress ] + [-IpConfiguration ] [-MacAddress ] [-SubnetId ] [-SubnetName ] + [-SubnetResourceGroup ] [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +The operation to create or update a network interface. +Please note some properties can be set only during network interface creation. + +## EXAMPLES + +### Example 1: Create a Network Interface +```powershell +New-AzStackHCIVmNetworkInterface -Name "testNic" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -SubnetName "testLnet" +``` + +```output +Name ResourceGroupName +---- ----------------- +testNic test-rg +``` + +This command creates a network interface in the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomLocationId +The name of the extended location. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DnsServer +List of DNS server IP Addresses for the interface + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IpAddress +PrivateIPAddress - Private IP address of the IP configuration. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IpConfiguration +A list of IPConfigurations of the network interface. + +```yaml +Type: System.Collections.Hashtable[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +The geo-location where the resource lives + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MacAddress +MacAddress - The MAC address of the network interface. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the Network Interface + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: NetworkInterfaceName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubnetId +The ARM resource id of the Subnet. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubnetName +The name of the Subnet. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubnetResourceGroup +Resource Group of the Subnet. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/New-AzStackHCIVmStoragePath.md b/src/StackHCI/StackHCIVm.Autorest/docs/New-AzStackHCIVmStoragePath.md new file mode 100644 index 000000000000..fe4494c3a993 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/New-AzStackHCIVmStoragePath.md @@ -0,0 +1,237 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmstoragepath +schema: 2.0.0 +--- + +# New-AzStackHCIVmStoragePath + +## SYNOPSIS +The operation to create or update a storage container. +Please note some properties can be set only during storage container creation. + +## SYNTAX + +``` +New-AzStackHCIVmStoragePath -Name -ResourceGroupName -Location + [-SubscriptionId ] [-CustomLocationId ] [-Path ] [-Tag ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to create or update a storage container. +Please note some properties can be set only during storage container creation. + +## EXAMPLES + +### Example 1: Create a Storage Path +```powershell +New-AzStackHCIVmStoragePath -Name "testStoragePath" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}"-Location "eastus" -Path "C:\ClusterStorage\Volume1\testpath" +``` + +```output +Name ResourceGroupName +---- ----------------- +testStoragePath test-rg +``` + +This command creates a storage path in the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomLocationId +The name of the extended location. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +The geo-location where the resource lives + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the storage container + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: StorageContainerName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Path +Path of the storage container on the disk + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/New-AzStackHCIVmVirtualHardDisk.md b/src/StackHCI/StackHCIVm.Autorest/docs/New-AzStackHCIVmVirtualHardDisk.md new file mode 100644 index 000000000000..10223145b2ce --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/New-AzStackHCIVmVirtualHardDisk.md @@ -0,0 +1,378 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmvirtualharddisk +schema: 2.0.0 +--- + +# New-AzStackHCIVmVirtualHardDisk + +## SYNOPSIS +The operation to create or update a virtual hard disk. +Please note some properties can be set only during virtual hard disk creation. + +## SYNTAX + +``` +New-AzStackHCIVmVirtualHardDisk -Name -ResourceGroupName -CustomLocationId + -Location [-SubscriptionId ] [-BlockSizeByte ] [-DiskFileFormat ] + [-Dynamic] [-HyperVGeneration ] [-LogicalSectorByte ] [-PhysicalSectorByte ] + [-SizeGb ] [-StoragePathId ] [-StoragePathName ] [-StoragePathResourceGroup ] + [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to create or update a virtual hard disk. +Please note some properties can be set only during virtual hard disk creation. + +## EXAMPLES + +### Example 1: Create a Virtual Hard Disk +```powershell +New-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -SizeGb 2 +``` + +```output +Name ResourceGroupName +---- ----------------- +testVhd test-rg +``` + +This command creates a virtual hard disk in the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BlockSizeByte +The block size, in bytes, of the virtual hard disk. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomLocationId +The ARM Id of the extended location to create virtual hard disk resource in. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DiskFileFormat +The format of the actual VHD file [vhd, vhdx] + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Dynamic +Boolean for enabling dynamic sizing on the virtual hard disk + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -HyperVGeneration +The hypervisor generation of the Virtual Machine [V1, V2] + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +The geo-location where the resource lives + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -LogicalSectorByte +Logical Sector Bytes of the Disk + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual hard disk. + +Must contain all alphanumeric characters or ‘-’ or ‘_’. +Max length is 80 characters, and min length is 1 character. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: VirtualHardDiskName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PhysicalSectorByte +Physical Sector Bytes of the Disk + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SizeGb +Size of the disk in GB + +```yaml +Type: System.Int64 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoragePathId +Storage ContainerID of the storage container to be used for VHD + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoragePathName +Storage Container Name to be used for the VHD + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoragePathResourceGroup +Storage Container resource group. +The resource group of the virtual hard disk will be used if this value is not provided. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/New-AzStackHCIVmVirtualMachine.md b/src/StackHCI/StackHCIVm.Autorest/docs/New-AzStackHCIVmVirtualMachine.md new file mode 100644 index 000000000000..6c44de999608 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/New-AzStackHCIVmVirtualMachine.md @@ -0,0 +1,809 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmvirtualmachine +schema: 2.0.0 +--- + +# New-AzStackHCIVmVirtualMachine + +## SYNOPSIS +The operation to create or update a virtual machine. +Please note some properties can be set only during virtual machine creation. + +## SYNTAX + +### ByImageId (Default) +``` +New-AzStackHCIVmVirtualMachine -Name -ResourceGroupName -CustomLocationId + -ImageId -Location -OsType [-SubscriptionId ] [-AdminPassword ] + [-AdminUsername ] [-ComputerName ] [-DataDiskId ] [-DataDiskName ] + [-DataDiskResourceGroup ] [-DisablePasswordAuthentication] [-DynamicMemoryMaximumMemoryInMb ] + [-DynamicMemoryMinimumMemoryInMb ] [-DynamicMemoryTargetBuffer ] [-EnableAutomaticUpdate] + [-EnableTpm] [-IdentityType ] [-NicId ] [-NicName ] + [-NicResourceGroup ] [-ProvisionVMAgent] [-ProvisionVMConfigAgent] [-SecureBootEnabled] + [-SshPublicKey ] [-StoragePathId ] [-StoragePathName ] + [-StoragePathResourceGroup ] [-Tag ] [-TimeZone ] [-VmMemoryInMB ] + [-VmProcessor ] [-VmSize ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### ByImageName +``` +New-AzStackHCIVmVirtualMachine -Name -ResourceGroupName -CustomLocationId + -ImageName -Location -OsType [-SubscriptionId ] [-AdminPassword ] + [-AdminUsername ] [-ComputerName ] [-DataDiskId ] [-DataDiskName ] + [-DataDiskResourceGroup ] [-DisablePasswordAuthentication] [-DynamicMemoryMaximumMemoryInMb ] + [-DynamicMemoryMinimumMemoryInMb ] [-DynamicMemoryTargetBuffer ] [-EnableAutomaticUpdate] + [-EnableTpm] [-IdentityType ] [-ImageResourceGroup ] [-NicId ] + [-NicName ] [-NicResourceGroup ] [-ProvisionVMAgent] [-ProvisionVMConfigAgent] + [-SecureBootEnabled] [-SshPublicKey ] [-StoragePathId ] [-StoragePathName ] + [-StoragePathResourceGroup ] [-Tag ] [-TimeZone ] [-VmMemoryInMB ] + [-VmProcessor ] [-VmSize ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### ByOsDiskId +``` +New-AzStackHCIVmVirtualMachine -Name -ResourceGroupName -CustomLocationId + -Location -OSDiskId -OsType [-SubscriptionId ] [-AdminPassword ] + [-AdminUsername ] [-ComputerName ] [-DataDiskId ] [-DataDiskName ] + [-DataDiskResourceGroup ] [-DisablePasswordAuthentication] [-DynamicMemoryMaximumMemoryInMb ] + [-DynamicMemoryMinimumMemoryInMb ] [-DynamicMemoryTargetBuffer ] [-EnableAutomaticUpdate] + [-EnableTpm] [-IdentityType ] [-NicId ] [-NicName ] + [-NicResourceGroup ] [-ProvisionVMAgent] [-ProvisionVMConfigAgent] [-SecureBootEnabled] + [-SshPublicKey ] [-StoragePathId ] [-StoragePathName ] + [-StoragePathResourceGroup ] [-Tag ] [-TimeZone ] [-VmMemoryInMB ] + [-VmProcessor ] [-VmSize ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### ByOsDiskName +``` +New-AzStackHCIVmVirtualMachine -Name -ResourceGroupName -CustomLocationId + -Location -OSDiskName -OsType [-SubscriptionId ] [-AdminPassword ] + [-AdminUsername ] [-ComputerName ] [-DataDiskId ] [-DataDiskName ] + [-DataDiskResourceGroup ] [-DisablePasswordAuthentication] [-DynamicMemoryMaximumMemoryInMb ] + [-DynamicMemoryMinimumMemoryInMb ] [-DynamicMemoryTargetBuffer ] [-EnableAutomaticUpdate] + [-EnableTpm] [-IdentityType ] [-NicId ] [-NicName ] + [-NicResourceGroup ] [-OSDiskResourceGroup ] [-ProvisionVMAgent] [-ProvisionVMConfigAgent] + [-SecureBootEnabled] [-SshPublicKey ] [-StoragePathId ] [-StoragePathName ] + [-StoragePathResourceGroup ] [-Tag ] [-TimeZone ] [-VmMemoryInMB ] + [-VmProcessor ] [-VmSize ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +The operation to create or update a virtual machine. +Please note some properties can be set only during virtual machine creation. + +## EXAMPLES + +### Example 1: Create a Virtual Machine with an Image. +```powershell +New-AzStackHCIVmVirtualMachine -Name "testVm" -OsType "Linux" -ImageName "testImage" -VmSize "Standard_K8S_v1" -AdminUsername "localadmin" -ComputerName "testVm" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" +``` + +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` + +This command creates a virtual machine from a gallery image. + +### Example 2: Create a Virtual Machine with a Disk. +```powershell +New-AzStackHCIVmVirtualMachine -Name "testVm" -OsType "Linux" -OsDiskName "testOsDisk" -VmSize "Standard_K8S_v1" -AdminUsername "localadmin" -ComputerName "testVm" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" +``` + +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` + +This command creates a virtual machine from a disk. + +## PARAMETERS + +### -AdminPassword +AdminPassword - admin password + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AdminUsername +AdminUsername - admin username + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ComputerName +ComputerName - name of the computer + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomLocationId +The name of the extended location. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataDiskId +Data Disks - List of data disks to be attached to the virtual machine in id format. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataDiskName +Data Disks - List of data disks to be attached to the virtual machine in name format . + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataDiskResourceGroup +Data Disks - Resource Group of Data Disks. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DisablePasswordAuthentication +DisablePasswordAuthentication - whether password authentication should be disabled + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DynamicMemoryMaximumMemoryInMb +Maximum Dynamic Memory + +```yaml +Type: System.Int64 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DynamicMemoryMinimumMemoryInMb +Minimum Dynamic Memory + +```yaml +Type: System.Int64 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DynamicMemoryTargetBuffer +Defines the amount of extra memory that should be reserved for a virtual machine at runtime, as a percentage of the total memory that the virtual machine is thought to need. +This only applies to virtual systems with dynamic memory enabled. +This property can be in the range of 5 to 2000. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EnableAutomaticUpdate +Specifies Whether to EnableAutomaticUpdates on the machine. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EnableTpm +Used to indicate whether or not to enable TPM + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IdentityType +The identity type. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ImageId +Resource ID of the image to create the VM with. + +```yaml +Type: System.String +Parameter Sets: ByImageId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ImageName +Name of the image to create the VM with. + +```yaml +Type: System.String +Parameter Sets: ByImageName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ImageResourceGroup +Resource group of the image to create the VM from. + +```yaml +Type: System.String +Parameter Sets: ByImageName +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +The geo-location where the resource lives + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual machine + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: VirtualMachineName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicId +NetworkInterfaces - list of network interfaces to be attached to the virtual machine in ARM Id format. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicName +NetworkInterfaces - list of network interfaces to be attached to the virtual machine in name format. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicResourceGroup +NetworkInterfaces - Resource Group of Network Interfaces. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OSDiskId +Resource ID of the OS disk + +```yaml +Type: System.String +Parameter Sets: ByOsDiskId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OSDiskName +Name of the OS disk + +```yaml +Type: System.String +Parameter Sets: ByOsDiskName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OSDiskResourceGroup +Resource Group of the OS disk + +```yaml +Type: System.String +Parameter Sets: ByOsDiskName +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OsType +OsType - string specifying whether the OS is Linux or Windows + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProvisionVMAgent +Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine creation process. +VM Agent is provsioned by default. +Please pass -ProvisionVMAgent:$false to disable. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProvisionVMConfigAgent +Indicates whether virtual machine configuration agent should be provisioned on the virtual machine. +When this property is not specified, default behavior is to set it to true. +VM Config Agent is provisioned by default. +Please pass -ProvisionVMConfigAgent:$false to disable. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecureBootEnabled +Specifies whether secure boot should be enabled on the virtual machine. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SshPublicKey +PublicKeys - The list of SSH public keys used to authenticate with VMs + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoragePathId +Id of the storage container that hosts the VM configuration file + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoragePathName +Name of the storage container that hosts the VM configuration file + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoragePathResourceGroup +Storage Container resource group. +The resource group of the virtual machine will be used if this value is not provided. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TimeZone +TimeZone for the virtual machine + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VmMemoryInMB +RAM in MB for the virtual machine + +```yaml +Type: System.Int64 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VmProcessor +Number of processors for the virtual machine + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VmSize +Size of the VM. +Can be a Predefined size or Custom. +Possible Predefined Sizes include - Custom,Standard_A2_v2,Standard_A4_v2,Standard_D16s_v3,Standard_D2s_v3,Standard_D32s_v3,Standard_D4s_v3,Standard_D8s_v3,Standard_DS13_v2,Standard_DS2_v2,Standard_DS3_v2,Standard_DS4_v2,Standard_DS5_v2,Standard_K8S2_v1,Standard_K8S3_v1,Standard_K8S4_v1,Standard_K8S5_v1,Standard_K8S_v1,Standard_NK12,Standard_NK6,Standard_NV12, StandardNv6 + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/README.md b/src/StackHCI/StackHCIVm.Autorest/docs/README.md new file mode 100644 index 000000000000..b97a8695022d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/README.md @@ -0,0 +1,11 @@ +# Docs +This directory contains the documentation of the cmdlets for the `Az.StackHCIVm` 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. + +## Info +- Modifiable: no +- Generated: all +- Committed: yes +- Packaged: yes + +## Details +The process of documentation generation loads `Az.StackHCIVm` 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. \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmImage.md b/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmImage.md new file mode 100644 index 000000000000..446c34559fee --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmImage.md @@ -0,0 +1,160 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmimage +schema: 2.0.0 +--- + +# Remove-AzStackHCIVmImage + +## SYNOPSIS +The operation to delete an image. + +## SYNTAX + +### ByResourceId (Default) +``` +Remove-AzStackHCIVmImage -ResourceId [-SubscriptionId ] [-Force] [-Confirm] [-WhatIf] + [] +``` + +### ByName +``` +Remove-AzStackHCIVmImage -Name -ResourceGroupName [-SubscriptionId ] [-Force] + [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to delete an image. + +## EXAMPLES + +### Example 1: Remove an image. +```powershell +Remove-AzStackHCIVmImage -Name "testImage" -ResourceGroupName "test-rg" +``` + +This command removes the image from the specified resource group. + +## PARAMETERS + +### -Force +Forces the cmdlet to remove the network interface without prompting for confirmation. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the gallery image + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the image. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### System.Boolean + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmLogicalNetwork.md b/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmLogicalNetwork.md new file mode 100644 index 000000000000..403fff6d235c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmLogicalNetwork.md @@ -0,0 +1,159 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmlogicalnetwork +schema: 2.0.0 +--- + +# Remove-AzStackHCIVmLogicalNetwork + +## SYNOPSIS +The operation to delete a logical network. + +## SYNTAX + +### ByResourceId (Default) +``` +Remove-AzStackHCIVmLogicalNetwork -ResourceId [-Force] [-Confirm] [-WhatIf] [] +``` + +### Delete +``` +Remove-AzStackHCIVmLogicalNetwork -Name -ResourceGroupName [-SubscriptionId ] + [-Force] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to delete a logical network. + +## EXAMPLES + +### Example 1: Remove a logical network. +```powershell +Remove-AzStackHCIVmLogicalNetwork -Name "testLnet" -ResourceGroupName "test-rg" +``` + +This command removes the logical network from the specified resource group. + +## PARAMETERS + +### -Force +Forces the cmdlet to remove the virtual network without prompting for confirmation. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual network + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: LogicalNetworkName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the virtual network. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### System.Boolean + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmNetworkInterface.md b/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmNetworkInterface.md new file mode 100644 index 000000000000..e6592cbc32d2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmNetworkInterface.md @@ -0,0 +1,162 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmnetworkinterface +schema: 2.0.0 +--- + +# Remove-AzStackHCIVmNetworkInterface + +## SYNOPSIS +The operation to delete a network interface. + +## SYNTAX + +### ByResourceId (Default) +``` +Remove-AzStackHCIVmNetworkInterface -ResourceId [-SubscriptionId ] [-Force] [-Confirm] + [-WhatIf] [] +``` + +### ByName +``` +Remove-AzStackHCIVmNetworkInterface -Name -ResourceGroupName [-SubscriptionId ] + [-Force] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to delete a network interface. + +## EXAMPLES + +### Example 1: Remove a network interface. +```powershell +Remove-AzStackHCIVmLogicalNetwork -Name "testNic" -ResourceGroupName "test-rg" +``` + +This command removes the network interface from the specified resource group. + +## PARAMETERS + +### -Force +Forces the cmdlet to remove the network interface without prompting for confirmation. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the network interface + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: NetworkInterfaceName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the network interface. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHCIVmIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmStoragePath.md b/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmStoragePath.md new file mode 100644 index 000000000000..73c3f3bd7cda --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmStoragePath.md @@ -0,0 +1,241 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmstoragepath +schema: 2.0.0 +--- + +# Remove-AzStackHCIVmStoragePath + +## SYNOPSIS +The operation to delete a storage container. + +## SYNTAX + +### ByResourceId (Default) +``` +Remove-AzStackHCIVmStoragePath -ResourceId [-InputObject ] + [-SubscriptionId ] [-Force] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] + [-WhatIf] [] +``` + +### ByName +``` +Remove-AzStackHCIVmStoragePath -Name -ResourceGroupName [-InputObject ] + [-SubscriptionId ] [-Force] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +The operation to delete a storage container. + +## EXAMPLES + +### Example 1: Remove a Storage Path +```powershell + Remove-AzStackHCIVmStoragePath -Name "testStoragePath" -ResourceGroupName "test-rg" + +``` + +This command removes the storage path from the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Force +Forces the cmdlet to remove the storage path without prompting for confirmation. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +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.StackHCIVm.Models.IStackHciVMIdentity +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the storage container + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: StorageContainerName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the storage path. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHCIVmIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmVirtualHardDisk.md b/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmVirtualHardDisk.md new file mode 100644 index 000000000000..9952e7ac0626 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmVirtualHardDisk.md @@ -0,0 +1,161 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualharddisk +schema: 2.0.0 +--- + +# Remove-AzStackHCIVmVirtualHardDisk + +## SYNOPSIS +The operation to delete a virtual hard disk. + +## SYNTAX + +### ByResourceId (Default) +``` +Remove-AzStackHCIVmVirtualHardDisk -ResourceId [-SubscriptionId ] [-Force] [-Confirm] + [-WhatIf] [] +``` + +### ByName +``` +Remove-AzStackHCIVmVirtualHardDisk -Name -ResourceGroupName [-SubscriptionId ] + [-Force] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to delete a virtual hard disk. + +## EXAMPLES + +### Example 1: Remove a Virtual Hard Disk +```powershell +Remove-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" + +``` + +This command removes the virtual hard disk from the specified resource group. + +## PARAMETERS + +### -Force +Forces the cmdlet to remove the virtual hard disk without prompting for confirmation. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual hard disk + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: VirtualHardDiskName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the virtual hard disk. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### System.Boolean + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmVirtualMachine.md b/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmVirtualMachine.md new file mode 100644 index 000000000000..e33a2903543f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmVirtualMachine.md @@ -0,0 +1,226 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualmachine +schema: 2.0.0 +--- + +# Remove-AzStackHCIVmVirtualMachine + +## SYNOPSIS +The operation to delete a virtual machine. + +## SYNTAX + +### ByResourceId (Default) +``` +Remove-AzStackHCIVmVirtualMachine -ResourceId [-InputObject ] + [-SubscriptionId ] [-Force] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### ByName +``` +Remove-AzStackHCIVmVirtualMachine -Name -ResourceGroupName + [-InputObject ] [-SubscriptionId ] [-Force] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to delete a virtual machine. + +## EXAMPLES + +### Example 1: Remove a Virtual Machine +```powershell +Remove-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + +``` + +This command removes the virtual machine from the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Force +Forces the cmdlet to remove the virtual machine without prompting for confirmation. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +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.StackHCIVm.Models.IStackHciVMIdentity +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual machine + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: VirtualMachineName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the virtual machine. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHCIVmIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmVirtualMachineDataDisk.md b/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmVirtualMachineDataDisk.md new file mode 100644 index 000000000000..3c0cc703b7b8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmVirtualMachineDataDisk.md @@ -0,0 +1,198 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualmachinedatadisk +schema: 2.0.0 +--- + +# Remove-AzStackHCIVmVirtualMachineDataDisk + +## SYNOPSIS +The operation to delete a data disk from a virtual machine. + +## SYNTAX + +### ByResourceId (Default) +``` +Remove-AzStackHCIVmVirtualMachineDataDisk -ResourceId [-DataDiskId ] + [-DataDiskName ] [-DataDiskResourceGroup ] [-Confirm] [-WhatIf] [] +``` + +### ByName +``` +Remove-AzStackHCIVmVirtualMachineDataDisk -Name -ResourceGroupName + [-SubscriptionId ] [-DataDiskId ] [-DataDiskName ] + [-DataDiskResourceGroup ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to delete a data disk from a virtual machine. + +## EXAMPLES + +### Example 1: Removes a Data Disk from a Virtual Machine +```powershell +Remove-AzStackHCIVmVirtualMachineDataDisk -Name "testVm" -ResourceGroupName "test-rg" -DataDiskName "testVhd" + +``` + +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` + +This command removes a data disk from the virtual machine in the specified resource group. + +## PARAMETERS + +### -DataDiskId +Data Disks - list of data disks to be removed from the virtual machine in id format. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataDiskName +Data Disks - list of data disks to be removed from the virtual machine in name format. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataDiskResourceGroup +Resource Group of the Data Disks. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual machine + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: VirtualMachineName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the virtual machine. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmVirtualMachineNetworkInterface.md b/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmVirtualMachineNetworkInterface.md new file mode 100644 index 000000000000..d04f48c2681b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Remove-AzStackHCIVmVirtualMachineNetworkInterface.md @@ -0,0 +1,198 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualmachinenetworkinterface +schema: 2.0.0 +--- + +# Remove-AzStackHCIVmVirtualMachineNetworkInterface + +## SYNOPSIS +The operation to delete a network interface from a virtual machine. + +## SYNTAX + +### ByResourceId (Default) +``` +Remove-AzStackHCIVmVirtualMachineNetworkInterface -ResourceId [-NicId ] + [-NicName ] [-NicResourceGroup ] [-Confirm] [-WhatIf] [] +``` + +### ByName +``` +Remove-AzStackHCIVmVirtualMachineNetworkInterface -Name -ResourceGroupName + [-SubscriptionId ] [-NicId ] [-NicName ] [-NicResourceGroup ] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +The operation to delete a network interface from a virtual machine. + +## EXAMPLES + +### Example 1: Removes a Network Interface from a Virtual Machine +```powershell +Remove-AzStackHCIVmVirtualMachineNetworkInterface -Name "testVm" -ResourceGroupName "test-rg" -NicName 'testNic' + +``` + +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` + +This command removes a network interface from the virtual machine in the specified resource group. + +## PARAMETERS + +### -Name +Name of the virtual machine + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: VirtualMachineName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicId +NetworkInterfaces - list of network interfaces to be attached from the virtual machine in id format. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicName +NetworkInterfaces - list of network interfaces to be removed from the virtual machine in name format. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicResourceGroup +NetworkInterfaces - resource group of the network interfaces + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the virtual machine. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Restart-AzStackHCIVmVirtualMachine.md b/src/StackHCI/StackHCIVm.Autorest/docs/Restart-AzStackHCIVmVirtualMachine.md new file mode 100644 index 000000000000..4fc0a2e1a28e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Restart-AzStackHCIVmVirtualMachine.md @@ -0,0 +1,191 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/restart-azstackhcivmvirtualmachine +schema: 2.0.0 +--- + +# Restart-AzStackHCIVmVirtualMachine + +## SYNOPSIS +The operation to restart a virtual machine instance. + +## SYNTAX + +### ByResourceId (Default) +``` +Restart-AzStackHCIVmVirtualMachine -ResourceId [-DefaultProfile ] [-AsJob] [-NoWait] + [-Confirm] [-WhatIf] [] +``` + +### ByName +``` +Restart-AzStackHCIVmVirtualMachine -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to restart a virtual machine instance. + +## EXAMPLES + +### Example 1: Restart Virtual Machine +```powershell +Restart-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + +``` + +This command restarts the virtual machine in the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual machine + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: VirtualMachineName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the virtual machine. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Start-AzStackHCIVmVirtualMachine.md b/src/StackHCI/StackHCIVm.Autorest/docs/Start-AzStackHCIVmVirtualMachine.md new file mode 100644 index 000000000000..07d9b0a61788 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Start-AzStackHCIVmVirtualMachine.md @@ -0,0 +1,191 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/start-azstackhcivmvirtualmachine +schema: 2.0.0 +--- + +# Start-AzStackHCIVmVirtualMachine + +## SYNOPSIS +The operation to start a virtual machine instance. + +## SYNTAX + +### ByResourceId (Default) +``` +Start-AzStackHCIVmVirtualMachine -ResourceId [-DefaultProfile ] [-AsJob] [-NoWait] + [-Confirm] [-WhatIf] [] +``` + +### ByName +``` +Start-AzStackHCIVmVirtualMachine -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to start a virtual machine instance. + +## EXAMPLES + +### Example 1: Start Virtual Machine +```powershell +Start-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + +``` + +This command starts the virtual machine in the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual machine + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: VirtualMachineName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the virtual machine. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Stop-AzStackHCIVmVirtualMachine.md b/src/StackHCI/StackHCIVm.Autorest/docs/Stop-AzStackHCIVmVirtualMachine.md new file mode 100644 index 000000000000..c37f66516dd8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Stop-AzStackHCIVmVirtualMachine.md @@ -0,0 +1,193 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/stop-azstackhcivmvirtualmachine +schema: 2.0.0 +--- + +# Stop-AzStackHCIVmVirtualMachine + +## SYNOPSIS +The operation to stop a virtual machine instance. + +## SYNTAX + +### ByResourceId (Default) +``` +Stop-AzStackHCIVmVirtualMachine -ResourceId [-DefaultProfile ] [-AsJob] [-NoWait] + [-Confirm] [-WhatIf] [] +``` + +### ByName +``` +Stop-AzStackHCIVmVirtualMachine -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to stop a virtual machine instance. + +## EXAMPLES + +### Example 1: Stop Virtual Machine +```powershell +Stop-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + +``` + +This command stops the virtual machine in the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual machine + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: VirtualMachineName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the virtual machine. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHCIVmIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Update-AzStackHCIVmImage.md b/src/StackHCI/StackHCIVm.Autorest/docs/Update-AzStackHCIVmImage.md new file mode 100644 index 000000000000..cf9adf746854 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Update-AzStackHCIVmImage.md @@ -0,0 +1,174 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmimage +schema: 2.0.0 +--- + +# Update-AzStackHCIVmImage + +## SYNOPSIS +The operation to update an image. + +## SYNTAX + +### GalleryImage (Default) +``` +Update-AzStackHCIVmImage [-Confirm] [-WhatIf] [] +``` + +### ByName +``` +Update-AzStackHCIVmImage -Name -ResourceGroupName [-SubscriptionId ] + [-Tag ] [-Confirm] [-WhatIf] [] +``` + +### ByResourceId +``` +Update-AzStackHCIVmImage -ResourceId [-SubscriptionId ] [-Tag ] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +The operation to update an image. +Please note some properties can be set only during image creation. + +## EXAMPLES + +### Example 1: Update an Image. +```powershell +Update-AzStackHCIVmImage -Name "testImage" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} +``` + +```output +Name ResourceGroupName +---- ----------------- +testImage test-rg +``` + +This command updates an exisiting image in the specified resource group. + +## PARAMETERS + +### -Name +Name of the gallery image + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the image. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: ByName, ByResourceId +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: ByName, ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Update-AzStackHCIVmLogicalNetwork.md b/src/StackHCI/StackHCIVm.Autorest/docs/Update-AzStackHCIVmLogicalNetwork.md new file mode 100644 index 000000000000..df329ca9b461 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Update-AzStackHCIVmLogicalNetwork.md @@ -0,0 +1,235 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmlogicalnetwork +schema: 2.0.0 +--- + +# Update-AzStackHCIVmLogicalNetwork + +## SYNOPSIS +The operation to update a logical network. + +## SYNTAX + +### ByResourceId (Default) +``` +Update-AzStackHCIVmLogicalNetwork [-ResourceId ] [-Tag ] [] +``` + +### UpdateExpanded +``` +Update-AzStackHCIVmLogicalNetwork -Name -ResourceGroupName [-SubscriptionId ] + [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzStackHCIVmLogicalNetwork -InputObject [-Tag ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to update a logical network. + +## EXAMPLES + +### Example 1: Update a Logical Network. +```powershell +Update-AzStackHCIVmLogicalNetwork -Name "testLnet" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} +``` + +```output +Name ResourceGroupName +---- ----------------- +testLnet test-rg +``` + +This command updates an exisiting logical network in the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +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.StackHCIVm.Models.IStackHciVMIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Name of the logical network + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: LogicalNetworkName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the virtual network. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Update-AzStackHCIVmNetworkInterface.md b/src/StackHCI/StackHCIVm.Autorest/docs/Update-AzStackHCIVmNetworkInterface.md new file mode 100644 index 000000000000..5786c0ca80eb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Update-AzStackHCIVmNetworkInterface.md @@ -0,0 +1,235 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmnetworkinterface +schema: 2.0.0 +--- + +# Update-AzStackHCIVmNetworkInterface + +## SYNOPSIS +The operation to update a network interface. + +## SYNTAX + +### ByResourceId (Default) +``` +Update-AzStackHCIVmNetworkInterface [-ResourceId ] [-Tag ] [] +``` + +### UpdateExpanded +``` +Update-AzStackHCIVmNetworkInterface -Name -ResourceGroupName [-SubscriptionId ] + [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzStackHCIVmNetworkInterface -InputObject [-Tag ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to update a network interface. + +## EXAMPLES + +### Example 1: Update a Network Interface. +```powershell +Update-AzStackHCIVmNetworkInterface -Name "testNic" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} +``` + +```output +Name ResourceGroupName +---- ----------------- +testNic test-rg +``` + +This command updates an exisiting network interface in the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +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.StackHCIVm.Models.IStackHciVMIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Name of the network interface + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: NetworkInterfaceName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the network interface. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Update-AzStackHCIVmStoragePath.md b/src/StackHCI/StackHCIVm.Autorest/docs/Update-AzStackHCIVmStoragePath.md new file mode 100644 index 000000000000..0abbddfea3a9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Update-AzStackHCIVmStoragePath.md @@ -0,0 +1,235 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmstoragepath +schema: 2.0.0 +--- + +# Update-AzStackHCIVmStoragePath + +## SYNOPSIS +The operation to update a storage container. + +## SYNTAX + +### ByResourceId (Default) +``` +Update-AzStackHCIVmStoragePath [-ResourceId ] [-Tag ] [] +``` + +### UpdateExpanded +``` +Update-AzStackHCIVmStoragePath -Name -ResourceGroupName [-SubscriptionId ] + [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzStackHCIVmStoragePath -InputObject [-Tag ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to update a storage container. + +## EXAMPLES + +### Example 1: Update a Storage Path. +```powershell +Update-AzStackHCIVmStoragePath -Name "testVhd" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} +``` + +```output +Name ResourceGroupName +---- ----------------- +testStoragePath test-rg +``` + +This command updates an exisiting storage path in the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +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.StackHCIVm.Models.IStackHciVMIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Name of the storage container + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: StorageContainerName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the storage path. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Update-AzStackHCIVmVirtualHardDisk.md b/src/StackHCI/StackHCIVm.Autorest/docs/Update-AzStackHCIVmVirtualHardDisk.md new file mode 100644 index 000000000000..7b37d7adf237 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Update-AzStackHCIVmVirtualHardDisk.md @@ -0,0 +1,235 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmvirtualharddisk +schema: 2.0.0 +--- + +# Update-AzStackHCIVmVirtualHardDisk + +## SYNOPSIS +The operation to update a virtual hard disk. + +## SYNTAX + +### ByResourceId (Default) +``` +Update-AzStackHCIVmVirtualHardDisk [-ResourceId ] [-Tag ] [] +``` + +### UpdateExpanded +``` +Update-AzStackHCIVmVirtualHardDisk -Name -ResourceGroupName [-SubscriptionId ] + [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzStackHCIVmVirtualHardDisk -InputObject [-Tag ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to update a virtual hard disk. + +## EXAMPLES + +### Example 1: Update a Virtual Hard Disk. +```powershell +Update-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} +``` + +```output +Name ResourceGroupName +---- ----------------- +testVhd test-rg +``` + +This command updates an exisiting virtual hard disk in the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +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.StackHCIVm.Models.IStackHciVMIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Name of the virtual hard disk + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: VirtualHardDiskName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the virtual hard disk . + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/docs/Update-AzStackHCIVmVirtualMachine.md b/src/StackHCI/StackHCIVm.Autorest/docs/Update-AzStackHCIVmVirtualMachine.md new file mode 100644 index 000000000000..cb48b2ccf6ca --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/docs/Update-AzStackHCIVmVirtualMachine.md @@ -0,0 +1,274 @@ +--- +external help file: +Module Name: Az.StackHCI +online version: https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmvirtualmachine +schema: 2.0.0 +--- + +# Update-AzStackHCIVmVirtualMachine + +## SYNOPSIS +The operation to update a virtual machine instance. + +## SYNTAX + +### ByName (Default) +``` +Update-AzStackHCIVmVirtualMachine -Name -ResourceGroupName [-SubscriptionId ] + [-ProvisionVMAgent] [-ProvisionVMConfigAgent] [-VmMemoryInMB ] [-VmProcessor ] + [-VmSize ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### ByResourceId +``` +Update-AzStackHCIVmVirtualMachine -ResourceId [-ProvisionVMAgent] [-ProvisionVMConfigAgent] + [-VmMemoryInMB ] [-VmProcessor ] [-VmSize ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to update a virtual machine instance. + +## EXAMPLES + +### Example 1: Update the Size of the Virtual Machine. +```powershell +Update-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" -VmMemoryInMB "4" +``` + +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` + +This command updates an existing virtual machine in the specified resource group. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Name of the virtual machine + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: VirtualMachineName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProvisionVMAgent +Indicates whether virtual machine agent should be provisioned on the virtual machine. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProvisionVMConfigAgent +Indicates whether virtual machine configuration agent should be provisioned on the virtual machine. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The ARM Resource ID of the virtual network. + +```yaml +Type: System.String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: ByName +Aliases: + +Required: True +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VmMemoryInMB +RAM in MB for the virtual machine instance + +```yaml +Type: System.Int64 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VmProcessor +number of processors for the virtual machine instance + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VmSize +. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + +## NOTES + +## RELATED LINKS + diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Add-AzStackHCIVmVirtualMachineDataDisk.md b/src/StackHCI/StackHCIVm.Autorest/examples/Add-AzStackHCIVmVirtualMachineDataDisk.md new file mode 100644 index 000000000000..a105dc5f7776 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Add-AzStackHCIVmVirtualMachineDataDisk.md @@ -0,0 +1,12 @@ +### Example 1: Add a Data Disk to a Virtual Machine +```powershell + Add-AzStackHCIVmVirtualMachineDataDisk -Name 'testVm' -ResourceGroupName 'test-rg' -DataDiskName 'testVhd' + +``` +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` +This command attaches a data disk to the virtual machine in the specified resource group. + diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Add-AzStackHCIVmVirtualMachineNetworkInterface.md b/src/StackHCI/StackHCIVm.Autorest/examples/Add-AzStackHCIVmVirtualMachineNetworkInterface.md new file mode 100644 index 000000000000..0032d50d13de --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Add-AzStackHCIVmVirtualMachineNetworkInterface.md @@ -0,0 +1,12 @@ +### Example 1: Add a Network Interface to a Virtual Machine +```powershell +Add-AzStackHCIVmVirtualMachineNetworkInterface -Name 'testVm' -ResourceGroupName 'test-rg' -NicName 'testNic' + +``` +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` +This command attaches a network interface to the virtual machine in the specified resource group. + diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Get-AzStackHCIVmImage.md b/src/StackHCI/StackHCIVm.Autorest/examples/Get-AzStackHCIVmImage.md new file mode 100644 index 000000000000..70eb865a9a2c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Get-AzStackHCIVmImage.md @@ -0,0 +1,23 @@ +### Example 1: Get an Image +```powershell +Get-AzStackHCIVmImage -Name "testimage" -ResourceGroupName "test-rg" +``` +```output +Name ResourceGroupName +---- ----------------- +testImage test-rg +``` + +This command gets a specific image in the specified resource group. + +### Example 2: List all Images in a Resource Group +```powershell +Get-AzStackHCIVmImage -ResourceGroupName 'test-rg' +``` +```output +Name ResourceGroupName +---- ----------------- +testImage test-rg +``` +This command lists all images in the specified resource group. + diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Get-AzStackHCIVmLogicalNetwork.md b/src/StackHCI/StackHCIVm.Autorest/examples/Get-AzStackHCIVmLogicalNetwork.md new file mode 100644 index 000000000000..456d6fc19dfd --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Get-AzStackHCIVmLogicalNetwork.md @@ -0,0 +1,23 @@ +### Example 1: Get a Logical Network +```powershell +Get-AzStackHCIVmLogicalNetwork -Name 'testLnet' -ResourceGroupName 'test-rg' +``` +```output +Name ResourceGroupName +---- ----------------- +testLnet test-rg +``` + +This command gets a specific logical network in the specified resource group. + +### Example 2: List all Logical Networks in a Resource Group +```powershell +Get-AzStackHCIVmLogicalNetwork -ResourceGroupName 'test-rg' +``` +```output +Name ResourceGroupName +---- ----------------- +testLnet test-rg +``` +This command lists all logical networks in the specified resource group. + diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Get-AzStackHCIVmNetworkInterface.md b/src/StackHCI/StackHCIVm.Autorest/examples/Get-AzStackHCIVmNetworkInterface.md new file mode 100644 index 000000000000..24943731a701 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Get-AzStackHCIVmNetworkInterface.md @@ -0,0 +1,22 @@ +### Example 1: Get a Network Interface +```powershell +Get-AzStackHCIVmNetworkInterface -Name 'testNic' -ResourceGroupName 'test-rg' +``` +```output +Name ResourceGroupName +---- ----------------- +testNic test-rg +``` + +This command gets a specific network interface in the specified resource group. + +### Example 2: List all Logical Networks in a Resource Group +```powershell +Get-AzStackHCIVmNetworkInterface -ResourceGroupName 'test-rg' +``` +```output +Name ResourceGroupName +---- ----------------- +testNic test-rg +``` +This command lists all network interfaces in the specified resource group. \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Get-AzStackHCIVmStoragePath.md b/src/StackHCI/StackHCIVm.Autorest/examples/Get-AzStackHCIVmStoragePath.md new file mode 100644 index 000000000000..9ccad00a4d82 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Get-AzStackHCIVmStoragePath.md @@ -0,0 +1,23 @@ +### Example 1: Get a Storage Path +```powershell +Get-AzStackHCIVmStoragePath -Name "testStoragePath" -ResourceGroupName "test-rg" +``` +```output +Name ResourceGroupName +---- ----------------- +testStoragePath test-rg +``` + +This command gets a specific storage path in the specified resource group. + +### Example 2: List all Storage Paths in a Resource Group +```powershell +Get-AzStackHCIVmStoragePath -ResourceGroupName "test-rg" +``` +```output +Name ResourceGroupName +---- ----------------- +testStoragePath test-rg +``` + +This command lists all storage paths in the specified resource group. \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Get-AzStackHCIVmVirtualHardDisk.md b/src/StackHCI/StackHCIVm.Autorest/examples/Get-AzStackHCIVmVirtualHardDisk.md new file mode 100644 index 000000000000..28763e3b5566 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Get-AzStackHCIVmVirtualHardDisk.md @@ -0,0 +1,23 @@ +### Example 1: Get a Virtual Hard Disk +```powershell +Get-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" +``` +```output +Name ResourceGroupName +---- ----------------- +testVhd test-rg +``` + +This command gets a specific virtual hard disk in the specified resource group. + +### Example 2: List all Virtual Hard Disks in a Resource Group +```powershell +Get-AzStackHCIVmVirtualHardDisk -ResourceGroupName "test-rg" +``` +```output +Name ResourceGroupName +---- ----------------- +testVhd test-rg +``` + +This command lists all virtual hard disks in the specified resource group. \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Get-AzStackHCIVmVirtualMachine.md b/src/StackHCI/StackHCIVm.Autorest/examples/Get-AzStackHCIVmVirtualMachine.md new file mode 100644 index 000000000000..af53e29ad7be --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Get-AzStackHCIVmVirtualMachine.md @@ -0,0 +1,24 @@ +### Example 2: Get a Virtual Machine. +```powershell +Get-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" +``` +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` + +This commnad gets a virtual machine in a specified resource group. + + +### Example 2: List Virtual Machines in a Resource Group +```powershell +Get-AzStackHCIVmVirtualMachine -ResourceGroupName "test-rg" +``` +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` + +This command lists all virtual machines in a resource group. \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/New-AzStackHCIVmImage.md b/src/StackHCI/StackHCIVm.Autorest/examples/New-AzStackHCIVmImage.md new file mode 100644 index 000000000000..c0df6d9c1c59 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/New-AzStackHCIVmImage.md @@ -0,0 +1,33 @@ +### Example 1: Create a Gallery Image +```powershell +New-AzStackHCIVmImage -Name "testImage" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -ImagePath "C:\ClusterStorage\Volume1\Ubunut.vhdx" -OSType "Linux" -Location "eastus" +``` +```output +Name ResourceGroupName +---- ----------------- +testImage test-rg +``` +This command creates a gallery image from a local path. + +### Example 2: Create a Marketplace Gallery Image +```powershell +New-AzStackHCIVmImage -Name "testMarketplaceImage" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -Offer "windowsserver" -Publisher "MicrosoftWindowsServer" -Sku "2022-Datacenter" -Version "latest" -OSType "Windows" +``` +```output +Name ResourceGroupName +---- ----------------- +testMarketplaceImage test-rg +``` +This command creates a marketplace gallery image using the specified offer , publisher, sku and version. + +### Example 3: {Create a Marketplace Gallery Image From URN +```powershell +New-AzStackHCIVmImage -Name "testMarketplaceImageURN" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -URN "microsoftwindowsserver:windowsserver:2022-datacenter:latest" -OSType "Windows" +``` +```output +Name ResourceGroupName +---- ----------------- +testMarketplaceImageURN test-rg +``` +This command creates a marketplace gallery image using the specified urn. + diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/New-AzStackHCIVmLogicalNetwork.md b/src/StackHCI/StackHCIVm.Autorest/examples/New-AzStackHCIVmLogicalNetwork.md new file mode 100644 index 000000000000..1698aecfe82d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/New-AzStackHCIVmLogicalNetwork.md @@ -0,0 +1,12 @@ +### Example 1: Create a Logical Network +```powershell +New-AzStackHCIVmLogicalNetwork -Name "testLnet" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -VmSwitchName "testswitch" +``` +```output +Name ResourceGroupName +---- ----------------- +testLnet test-rg +``` +This command creates a logical network in the specified resource group. + + diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/New-AzStackHCIVmNetworkInterface.md b/src/StackHCI/StackHCIVm.Autorest/examples/New-AzStackHCIVmNetworkInterface.md new file mode 100644 index 000000000000..366f4a9ece08 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/New-AzStackHCIVmNetworkInterface.md @@ -0,0 +1,11 @@ +### Example 1: Create a Network Interface +```powershell +New-AzStackHCIVmNetworkInterface -Name "testNic" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -SubnetName "testLnet" +``` +```output +Name ResourceGroupName +---- ----------------- +testNic test-rg +``` +This command creates a network interface in the specified resource group. + diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/New-AzStackHCIVmStoragePath.md b/src/StackHCI/StackHCIVm.Autorest/examples/New-AzStackHCIVmStoragePath.md new file mode 100644 index 000000000000..091d517f26c3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/New-AzStackHCIVmStoragePath.md @@ -0,0 +1,12 @@ +### Example 1: Create a Storage Path +```powershell +New-AzStackHCIVmStoragePath -Name "testStoragePath" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}"-Location "eastus" -Path "C:\ClusterStorage\Volume1\testpath" +``` +```output +Name ResourceGroupName +---- ----------------- +testStoragePath test-rg +``` +This command creates a storage path in the specified resource group. + + diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/New-AzStackHCIVmVirtualHardDisk.md b/src/StackHCI/StackHCIVm.Autorest/examples/New-AzStackHCIVmVirtualHardDisk.md new file mode 100644 index 000000000000..8495dc38cbc0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/New-AzStackHCIVmVirtualHardDisk.md @@ -0,0 +1,12 @@ +### Example 1: Create a Virtual Hard Disk +```powershell +New-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -SizeGb 2 +``` +```output +Name ResourceGroupName +---- ----------------- +testVhd test-rg +``` +This command creates a virtual hard disk in the specified resource group. + + diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/New-AzStackHCIVmVirtualMachine.md b/src/StackHCI/StackHCIVm.Autorest/examples/New-AzStackHCIVmVirtualMachine.md new file mode 100644 index 000000000000..ddd0c08effcb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/New-AzStackHCIVmVirtualMachine.md @@ -0,0 +1,24 @@ +### Example 1: Create a Virtual Machine with an Image. +```powershell +New-AzStackHCIVmVirtualMachine -Name "testVm" -OsType "Linux" -ImageName "testImage" -VmSize "Standard_K8S_v1" -AdminUsername "localadmin" -ComputerName "testVm" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" +``` +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` + +This command creates a virtual machine from a gallery image. + +### Example 2: Create a Virtual Machine with a Disk. +```powershell +New-AzStackHCIVmVirtualMachine -Name "testVm" -OsType "Linux" -OsDiskName "testOsDisk" -VmSize "Standard_K8S_v1" -AdminUsername "localadmin" -ComputerName "testVm" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" +``` +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` +This command creates a virtual machine from a disk. + + diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmImage.md b/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmImage.md new file mode 100644 index 000000000000..7e3a5ffb7f59 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmImage.md @@ -0,0 +1,8 @@ +### Example 1: Remove an image. +```powershell +Remove-AzStackHCIVmImage -Name "testImage" -ResourceGroupName "test-rg" +``` +This command removes the image from the specified resource group. + + + diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmLogicalNetwork.md b/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmLogicalNetwork.md new file mode 100644 index 000000000000..b1bcb66a6eb0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmLogicalNetwork.md @@ -0,0 +1,6 @@ +### Example 1: Remove a logical network. +```powershell +Remove-AzStackHCIVmLogicalNetwork -Name "testLnet" -ResourceGroupName "test-rg" +``` +This command removes the logical network from the specified resource group. + diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmNetworkInterface.md b/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmNetworkInterface.md new file mode 100644 index 000000000000..a55ba82b2e50 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmNetworkInterface.md @@ -0,0 +1,6 @@ +### Example 1: Remove a network interface. +```powershell +Remove-AzStackHCIVmLogicalNetwork -Name "testNic" -ResourceGroupName "test-rg" +``` +This command removes the network interface from the specified resource group. + diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmStoragePath.md b/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmStoragePath.md new file mode 100644 index 000000000000..51c67fddbb75 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmStoragePath.md @@ -0,0 +1,9 @@ +### Example 1: Remove a Storage Path +```powershell + Remove-AzStackHCIVmStoragePath -Name "testStoragePath" -ResourceGroupName "test-rg" + +``` +This command removes the storage path from the specified resource group. + + + diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmVirtualHardDisk.md b/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmVirtualHardDisk.md new file mode 100644 index 000000000000..dfa401c1e82f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmVirtualHardDisk.md @@ -0,0 +1,9 @@ +### Example 1: Remove a Virtual Hard Disk +```powershell +Remove-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" + +``` +This command removes the virtual hard disk from the specified resource group. + + + diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmVirtualMachine.md b/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmVirtualMachine.md new file mode 100644 index 000000000000..06f804fc8028 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmVirtualMachine.md @@ -0,0 +1,9 @@ +### Example 1: Remove a Virtual Machine +```powershell +Remove-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + +``` +This command removes the virtual machine from the specified resource group. + + + diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmVirtualMachineDataDisk.md b/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmVirtualMachineDataDisk.md new file mode 100644 index 000000000000..bb5b65d3384b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmVirtualMachineDataDisk.md @@ -0,0 +1,12 @@ +### Example 1: Removes a Data Disk from a Virtual Machine +```powershell +Remove-AzStackHCIVmVirtualMachineDataDisk -Name "testVm" -ResourceGroupName "test-rg" -DataDiskName "testVhd" + +``` +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` +This command removes a data disk from the virtual machine in the specified resource group. + diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmVirtualMachineNetworkInterface.md b/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmVirtualMachineNetworkInterface.md new file mode 100644 index 000000000000..58346affed1d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Remove-AzStackHCIVmVirtualMachineNetworkInterface.md @@ -0,0 +1,11 @@ +### Example 1: Removes a Network Interface from a Virtual Machine +```powershell +Remove-AzStackHCIVmVirtualMachineNetworkInterface -Name "testVm" -ResourceGroupName "test-rg" -NicName 'testNic' + +``` +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` +This command removes a network interface from the virtual machine in the specified resource group. diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Restart-AzStackHCIVmVirtualMachine.md b/src/StackHCI/StackHCIVm.Autorest/examples/Restart-AzStackHCIVmVirtualMachine.md new file mode 100644 index 000000000000..8e0095ab72b6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Restart-AzStackHCIVmVirtualMachine.md @@ -0,0 +1,6 @@ +### Example 1: Restart Virtual Machine +```powershell +Restart-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + +``` +This command restarts the virtual machine in the specified resource group. \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Start-AzStackHCIVmVirtualMachine.md b/src/StackHCI/StackHCIVm.Autorest/examples/Start-AzStackHCIVmVirtualMachine.md new file mode 100644 index 000000000000..5ca4519cf183 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Start-AzStackHCIVmVirtualMachine.md @@ -0,0 +1,6 @@ +### Example 1: Start Virtual Machine +```powershell +Start-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + +``` +This command starts the virtual machine in the specified resource group. \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Stop-AzStackHCIVmVirtualMachine.md b/src/StackHCI/StackHCIVm.Autorest/examples/Stop-AzStackHCIVmVirtualMachine.md new file mode 100644 index 000000000000..5927c7197ade --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Stop-AzStackHCIVmVirtualMachine.md @@ -0,0 +1,6 @@ +### Example 1: Stop Virtual Machine +```powershell +Stop-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + +``` +This command stops the virtual machine in the specified resource group. \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Update-AzStackHCIVmImage.md b/src/StackHCI/StackHCIVm.Autorest/examples/Update-AzStackHCIVmImage.md new file mode 100644 index 000000000000..3cf2227b3978 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Update-AzStackHCIVmImage.md @@ -0,0 +1,13 @@ +### Example 1: Update an Image. +```powershell +Update-AzStackHCIVmImage -Name "testImage" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} +``` + +```output +Name ResourceGroupName +---- ----------------- +testImage test-rg +``` + +This command updates an exisiting image in the specified resource group. + diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Update-AzStackHCIVmLogicalNetwork.md b/src/StackHCI/StackHCIVm.Autorest/examples/Update-AzStackHCIVmLogicalNetwork.md new file mode 100644 index 000000000000..837f5baa991b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Update-AzStackHCIVmLogicalNetwork.md @@ -0,0 +1,12 @@ +### Example 1: Update a Logical Network. +```powershell +Update-AzStackHCIVmLogicalNetwork -Name "testLnet" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} +``` + +```output +Name ResourceGroupName +---- ----------------- +testLnet test-rg +``` + +This command updates an exisiting logical network in the specified resource group. \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Update-AzStackHCIVmNetworkInterface.md b/src/StackHCI/StackHCIVm.Autorest/examples/Update-AzStackHCIVmNetworkInterface.md new file mode 100644 index 000000000000..c63a088d5457 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Update-AzStackHCIVmNetworkInterface.md @@ -0,0 +1,12 @@ +### Example 1: Update a Network Interface. +```powershell +Update-AzStackHCIVmNetworkInterface -Name "testNic" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} +``` + +```output +Name ResourceGroupName +---- ----------------- +testNic test-rg +``` + +This command updates an exisiting network interface in the specified resource group. \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Update-AzStackHCIVmStoragePath.md b/src/StackHCI/StackHCIVm.Autorest/examples/Update-AzStackHCIVmStoragePath.md new file mode 100644 index 000000000000..6a94868dffd6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Update-AzStackHCIVmStoragePath.md @@ -0,0 +1,12 @@ +### Example 1: Update a Storage Path. +```powershell +Update-AzStackHCIVmStoragePath -Name "testVhd" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} +``` + +```output +Name ResourceGroupName +---- ----------------- +testStoragePath test-rg +``` + +This command updates an exisiting storage path in the specified resource group. \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Update-AzStackHCIVmVirtualHardDisk.md b/src/StackHCI/StackHCIVm.Autorest/examples/Update-AzStackHCIVmVirtualHardDisk.md new file mode 100644 index 000000000000..d04784204766 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Update-AzStackHCIVmVirtualHardDisk.md @@ -0,0 +1,12 @@ +### Example 1: Update a Virtual Hard Disk. +```powershell +Update-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} +``` + +```output +Name ResourceGroupName +---- ----------------- +testVhd test-rg +``` + +This command updates an exisiting virtual hard disk in the specified resource group. \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/examples/Update-AzStackHCIVmVirtualMachine.md b/src/StackHCI/StackHCIVm.Autorest/examples/Update-AzStackHCIVmVirtualMachine.md new file mode 100644 index 000000000000..3620b48ba2e1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/examples/Update-AzStackHCIVmVirtualMachine.md @@ -0,0 +1,12 @@ +### Example 1: Update the Size of the Virtual Machine. +```powershell +Update-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" -VmMemoryInMB "4" +``` +```output +Name ResourceGroupName +---- ----------------- +testVm test-rg +``` + +This command updates an existing virtual machine in the specified resource group. + diff --git a/src/StackHCI/StackHCIVm.Autorest/export-surface.ps1 b/src/StackHCI/StackHCIVm.Autorest/export-surface.ps1 new file mode 100644 index 000000000000..2a0c401ca0f4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/export-surface.ps1 @@ -0,0 +1,41 @@ +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$IncludeGeneralParameters, [switch]$UseExpandedFormat) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$dll = Join-Path $PSScriptRoot 'bin\Az.StackHCIVm.private.dll' +if(-not (Test-Path $dll)) { + Write-Error "Unable to find output assembly in '$binFolder'." +} +$null = Import-Module -Name $dll + +$moduleName = 'Az.StackHCIVm' +$exportsFolder = Join-Path $PSScriptRoot 'exports' +$resourcesFolder = Join-Path $PSScriptRoot 'resources' + +Export-CmdletSurface -ModuleName $moduleName -CmdletFolder $exportsFolder -OutputFolder $resourcesFolder -IncludeGeneralParameters $IncludeGeneralParameters.IsPresent -UseExpandedFormat $UseExpandedFormat.IsPresent +Write-Host -ForegroundColor Green "CmdletSurface file(s) created in '$resourcesFolder'" + +Export-ModelSurface -OutputFolder $resourcesFolder -UseExpandedFormat $UseExpandedFormat.IsPresent +Write-Host -ForegroundColor Green "ModelSurface file created in '$resourcesFolder'" + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Add-AzStackHCIVmVirtualMachineDataDisk.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Add-AzStackHCIVmVirtualMachineDataDisk.ps1 new file mode 100644 index 000000000000..80154184d78b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Add-AzStackHCIVmVirtualMachineDataDisk.ps1 @@ -0,0 +1,164 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to add a data disk to a virtual machine. +.Description +The operation to add a data disk to a virtual machine. +.Example + Add-AzStackHCIVmVirtualMachineDataDisk -Name 'testVm' -ResourceGroupName 'test-rg' -DataDiskName 'testVhd' + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/add-azstackhcivmvirtualmachinedatadisk +#> +function Add-AzStackHCIVmVirtualMachineDataDisk { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the VM + ${ResourceId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # List of data disks to be attached to the virtual machine passed in Id format + ${DataDiskId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # List of data disks to be attached to the virtual machine passed by Name + ${DataDiskName}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource Group of the Data Disks + ${DataDiskResourceGroup} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Add-AzStackHCIVmVirtualMachineDataDisk'; + ByResourceId = 'Az.StackHCIVm.custom\Add-AzStackHCIVmVirtualMachineDataDisk'; + } + if (('ByName') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Add-AzStackHCIVmVirtualMachineNetworkInterface.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Add-AzStackHCIVmVirtualMachineNetworkInterface.ps1 new file mode 100644 index 000000000000..aaf6233131f4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Add-AzStackHCIVmVirtualMachineNetworkInterface.ps1 @@ -0,0 +1,164 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to add a network interface to a virtual machine. +.Description +The operation to add a network interface to a virtual machine. +.Example +Add-AzStackHCIVmVirtualMachineNetworkInterface -Name 'testVm' -ResourceGroupName 'test-rg' -NicName 'testNic' + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/add-azstackhcivmvirtualmachinenetworkinterface +#> +function Add-AzStackHCIVmVirtualMachineNetworkInterface { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Id of the Virtual Machine + ${ResourceId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # NetworkInterfaces - list of network interfaces to be attached to the virtual machine in id format + ${NicId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # NetworkInterfaces - list of network interfaces to be attached to the virtual machine in name format + ${NicName}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource Group of the Network Interfaces + ${NicResourceGroup} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Add-AzStackHCIVmVirtualMachineNetworkInterface'; + ByResourceId = 'Az.StackHCIVm.custom\Add-AzStackHCIVmVirtualMachineNetworkInterface'; + } + if (('ByName') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Get-AzStackHCIVmImage.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Get-AzStackHCIVmImage.ps1 new file mode 100644 index 000000000000..2206a89a5994 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Get-AzStackHCIVmImage.ps1 @@ -0,0 +1,201 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets a gallery image +.Description +Gets a gallery image +.Example +Get-AzStackHCIVmImage -Name "testimage" -ResourceGroupName "test-rg" +.Example +Get-AzStackHCIVmImage -ResourceGroupName 'test-rg' + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmimage +#> +function Get-AzStackHCIVmImage { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages], [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages])] +[CmdletBinding(DefaultParameterSetName='BySubscription', PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the image + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Parameter(ParameterSetName='ByResourceGroup', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource Id of the Image + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + BySubscription = 'Az.StackHCIVm.custom\Get-AzStackHCIVmImage'; + ByName = 'Az.StackHCIVm.custom\Get-AzStackHCIVmImage'; + ByResourceGroup = 'Az.StackHCIVm.custom\Get-AzStackHCIVmImage'; + ByResourceId = 'Az.StackHCIVm.custom\Get-AzStackHCIVmImage'; + } + if (('BySubscription', 'ByName', 'ByResourceGroup', 'ByResourceId') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Get-AzStackHCIVmLogicalNetwork.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Get-AzStackHCIVmLogicalNetwork.ps1 new file mode 100644 index 000000000000..0522ab1566a6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Get-AzStackHCIVmLogicalNetwork.ps1 @@ -0,0 +1,203 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets a logical network +.Description +Gets a logical network +.Example +Get-AzStackHCIVmLogicalNetwork -Name 'testLnet' -ResourceGroupName 'test-rg' +.Example +Get-AzStackHCIVmLogicalNetwork -ResourceGroupName 'test-rg' + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmlogicalnetwork +#> +function Get-AzStackHCIVmLogicalNetwork { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('LogicalNetworkName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the logical network + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM ID of the logical network. + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmLogicalNetwork_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmLogicalNetwork_List'; + List1 = 'Az.StackHCIVm.private\Get-AzStackHCIVmLogicalNetwork_List1'; + ByResourceId = 'Az.StackHCIVm.custom\Get-AzStackHCIVmLogicalNetwork_ByResourceId'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Get-AzStackHCIVmNetworkInterface.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Get-AzStackHCIVmNetworkInterface.ps1 new file mode 100644 index 000000000000..6a357cb86af7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Get-AzStackHCIVmNetworkInterface.ps1 @@ -0,0 +1,203 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets a network interface +.Description +Gets a network interface +.Example +Get-AzStackHCIVmNetworkInterface -Name 'testNic' -ResourceGroupName 'test-rg' +.Example +Get-AzStackHCIVmNetworkInterface -ResourceGroupName 'test-rg' + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmnetworkinterface +#> +function Get-AzStackHCIVmNetworkInterface { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('NetworkInterfaceName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the network interface + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Id of the network interface. + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmNetworkInterface_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmNetworkInterface_List'; + List1 = 'Az.StackHCIVm.private\Get-AzStackHCIVmNetworkInterface_List1'; + ByResourceId = 'Az.StackHCIVm.custom\Get-AzStackHCIVmNetworkInterface_ByResourceId'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Get-AzStackHCIVmStoragePath.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Get-AzStackHCIVmStoragePath.ps1 new file mode 100644 index 000000000000..0bbe23b1c776 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Get-AzStackHCIVmStoragePath.ps1 @@ -0,0 +1,203 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets a storage container +.Description +Gets a storage container +.Example +Get-AzStackHCIVmStoragePath -Name "testStoragePath" -ResourceGroupName "test-rg" +.Example +Get-AzStackHCIVmStoragePath -ResourceGroupName "test-rg" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmstoragepath +#> +function Get-AzStackHCIVmStoragePath { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('StorageContainerName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the storage container + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM ID of the storage path. + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmStoragePath_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmStoragePath_List'; + List1 = 'Az.StackHCIVm.private\Get-AzStackHCIVmStoragePath_List1'; + ByResourceId = 'Az.StackHCIVm.custom\Get-AzStackHCIVmStoragePath_ByResourceId'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Get-AzStackHCIVmVirtualHardDisk.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Get-AzStackHCIVmVirtualHardDisk.ps1 new file mode 100644 index 000000000000..292417ac83e8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Get-AzStackHCIVmVirtualHardDisk.ps1 @@ -0,0 +1,203 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets a virtual hard disk +.Description +Gets a virtual hard disk +.Example +Get-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" +.Example +Get-AzStackHCIVmVirtualHardDisk -ResourceGroupName "test-rg" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmvirtualharddisk +#> +function Get-AzStackHCIVmVirtualHardDisk { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('VirtualHardDiskName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual hard disk + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM ID of the virtual hard disk. + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmVirtualHardDisk_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmVirtualHardDisk_List'; + List1 = 'Az.StackHCIVm.private\Get-AzStackHCIVmVirtualHardDisk_List1'; + ByResourceId = 'Az.StackHCIVm.custom\Get-AzStackHCIVmVirtualHardDisk_ByResourceId'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Get-AzStackHCIVmVirtualMachine.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Get-AzStackHCIVmVirtualMachine.ps1 new file mode 100644 index 000000000000..b0ed4da96818 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Get-AzStackHCIVmVirtualMachine.ps1 @@ -0,0 +1,204 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets a virtual machine +.Description +Gets a virtual machine +.Example +Get-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" +.Example +Get-AzStackHCIVmVirtualMachine -ResourceGroupName "test-rg" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.Machine +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmvirtualmachine +#> +function Get-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.Machine], [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='BySubscription', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Parameter(ParameterSetName='ByResourceGroup', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceGroup')] + [Parameter(ParameterSetName='BySubscription')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM ID of the virtual machine. + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Get-AzStackHCIVmVirtualMachine'; + ByResourceGroup = 'Az.StackHCIVm.custom\Get-AzStackHCIVmVirtualMachine'; + BySubscription = 'Az.StackHCIVm.custom\Get-AzStackHCIVmVirtualMachine'; + ByResourceId = 'Az.StackHCIVm.custom\Get-AzStackHCIVmVirtualMachine'; + } + if (('ByName', 'ByResourceGroup', 'BySubscription') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/New-AzStackHCIVmImage.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/New-AzStackHCIVmImage.ps1 new file mode 100644 index 000000000000..d27c72ee2c27 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/New-AzStackHCIVmImage.ps1 @@ -0,0 +1,298 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create an image. +Please note some properties can be set only during image creation. +.Description +The operation to create an image. +Please note some properties can be set only during image creation. +.Example +New-AzStackHCIVmImage -Name "testImage" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -ImagePath "C:\ClusterStorage\Volume1\Ubunut.vhdx" -OSType "Linux" -Location "eastus" +.Example +New-AzStackHCIVmImage -Name "testMarketplaceImage" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -Offer "windowsserver" -Publisher "MicrosoftWindowsServer" -Sku "2022-Datacenter" -Version "latest" -OSType "Windows" +.Example +New-AzStackHCIVmImage -Name "testMarketplaceImageURN" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -URN "microsoftwindowsserver:windowsserver:2022-datacenter:latest" -OSType "Windows" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmimage +#> +function New-AzStackHCIVmImage { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages], [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages])] +[CmdletBinding(DefaultParameterSetName='MarketplaceURN', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('ImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the Image + # The name must start and end with an alphanumeric character and must contain all alphanumeric characters or ‘-‘, ‘.’, or ‘_’. + # The max length can be 80 characters and the minimum length is 1 character. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The ARM Id of the extended location to create image resource in. + ${CustomLocationId}, + + [Parameter(Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes] + # Operating system type that the gallery image uses [Windows, Linux] + ${OSType}, + + [Parameter(ParameterSetName='MarketplaceURN', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The URN of the marketplace gallery image. + ${URN}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource] + # Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + ${CloudInitDataSource}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage Container Name of the storage container to be used for gallery image + ${StoragePathName}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource Group of the Storage Path. + # The Default value is the Resource Group of the Image. + ${StoragePathResourceGroup}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage ContainerID of the storage container to be used for gallery image + ${StoragePathId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter(ParameterSetName='GalleryImage', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Local path of image that the image should be created from. + # + # This parameter is required for non marketplace images. + ${ImagePath}, + + [Parameter(ParameterSetName='Marketplace', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the marketplae gallery image definition offer. + ${Offer}, + + [Parameter(ParameterSetName='Marketplace', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the marketplace gallery image definition publisher. + ${Publisher}, + + [Parameter(ParameterSetName='Marketplace', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the marketplace gallery image definition SKU. + ${Sku}, + + [Parameter(ParameterSetName='Marketplace', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The version of the marketplace gallery image. + ${Version}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + MarketplaceURN = 'Az.StackHCIVm.custom\New-AzStackHCIVmImage'; + GalleryImage = 'Az.StackHCIVm.custom\New-AzStackHCIVmImage'; + Marketplace = 'Az.StackHCIVm.custom\New-AzStackHCIVmImage'; + } + if (('MarketplaceURN', 'GalleryImage', 'Marketplace') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/New-AzStackHCIVmLogicalNetwork.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/New-AzStackHCIVmLogicalNetwork.ps1 new file mode 100644 index 000000000000..29e9141e5b1a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/New-AzStackHCIVmLogicalNetwork.ps1 @@ -0,0 +1,291 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a logical network. +Please note some properties can be set only during logical network creation. +.Description +The operation to create or update a logical network. +Please note some properties can be set only during logical network creation. +.Example +New-AzStackHCIVmLogicalNetwork -Name "testLnet" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -VmSwitchName "testswitch" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmlogicalnetwork +#> +function New-AzStackHCIVmLogicalNetwork { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks])] +[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('LogicalNetworkName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual network + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # The list of DNS servers IP addresses. + ${DnsServer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Name of the network switch to be used for VMs + ${VMSwitchName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # List of address prefixes for the subnet. + ${AddressPrefix}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The IP address allocation method. + # Possible values include: 'Static', 'Dynamic' + ${IpAllocationMethod}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # End of the ip address pool + ${IpPoolEnd}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Start of the ip address pool + ${IpPoolStart}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPPoolTypeEnum])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Ip pool type + ${IpPoolType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Collections.Hashtable[]] + # Network associated pool of IP Addresses + ${IpPool}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Collections.Hashtable[]] + # Collection of routes contained within a route table. + ${Route}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Name of the subnet + ${SubnetName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Collections.Hashtable[]] + # List of subnets under the virtual network + ${Subnet}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # Vlan to use for the subnet + ${Vlan}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.StackHCIVm.custom\New-AzStackHCIVmLogicalNetwork'; + } + if (('__AllParameterSets') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/New-AzStackHCIVmNetworkInterface.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/New-AzStackHCIVmNetworkInterface.ps1 new file mode 100644 index 000000000000..7d07d0f33304 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/New-AzStackHCIVmNetworkInterface.ps1 @@ -0,0 +1,258 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a network interface. +Please note some properties can be set only during network interface creation. +.Description +The operation to create or update a network interface. +Please note some properties can be set only during network interface creation. +.Example +New-AzStackHCIVmNetworkInterface -Name "testNic" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -SubnetName "testLnet" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmnetworkinterface +#> +function New-AzStackHCIVmNetworkInterface { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces])] +[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('NetworkInterfaceName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the Network Interface + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # List of DNS server IP Addresses for the interface + ${DnsServer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # PrivateIPAddress - Private IP address of the IP configuration. + ${IpAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # MacAddress - The MAC address of the network interface. + ${MacAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The ARM resource id of the Subnet. + ${SubnetId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the Subnet. + ${SubnetName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource Group of the Subnet. + ${SubnetResourceGroup}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Collections.Hashtable[]] + # A list of IPConfigurations of the network interface. + ${IpConfiguration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.StackHCIVm.custom\New-AzStackHCIVmNetworkInterface'; + } + if (('__AllParameterSets') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/New-AzStackHCIVmStoragePath.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/New-AzStackHCIVmStoragePath.ps1 new file mode 100644 index 000000000000..20ca92e8ffe8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/New-AzStackHCIVmStoragePath.ps1 @@ -0,0 +1,221 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a storage container. +Please note some properties can be set only during storage container creation. +.Description +The operation to create or update a storage container. +Please note some properties can be set only during storage container creation. +.Example +New-AzStackHCIVmStoragePath -Name "testStoragePath" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}"-Location "eastus" -Path "C:\ClusterStorage\Volume1\testpath" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmstoragepath +#> +function New-AzStackHCIVmStoragePath { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers])] +[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('StorageContainerName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the storage container + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Path of the storage container on the disk + ${Path}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.StackHCIVm.custom\New-AzStackHCIVmStoragePath'; + } + if (('__AllParameterSets') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/New-AzStackHCIVmVirtualHardDisk.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/New-AzStackHCIVmVirtualHardDisk.ps1 new file mode 100644 index 000000000000..e4d2d3494dcb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/New-AzStackHCIVmVirtualHardDisk.ps1 @@ -0,0 +1,281 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a virtual hard disk. +Please note some properties can be set only during virtual hard disk creation. +.Description +The operation to create or update a virtual hard disk. +Please note some properties can be set only during virtual hard disk creation. +.Example +New-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -SizeGb 2 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmvirtualharddisk +#> +function New-AzStackHCIVmVirtualHardDisk { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks])] +[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('VirtualHardDiskName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual hard disk. + # + # Must contain all alphanumeric characters or ‘-’ or ‘_’. + # Max length is 80 characters, and min length is 1 character. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The ARM Id of the extended location to create virtual hard disk resource in. + ${CustomLocationId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # The block size, in bytes, of the virtual hard disk. + ${BlockSizeByte}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage ContainerID of the storage container to be used for VHD + ${StoragePathId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage Container Name to be used for the VHD + ${StoragePathName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage Container resource group. + # The resource group of the virtual hard disk will be used if this value is not provided. + ${StoragePathResourceGroup}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat] + # The format of the actual VHD file [vhd, vhdx] + ${DiskFileFormat}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # Size of the disk in GB + ${SizeGb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Boolean for enabling dynamic sizing on the virtual hard disk + ${Dynamic}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration] + # The hypervisor generation of the Virtual Machine [V1, V2] + ${HyperVGeneration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # Logical Sector Bytes of the Disk + ${LogicalSectorByte}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # Physical Sector Bytes of the Disk + ${PhysicalSectorByte}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.StackHCIVm.custom\New-AzStackHCIVmVirtualHardDisk'; + } + if (('__AllParameterSets') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/New-AzStackHCIVmVirtualMachine.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/New-AzStackHCIVmVirtualMachine.ps1 new file mode 100644 index 000000000000..964bdf0b41c8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/New-AzStackHCIVmVirtualMachine.ps1 @@ -0,0 +1,442 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a virtual machine. +Please note some properties can be set only during virtual machine creation. +.Description +The operation to create or update a virtual machine. +Please note some properties can be set only during virtual machine creation. +.Example +New-AzStackHCIVmVirtualMachine -Name "testVm" -OsType "Linux" -ImageName "testImage" -VmSize "Standard_K8S_v1" -AdminUsername "localadmin" -ComputerName "testVm" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" +.Example +New-AzStackHCIVmVirtualMachine -Name "testVm" -OsType "Linux" -OsDiskName "testOsDisk" -VmSize "Standard_K8S_v1" -AdminUsername "localadmin" -ComputerName "testVm" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmvirtualmachine +#> +function New-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='ByImageId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter(Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # OsType - string specifying whether the OS is Linux or Windows + ${OsType}, + + [Parameter(ParameterSetName='ByImageId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource ID of the image to create the VM with. + ${ImageId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # Maximum Dynamic Memory + ${DynamicMemoryMaximumMemoryInMb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # Minimum Dynamic Memory + ${DynamicMemoryMinimumMemoryInMb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # Defines the amount of extra memory that should be reserved for a virtual machine at runtime, as a percentage of the total memory that the virtual machine is thought to need. + # This only applies to virtual systems with dynamic memory enabled. + # This property can be in the range of 5 to 2000. + ${DynamicMemoryTargetBuffer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # RAM in MB for the virtual machine + ${VmMemoryInMB}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # Number of processors for the virtual machine + ${VmProcessor}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum] + # Size of the VM. + # Can be a Predefined size or Custom. + # Possible Predefined Sizes include - Custom,Standard_A2_v2,Standard_A4_v2,Standard_D16s_v3,Standard_D2s_v3,Standard_D32s_v3,Standard_D4s_v3,Standard_D8s_v3,Standard_DS13_v2,Standard_DS2_v2,Standard_DS3_v2,Standard_DS4_v2,Standard_DS5_v2,Standard_K8S2_v1,Standard_K8S3_v1,Standard_K8S4_v1,Standard_K8S5_v1,Standard_K8S_v1,Standard_NK12,Standard_NK6,Standard_NV12, StandardNv6 + ${VmSize}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType] + # The identity type. + ${IdentityType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # DisablePasswordAuthentication - whether password authentication should be disabled + ${DisablePasswordAuthentication}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine creation process. + # VM Agent is provsioned by default. + # Please pass -ProvisionVMAgent:$false to disable. + ${ProvisionVMAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether virtual machine configuration agent should be provisioned on the virtual machine. + # When this property is not specified, default behavior is to set it to true. + # VM Config Agent is provisioned by default. + # Please pass -ProvisionVMConfigAgent:$false to disable. + ${ProvisionVMConfigAgent}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # NetworkInterfaces - list of network interfaces to be attached to the virtual machine in ARM Id format. + ${NicId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # NetworkInterfaces - list of network interfaces to be attached to the virtual machine in name format. + ${NicName}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # NetworkInterfaces - Resource Group of Network Interfaces. + ${NicResourceGroup}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # Data Disks - List of data disks to be attached to the virtual machine in id format. + ${DataDiskId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # Data Disks - List of data disks to be attached to the virtual machine in name format . + ${DataDiskName}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Data Disks - Resource Group of Data Disks. + ${DataDiskResourceGroup}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # AdminPassword - admin password + ${AdminPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # AdminUsername - admin username + ${AdminUsername}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # ComputerName - name of the computer + ${ComputerName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether or not to enable TPM + ${EnableTpm}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # PublicKeys - The list of SSH public keys used to authenticate with VMs + ${SshPublicKey}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Id of the storage container that hosts the VM configuration file + ${StoragePathId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Name of the storage container that hosts the VM configuration file + ${StoragePathName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage Container resource group. + # The resource group of the virtual machine will be used if this value is not provided. + ${StoragePathResourceGroup}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Specifies whether secure boot should be enabled on the virtual machine. + ${SecureBootEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Specifies Whether to EnableAutomaticUpdates on the machine. + ${EnableAutomaticUpdate}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # TimeZone for the virtual machine + ${TimeZone}, + + [Parameter(ParameterSetName='ByImageName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Name of the image to create the VM with. + ${ImageName}, + + [Parameter(ParameterSetName='ByImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource group of the image to create the VM from. + ${ImageResourceGroup}, + + [Parameter(ParameterSetName='ByOsDiskId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource ID of the OS disk + ${OSDiskId}, + + [Parameter(ParameterSetName='ByOsDiskName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Name of the OS disk + ${OSDiskName}, + + [Parameter(ParameterSetName='ByOsDiskName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource Group of the OS disk + ${OSDiskResourceGroup}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByImageId = 'Az.StackHCIVm.custom\New-AzStackHCIVmVirtualMachine'; + ByImageName = 'Az.StackHCIVm.custom\New-AzStackHCIVmVirtualMachine'; + ByOsDiskId = 'Az.StackHCIVm.custom\New-AzStackHCIVmVirtualMachine'; + ByOsDiskName = 'Az.StackHCIVm.custom\New-AzStackHCIVmVirtualMachine'; + } + if (('ByImageId', 'ByImageName', 'ByOsDiskId', 'ByOsDiskName') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/ProxyCmdletDefinitions.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/ProxyCmdletDefinitions.ps1 new file mode 100644 index 000000000000..8e5033d166a4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/ProxyCmdletDefinitions.ps1 @@ -0,0 +1,6298 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets a logical network +.Description +Gets a logical network +.Example +Get-AzStackHCIVmLogicalNetwork -Name 'testLnet' -ResourceGroupName 'test-rg' +.Example +Get-AzStackHCIVmLogicalNetwork -ResourceGroupName 'test-rg' + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmlogicalnetwork +#> +function Get-AzStackHCIVmLogicalNetwork { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('LogicalNetworkName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the logical network + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM ID of the logical network. + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmLogicalNetwork_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmLogicalNetwork_List'; + List1 = 'Az.StackHCIVm.private\Get-AzStackHCIVmLogicalNetwork_List1'; + ByResourceId = 'Az.StackHCIVm.custom\Get-AzStackHCIVmLogicalNetwork_ByResourceId'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets a network interface +.Description +Gets a network interface +.Example +Get-AzStackHCIVmNetworkInterface -Name 'testNic' -ResourceGroupName 'test-rg' +.Example +Get-AzStackHCIVmNetworkInterface -ResourceGroupName 'test-rg' + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmnetworkinterface +#> +function Get-AzStackHCIVmNetworkInterface { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('NetworkInterfaceName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the network interface + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Id of the network interface. + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmNetworkInterface_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmNetworkInterface_List'; + List1 = 'Az.StackHCIVm.private\Get-AzStackHCIVmNetworkInterface_List1'; + ByResourceId = 'Az.StackHCIVm.custom\Get-AzStackHCIVmNetworkInterface_ByResourceId'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets a storage container +.Description +Gets a storage container +.Example +Get-AzStackHCIVmStoragePath -Name "testStoragePath" -ResourceGroupName "test-rg" +.Example +Get-AzStackHCIVmStoragePath -ResourceGroupName "test-rg" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmstoragepath +#> +function Get-AzStackHCIVmStoragePath { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('StorageContainerName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the storage container + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM ID of the storage path. + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmStoragePath_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmStoragePath_List'; + List1 = 'Az.StackHCIVm.private\Get-AzStackHCIVmStoragePath_List1'; + ByResourceId = 'Az.StackHCIVm.custom\Get-AzStackHCIVmStoragePath_ByResourceId'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets a virtual hard disk +.Description +Gets a virtual hard disk +.Example +Get-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" +.Example +Get-AzStackHCIVmVirtualHardDisk -ResourceGroupName "test-rg" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmvirtualharddisk +#> +function Get-AzStackHCIVmVirtualHardDisk { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('VirtualHardDiskName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual hard disk + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM ID of the virtual hard disk. + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmVirtualHardDisk_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmVirtualHardDisk_List'; + List1 = 'Az.StackHCIVm.private\Get-AzStackHCIVmVirtualHardDisk_List1'; + ByResourceId = 'Az.StackHCIVm.custom\Get-AzStackHCIVmVirtualHardDisk_ByResourceId'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to update a logical network. +.Description +The operation to update a logical network. +.Example +Update-AzStackHCIVmLogicalNetwork -Name "testLnet" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmlogicalnetwork +#> +function Update-AzStackHCIVmLogicalNetwork { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('LogicalNetworkName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the logical network + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual network. + ${ResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmLogicalNetwork_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmLogicalNetwork_UpdateViaIdentityExpanded'; + ByResourceId = 'Az.StackHCIVm.custom\Update-AzStackHCIVmLogicalNetwork_ByResourceId'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to update a network interface. +.Description +The operation to update a network interface. +.Example +Update-AzStackHCIVmNetworkInterface -Name "testNic" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmnetworkinterface +#> +function Update-AzStackHCIVmNetworkInterface { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('NetworkInterfaceName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the network interface + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the network interface. + ${ResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmNetworkInterface_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmNetworkInterface_UpdateViaIdentityExpanded'; + ByResourceId = 'Az.StackHCIVm.custom\Update-AzStackHCIVmNetworkInterface_ByResourceId'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to update a storage container. +.Description +The operation to update a storage container. +.Example +Update-AzStackHCIVmStoragePath -Name "testVhd" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmstoragepath +#> +function Update-AzStackHCIVmStoragePath { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('StorageContainerName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the storage container + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the storage path. + ${ResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmStoragePath_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmStoragePath_UpdateViaIdentityExpanded'; + ByResourceId = 'Az.StackHCIVm.custom\Update-AzStackHCIVmStoragePath_ByResourceId'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to update a virtual hard disk. +.Description +The operation to update a virtual hard disk. +.Example +Update-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmvirtualharddisk +#> +function Update-AzStackHCIVmVirtualHardDisk { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('VirtualHardDiskName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual hard disk + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual hard disk . + ${ResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmVirtualHardDisk_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmVirtualHardDisk_UpdateViaIdentityExpanded'; + ByResourceId = 'Az.StackHCIVm.custom\Update-AzStackHCIVmVirtualHardDisk_ByResourceId'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to add a data disk to a virtual machine. +.Description +The operation to add a data disk to a virtual machine. +.Example + Add-AzStackHCIVmVirtualMachineDataDisk -Name 'testVm' -ResourceGroupName 'test-rg' -DataDiskName 'testVhd' + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/add-azstackhcivmvirtualmachinedatadisk +#> +function Add-AzStackHCIVmVirtualMachineDataDisk { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the VM + ${ResourceId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # List of data disks to be attached to the virtual machine passed in Id format + ${DataDiskId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # List of data disks to be attached to the virtual machine passed by Name + ${DataDiskName}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource Group of the Data Disks + ${DataDiskResourceGroup} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Add-AzStackHCIVmVirtualMachineDataDisk'; + ByResourceId = 'Az.StackHCIVm.custom\Add-AzStackHCIVmVirtualMachineDataDisk'; + } + if (('ByName') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to add a network interface to a virtual machine. +.Description +The operation to add a network interface to a virtual machine. +.Example +Add-AzStackHCIVmVirtualMachineNetworkInterface -Name 'testVm' -ResourceGroupName 'test-rg' -NicName 'testNic' + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/add-azstackhcivmvirtualmachinenetworkinterface +#> +function Add-AzStackHCIVmVirtualMachineNetworkInterface { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Id of the Virtual Machine + ${ResourceId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # NetworkInterfaces - list of network interfaces to be attached to the virtual machine in id format + ${NicId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # NetworkInterfaces - list of network interfaces to be attached to the virtual machine in name format + ${NicName}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource Group of the Network Interfaces + ${NicResourceGroup} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Add-AzStackHCIVmVirtualMachineNetworkInterface'; + ByResourceId = 'Az.StackHCIVm.custom\Add-AzStackHCIVmVirtualMachineNetworkInterface'; + } + if (('ByName') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets a gallery image +.Description +Gets a gallery image +.Example +Get-AzStackHCIVmImage -Name "testimage" -ResourceGroupName "test-rg" +.Example +Get-AzStackHCIVmImage -ResourceGroupName 'test-rg' + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmimage +#> +function Get-AzStackHCIVmImage { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages], [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages])] +[CmdletBinding(DefaultParameterSetName='BySubscription', PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the image + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Parameter(ParameterSetName='ByResourceGroup', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource Id of the Image + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + BySubscription = 'Az.StackHCIVm.custom\Get-AzStackHCIVmImage'; + ByName = 'Az.StackHCIVm.custom\Get-AzStackHCIVmImage'; + ByResourceGroup = 'Az.StackHCIVm.custom\Get-AzStackHCIVmImage'; + ByResourceId = 'Az.StackHCIVm.custom\Get-AzStackHCIVmImage'; + } + if (('BySubscription', 'ByName', 'ByResourceGroup', 'ByResourceId') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets a virtual machine +.Description +Gets a virtual machine +.Example +Get-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" +.Example +Get-AzStackHCIVmVirtualMachine -ResourceGroupName "test-rg" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.Machine +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmvirtualmachine +#> +function Get-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.Machine], [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='BySubscription', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Parameter(ParameterSetName='ByResourceGroup', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceGroup')] + [Parameter(ParameterSetName='BySubscription')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM ID of the virtual machine. + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Get-AzStackHCIVmVirtualMachine'; + ByResourceGroup = 'Az.StackHCIVm.custom\Get-AzStackHCIVmVirtualMachine'; + BySubscription = 'Az.StackHCIVm.custom\Get-AzStackHCIVmVirtualMachine'; + ByResourceId = 'Az.StackHCIVm.custom\Get-AzStackHCIVmVirtualMachine'; + } + if (('ByName', 'ByResourceGroup', 'BySubscription') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to create an image. +Please note some properties can be set only during image creation. +.Description +The operation to create an image. +Please note some properties can be set only during image creation. +.Example +New-AzStackHCIVmImage -Name "testImage" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -ImagePath "C:\ClusterStorage\Volume1\Ubunut.vhdx" -OSType "Linux" -Location "eastus" +.Example +New-AzStackHCIVmImage -Name "testMarketplaceImage" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -Offer "windowsserver" -Publisher "MicrosoftWindowsServer" -Sku "2022-Datacenter" -Version "latest" -OSType "Windows" +.Example +New-AzStackHCIVmImage -Name "testMarketplaceImageURN" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -URN "microsoftwindowsserver:windowsserver:2022-datacenter:latest" -OSType "Windows" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmimage +#> +function New-AzStackHCIVmImage { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages], [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages])] +[CmdletBinding(DefaultParameterSetName='MarketplaceURN', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('ImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the Image + # The name must start and end with an alphanumeric character and must contain all alphanumeric characters or ‘-‘, ‘.’, or ‘_’. + # The max length can be 80 characters and the minimum length is 1 character. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The ARM Id of the extended location to create image resource in. + ${CustomLocationId}, + + [Parameter(Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes] + # Operating system type that the gallery image uses [Windows, Linux] + ${OSType}, + + [Parameter(ParameterSetName='MarketplaceURN', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The URN of the marketplace gallery image. + ${URN}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource] + # Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + ${CloudInitDataSource}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage Container Name of the storage container to be used for gallery image + ${StoragePathName}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource Group of the Storage Path. + # The Default value is the Resource Group of the Image. + ${StoragePathResourceGroup}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage ContainerID of the storage container to be used for gallery image + ${StoragePathId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter(ParameterSetName='GalleryImage', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Local path of image that the image should be created from. + # + # This parameter is required for non marketplace images. + ${ImagePath}, + + [Parameter(ParameterSetName='Marketplace', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the marketplae gallery image definition offer. + ${Offer}, + + [Parameter(ParameterSetName='Marketplace', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the marketplace gallery image definition publisher. + ${Publisher}, + + [Parameter(ParameterSetName='Marketplace', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the marketplace gallery image definition SKU. + ${Sku}, + + [Parameter(ParameterSetName='Marketplace', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The version of the marketplace gallery image. + ${Version}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + MarketplaceURN = 'Az.StackHCIVm.custom\New-AzStackHCIVmImage'; + GalleryImage = 'Az.StackHCIVm.custom\New-AzStackHCIVmImage'; + Marketplace = 'Az.StackHCIVm.custom\New-AzStackHCIVmImage'; + } + if (('MarketplaceURN', 'GalleryImage', 'Marketplace') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to create or update a logical network. +Please note some properties can be set only during logical network creation. +.Description +The operation to create or update a logical network. +Please note some properties can be set only during logical network creation. +.Example +New-AzStackHCIVmLogicalNetwork -Name "testLnet" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -VmSwitchName "testswitch" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmlogicalnetwork +#> +function New-AzStackHCIVmLogicalNetwork { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks])] +[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('LogicalNetworkName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual network + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # The list of DNS servers IP addresses. + ${DnsServer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Name of the network switch to be used for VMs + ${VMSwitchName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # List of address prefixes for the subnet. + ${AddressPrefix}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The IP address allocation method. + # Possible values include: 'Static', 'Dynamic' + ${IpAllocationMethod}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # End of the ip address pool + ${IpPoolEnd}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Start of the ip address pool + ${IpPoolStart}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPPoolTypeEnum])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Ip pool type + ${IpPoolType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Collections.Hashtable[]] + # Network associated pool of IP Addresses + ${IpPool}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Collections.Hashtable[]] + # Collection of routes contained within a route table. + ${Route}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Name of the subnet + ${SubnetName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Collections.Hashtable[]] + # List of subnets under the virtual network + ${Subnet}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # Vlan to use for the subnet + ${Vlan}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.StackHCIVm.custom\New-AzStackHCIVmLogicalNetwork'; + } + if (('__AllParameterSets') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to create or update a network interface. +Please note some properties can be set only during network interface creation. +.Description +The operation to create or update a network interface. +Please note some properties can be set only during network interface creation. +.Example +New-AzStackHCIVmNetworkInterface -Name "testNic" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -SubnetName "testLnet" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmnetworkinterface +#> +function New-AzStackHCIVmNetworkInterface { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces])] +[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('NetworkInterfaceName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the Network Interface + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # List of DNS server IP Addresses for the interface + ${DnsServer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # PrivateIPAddress - Private IP address of the IP configuration. + ${IpAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # MacAddress - The MAC address of the network interface. + ${MacAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The ARM resource id of the Subnet. + ${SubnetId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the Subnet. + ${SubnetName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource Group of the Subnet. + ${SubnetResourceGroup}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Collections.Hashtable[]] + # A list of IPConfigurations of the network interface. + ${IpConfiguration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.StackHCIVm.custom\New-AzStackHCIVmNetworkInterface'; + } + if (('__AllParameterSets') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to create or update a storage container. +Please note some properties can be set only during storage container creation. +.Description +The operation to create or update a storage container. +Please note some properties can be set only during storage container creation. +.Example +New-AzStackHCIVmStoragePath -Name "testStoragePath" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}"-Location "eastus" -Path "C:\ClusterStorage\Volume1\testpath" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmstoragepath +#> +function New-AzStackHCIVmStoragePath { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers])] +[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('StorageContainerName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the storage container + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Path of the storage container on the disk + ${Path}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.StackHCIVm.custom\New-AzStackHCIVmStoragePath'; + } + if (('__AllParameterSets') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to create or update a virtual hard disk. +Please note some properties can be set only during virtual hard disk creation. +.Description +The operation to create or update a virtual hard disk. +Please note some properties can be set only during virtual hard disk creation. +.Example +New-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -SizeGb 2 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmvirtualharddisk +#> +function New-AzStackHCIVmVirtualHardDisk { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks])] +[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('VirtualHardDiskName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual hard disk. + # + # Must contain all alphanumeric characters or ‘-’ or ‘_’. + # Max length is 80 characters, and min length is 1 character. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The ARM Id of the extended location to create virtual hard disk resource in. + ${CustomLocationId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # The block size, in bytes, of the virtual hard disk. + ${BlockSizeByte}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage ContainerID of the storage container to be used for VHD + ${StoragePathId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage Container Name to be used for the VHD + ${StoragePathName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage Container resource group. + # The resource group of the virtual hard disk will be used if this value is not provided. + ${StoragePathResourceGroup}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat] + # The format of the actual VHD file [vhd, vhdx] + ${DiskFileFormat}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # Size of the disk in GB + ${SizeGb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Boolean for enabling dynamic sizing on the virtual hard disk + ${Dynamic}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration] + # The hypervisor generation of the Virtual Machine [V1, V2] + ${HyperVGeneration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # Logical Sector Bytes of the Disk + ${LogicalSectorByte}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # Physical Sector Bytes of the Disk + ${PhysicalSectorByte}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + __AllParameterSets = 'Az.StackHCIVm.custom\New-AzStackHCIVmVirtualHardDisk'; + } + if (('__AllParameterSets') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to create or update a virtual machine. +Please note some properties can be set only during virtual machine creation. +.Description +The operation to create or update a virtual machine. +Please note some properties can be set only during virtual machine creation. +.Example +New-AzStackHCIVmVirtualMachine -Name "testVm" -OsType "Linux" -ImageName "testImage" -VmSize "Standard_K8S_v1" -AdminUsername "localadmin" -ComputerName "testVm" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" +.Example +New-AzStackHCIVmVirtualMachine -Name "testVm" -OsType "Linux" -OsDiskName "testOsDisk" -VmSize "Standard_K8S_v1" -AdminUsername "localadmin" -ComputerName "testVm" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmvirtualmachine +#> +function New-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='ByImageId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter(Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # OsType - string specifying whether the OS is Linux or Windows + ${OsType}, + + [Parameter(ParameterSetName='ByImageId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource ID of the image to create the VM with. + ${ImageId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # Maximum Dynamic Memory + ${DynamicMemoryMaximumMemoryInMb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # Minimum Dynamic Memory + ${DynamicMemoryMinimumMemoryInMb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # Defines the amount of extra memory that should be reserved for a virtual machine at runtime, as a percentage of the total memory that the virtual machine is thought to need. + # This only applies to virtual systems with dynamic memory enabled. + # This property can be in the range of 5 to 2000. + ${DynamicMemoryTargetBuffer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # RAM in MB for the virtual machine + ${VmMemoryInMB}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # Number of processors for the virtual machine + ${VmProcessor}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum] + # Size of the VM. + # Can be a Predefined size or Custom. + # Possible Predefined Sizes include - Custom,Standard_A2_v2,Standard_A4_v2,Standard_D16s_v3,Standard_D2s_v3,Standard_D32s_v3,Standard_D4s_v3,Standard_D8s_v3,Standard_DS13_v2,Standard_DS2_v2,Standard_DS3_v2,Standard_DS4_v2,Standard_DS5_v2,Standard_K8S2_v1,Standard_K8S3_v1,Standard_K8S4_v1,Standard_K8S5_v1,Standard_K8S_v1,Standard_NK12,Standard_NK6,Standard_NV12, StandardNv6 + ${VmSize}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType] + # The identity type. + ${IdentityType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # DisablePasswordAuthentication - whether password authentication should be disabled + ${DisablePasswordAuthentication}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine creation process. + # VM Agent is provsioned by default. + # Please pass -ProvisionVMAgent:$false to disable. + ${ProvisionVMAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether virtual machine configuration agent should be provisioned on the virtual machine. + # When this property is not specified, default behavior is to set it to true. + # VM Config Agent is provisioned by default. + # Please pass -ProvisionVMConfigAgent:$false to disable. + ${ProvisionVMConfigAgent}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # NetworkInterfaces - list of network interfaces to be attached to the virtual machine in ARM Id format. + ${NicId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # NetworkInterfaces - list of network interfaces to be attached to the virtual machine in name format. + ${NicName}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # NetworkInterfaces - Resource Group of Network Interfaces. + ${NicResourceGroup}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # Data Disks - List of data disks to be attached to the virtual machine in id format. + ${DataDiskId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # Data Disks - List of data disks to be attached to the virtual machine in name format . + ${DataDiskName}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Data Disks - Resource Group of Data Disks. + ${DataDiskResourceGroup}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # AdminPassword - admin password + ${AdminPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # AdminUsername - admin username + ${AdminUsername}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # ComputerName - name of the computer + ${ComputerName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether or not to enable TPM + ${EnableTpm}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # PublicKeys - The list of SSH public keys used to authenticate with VMs + ${SshPublicKey}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Id of the storage container that hosts the VM configuration file + ${StoragePathId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Name of the storage container that hosts the VM configuration file + ${StoragePathName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage Container resource group. + # The resource group of the virtual machine will be used if this value is not provided. + ${StoragePathResourceGroup}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Specifies whether secure boot should be enabled on the virtual machine. + ${SecureBootEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Specifies Whether to EnableAutomaticUpdates on the machine. + ${EnableAutomaticUpdate}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # TimeZone for the virtual machine + ${TimeZone}, + + [Parameter(ParameterSetName='ByImageName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Name of the image to create the VM with. + ${ImageName}, + + [Parameter(ParameterSetName='ByImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource group of the image to create the VM from. + ${ImageResourceGroup}, + + [Parameter(ParameterSetName='ByOsDiskId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource ID of the OS disk + ${OSDiskId}, + + [Parameter(ParameterSetName='ByOsDiskName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Name of the OS disk + ${OSDiskName}, + + [Parameter(ParameterSetName='ByOsDiskName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource Group of the OS disk + ${OSDiskResourceGroup}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByImageId = 'Az.StackHCIVm.custom\New-AzStackHCIVmVirtualMachine'; + ByImageName = 'Az.StackHCIVm.custom\New-AzStackHCIVmVirtualMachine'; + ByOsDiskId = 'Az.StackHCIVm.custom\New-AzStackHCIVmVirtualMachine'; + ByOsDiskName = 'Az.StackHCIVm.custom\New-AzStackHCIVmVirtualMachine'; + } + if (('ByImageId', 'ByImageName', 'ByOsDiskId', 'ByOsDiskName') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to delete an image. +.Description +The operation to delete an image. +.Example +Remove-AzStackHCIVmImage -Name "testImage" -ResourceGroupName "test-rg" + +.Outputs +System.Boolean +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmimage +#> +function Remove-AzStackHCIVmImage { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the gallery image + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the image. + ${ResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Forces the cmdlet to remove the network interface without prompting for confirmation. + ${Force} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmImage'; + ByResourceId = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmImage'; + } + if (('ByName', 'ByResourceId') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to delete a logical network. +.Description +The operation to delete a logical network. +.Example +Remove-AzStackHCIVmLogicalNetwork -Name "testLnet" -ResourceGroupName "test-rg" + +.Outputs +System.Boolean +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmlogicalnetwork +#> +function Remove-AzStackHCIVmLogicalNetwork { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('LogicalNetworkName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual network + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual network. + ${ResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Forces the cmdlet to remove the virtual network without prompting for confirmation. + ${Force} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmLogicalNetwork'; + ByResourceId = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmLogicalNetwork'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to delete a network interface. +.Description +The operation to delete a network interface. +.Example +Remove-AzStackHCIVmLogicalNetwork -Name "testNic" -ResourceGroupName "test-rg" + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHCIVmIdentity +.Outputs +System.Boolean +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmnetworkinterface +#> +function Remove-AzStackHCIVmNetworkInterface { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the network interface. + ${ResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('NetworkInterfaceName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the network interface + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Forces the cmdlet to remove the network interface without prompting for confirmation. + ${Force} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByResourceId = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmNetworkInterface'; + ByName = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmNetworkInterface'; + } + if (('ByResourceId', 'ByName') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to delete a storage container. +.Description +The operation to delete a storage container. +.Example + Remove-AzStackHCIVmStoragePath -Name "testStoragePath" -ResourceGroupName "test-rg" + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHCIVmIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmstoragepath +#> +function Remove-AzStackHCIVmStoragePath { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('StorageContainerName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the storage container + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the storage path. + ${ResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Forces the cmdlet to remove the storage path without prompting for confirmation. + ${Force}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmStoragePath'; + ByResourceId = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmStoragePath'; + } + if (('ByName', 'ByResourceId') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to delete a virtual hard disk. +.Description +The operation to delete a virtual hard disk. +.Example +Remove-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" + + +.Outputs +System.Boolean +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualharddisk +#> +function Remove-AzStackHCIVmVirtualHardDisk { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualHardDiskName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual hard disk + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual hard disk. + ${ResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Forces the cmdlet to remove the virtual hard disk without prompting for confirmation. + ${Force} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmVirtualHardDisk'; + ByResourceId = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmVirtualHardDisk'; + } + if (('ByName', 'ByResourceId') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to delete a virtual machine. +.Description +The operation to delete a virtual machine. +.Example +Remove-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHCIVmIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualmachine +#> +function Remove-AzStackHCIVmVirtualMachine { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual machine. + ${ResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Forces the cmdlet to remove the virtual machine without prompting for confirmation. + ${Force}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmVirtualMachine'; + ByResourceId = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmVirtualMachine'; + } + if (('ByName', 'ByResourceId') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to delete a data disk from a virtual machine. +.Description +The operation to delete a data disk from a virtual machine. +.Example +Remove-AzStackHCIVmVirtualMachineDataDisk -Name "testVm" -ResourceGroupName "test-rg" -DataDiskName "testVhd" + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualmachinedatadisk +#> +function Remove-AzStackHCIVmVirtualMachineDataDisk { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual machine. + ${ResourceId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # Data Disks - list of data disks to be removed from the virtual machine in id format. + ${DataDiskId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # Data Disks - list of data disks to be removed from the virtual machine in name format. + ${DataDiskName}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource Group of the Data Disks. + ${DataDiskResourceGroup} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmVirtualMachineDataDisk'; + ByResourceId = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmVirtualMachineDataDisk'; + } + if (('ByName') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to delete a network interface from a virtual machine. +.Description +The operation to delete a network interface from a virtual machine. +.Example +Remove-AzStackHCIVmVirtualMachineNetworkInterface -Name "testVm" -ResourceGroupName "test-rg" -NicName 'testNic' + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualmachinenetworkinterface +#> +function Remove-AzStackHCIVmVirtualMachineNetworkInterface { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual machine. + ${ResourceId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # NetworkInterfaces - list of network interfaces to be attached from the virtual machine in id format. + ${NicId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # NetworkInterfaces - list of network interfaces to be removed from the virtual machine in name format. + ${NicName}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # NetworkInterfaces - resource group of the network interfaces + ${NicResourceGroup} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmVirtualMachineNetworkInterface'; + ByResourceId = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmVirtualMachineNetworkInterface'; + } + if (('ByName') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to restart a virtual machine instance. +.Description +The operation to restart a virtual machine instance. +.Example +Restart-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/restart-azstackhcivmvirtualmachine +#> +function Restart-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual machine. + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Restart-AzStackHCIVmVirtualMachine'; + ByResourceId = 'Az.StackHCIVm.custom\Restart-AzStackHCIVmVirtualMachine'; + } + if (('ByName') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to start a virtual machine instance. +.Description +The operation to start a virtual machine instance. +.Example +Start-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/start-azstackhcivmvirtualmachine +#> +function Start-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual machine. + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Start-AzStackHCIVmVirtualMachine'; + ByResourceId = 'Az.StackHCIVm.custom\Start-AzStackHCIVmVirtualMachine'; + } + if (('ByName') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to stop a virtual machine instance. +.Description +The operation to stop a virtual machine instance. +.Example +Stop-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHCIVmIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/stop-azstackhcivmvirtualmachine +#> +function Stop-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual machine. + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Stop-AzStackHCIVmVirtualMachine'; + ByResourceId = 'Az.StackHCIVm.custom\Stop-AzStackHCIVmVirtualMachine'; + } + if (('ByName') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to update an image. +.Description +The operation to update an image. +Please note some properties can be set only during image creation. +.Example +Update-AzStackHCIVmImage -Name "testImage" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmimage +#> +function Update-AzStackHCIVmImage { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages], [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages])] +[CmdletBinding(DefaultParameterSetName='GalleryImage', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the gallery image + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the image. + ${ResourceId}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + GalleryImage = 'Az.StackHCIVm.custom\Update-AzStackHCIVmImage'; + ByName = 'Az.StackHCIVm.custom\Update-AzStackHCIVmImage'; + ByResourceId = 'Az.StackHCIVm.custom\Update-AzStackHCIVmImage'; + } + if (('ByName', 'ByResourceId') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to update a virtual machine instance. +.Description +The operation to update a virtual machine instance. +.Example +Update-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" -VmMemoryInMB "4" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmvirtualmachine +#> +function Update-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual network. + ${ResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether virtual machine agent should be provisioned on the virtual machine. + ${ProvisionVMAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether virtual machine configuration agent should be provisioned on the virtual machine. + ${ProvisionVMConfigAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # RAM in MB for the virtual machine instance + ${VmMemoryInMB}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # number of processors for the virtual machine instance + ${VmProcessor}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum] + # . + ${VmSize}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Update-AzStackHCIVmVirtualMachine'; + ByResourceId = 'Az.StackHCIVm.custom\Update-AzStackHCIVmVirtualMachine'; + } + if (('ByName') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/README.md b/src/StackHCI/StackHCIVm.Autorest/exports/README.md new file mode 100644 index 000000000000..f5e26d66b5f1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/README.md @@ -0,0 +1,20 @@ +# Exports +This directory contains the cmdlets *exported by* `Az.StackHCIVm`. No other cmdlets in this repository are directly exported. What that means is the `Az.StackHCIVm` 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 `..\custom` for all custom implementation. + +## Info +- Modifiable: no +- Generated: all +- Committed: no +- Packaged: yes + +## Details +The cmdlets generated here are created every time you run `build-module.ps1`. These cmdlets are a merge of all (excluding `InternalExport`) cmdlets from the private binary (`..\bin\Az.StackHCIVm.private.dll`) and from the `..\custom\Az.StackHCIVm.custom.psm1` module. Cmdlets that are *not merged* from those directories are decorated with the `InternalExport` attribute. This happens when you set the cmdlet to **hide** from configuration. For more information on hiding, see [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) or the [README.md](..\internal/README.md) in the `..\internal` folder. + +## Purpose +We generate script cmdlets out of the binary cmdlets and custom cmdlets. The format of script cmdlets are simplistic; thus, easier to generate at build time. Generating the cmdlets is required as to allow merging of generated binary, hand-written binary, and hand-written custom cmdlets. For Azure cmdlets, having script cmdlets simplifies the mechanism for exporting Azure profiles. + +## Structure +The cmdlets generated here will flat in the directory (no sub-folders) as long as there are no Azure profiles specified for any cmdlets. Azure profiles (the `Profiles` attribute) is only applied when generating with the `--azure` attribute (or `azure: true` in the configuration). When Azure profiles are applied, the folder structure has a folder per profile. Each profile folder has only those cmdlets that apply to that profile. + +## Usage +When `./Az.StackHCIVm.psm1` is loaded, it dynamically exports cmdlets here based on the folder structure and on the selected profile. If there are no sub-folders, it exports all cmdlets at the root of this folder. If there are sub-folders, it checks to see the selected profile. If no profile is selected, it exports the cmdlets in the last sub-folder (alphabetically). If a profile is selected, it exports the cmdlets in the sub-folder that matches the profile name. If there is no sub-folder that matches the profile name, it exports no cmdlets and writes a warning message. \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmImage.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmImage.ps1 new file mode 100644 index 000000000000..7996c698ead7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmImage.ps1 @@ -0,0 +1,147 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete an image. +.Description +The operation to delete an image. +.Example +Remove-AzStackHCIVmImage -Name "testImage" -ResourceGroupName "test-rg" + +.Outputs +System.Boolean +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmimage +#> +function Remove-AzStackHCIVmImage { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the gallery image + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the image. + ${ResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Forces the cmdlet to remove the network interface without prompting for confirmation. + ${Force} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmImage'; + ByResourceId = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmImage'; + } + if (('ByName', 'ByResourceId') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmLogicalNetwork.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmLogicalNetwork.ps1 new file mode 100644 index 000000000000..01c4e61e4a8a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmLogicalNetwork.ps1 @@ -0,0 +1,148 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a logical network. +.Description +The operation to delete a logical network. +.Example +Remove-AzStackHCIVmLogicalNetwork -Name "testLnet" -ResourceGroupName "test-rg" + +.Outputs +System.Boolean +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmlogicalnetwork +#> +function Remove-AzStackHCIVmLogicalNetwork { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('LogicalNetworkName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual network + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual network. + ${ResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Forces the cmdlet to remove the virtual network without prompting for confirmation. + ${Force} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmLogicalNetwork'; + ByResourceId = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmLogicalNetwork'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmNetworkInterface.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmNetworkInterface.ps1 new file mode 100644 index 000000000000..6e10026f6e8d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmNetworkInterface.ps1 @@ -0,0 +1,150 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a network interface. +.Description +The operation to delete a network interface. +.Example +Remove-AzStackHCIVmLogicalNetwork -Name "testNic" -ResourceGroupName "test-rg" + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHCIVmIdentity +.Outputs +System.Boolean +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmnetworkinterface +#> +function Remove-AzStackHCIVmNetworkInterface { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the network interface. + ${ResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('NetworkInterfaceName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the network interface + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Forces the cmdlet to remove the network interface without prompting for confirmation. + ${Force} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByResourceId = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmNetworkInterface'; + ByName = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmNetworkInterface'; + } + if (('ByResourceId', 'ByName') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmStoragePath.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmStoragePath.ps1 new file mode 100644 index 000000000000..87053a08a3d0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmStoragePath.ps1 @@ -0,0 +1,247 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a storage container. +.Description +The operation to delete a storage container. +.Example + Remove-AzStackHCIVmStoragePath -Name "testStoragePath" -ResourceGroupName "test-rg" + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHCIVmIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmstoragepath +#> +function Remove-AzStackHCIVmStoragePath { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('StorageContainerName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the storage container + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the storage path. + ${ResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Forces the cmdlet to remove the storage path without prompting for confirmation. + ${Force}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmStoragePath'; + ByResourceId = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmStoragePath'; + } + if (('ByName', 'ByResourceId') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmVirtualHardDisk.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmVirtualHardDisk.ps1 new file mode 100644 index 000000000000..5f947853cf76 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmVirtualHardDisk.ps1 @@ -0,0 +1,149 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a virtual hard disk. +.Description +The operation to delete a virtual hard disk. +.Example +Remove-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" + + +.Outputs +System.Boolean +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualharddisk +#> +function Remove-AzStackHCIVmVirtualHardDisk { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualHardDiskName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual hard disk + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual hard disk. + ${ResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Forces the cmdlet to remove the virtual hard disk without prompting for confirmation. + ${Force} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmVirtualHardDisk'; + ByResourceId = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmVirtualHardDisk'; + } + if (('ByName', 'ByResourceId') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmVirtualMachine.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmVirtualMachine.ps1 new file mode 100644 index 000000000000..8621ad1b8c5b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmVirtualMachine.ps1 @@ -0,0 +1,241 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a virtual machine. +.Description +The operation to delete a virtual machine. +.Example +Remove-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHCIVmIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualmachine +#> +function Remove-AzStackHCIVmVirtualMachine { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual machine. + ${ResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Forces the cmdlet to remove the virtual machine without prompting for confirmation. + ${Force}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmVirtualMachine'; + ByResourceId = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmVirtualMachine'; + } + if (('ByName', 'ByResourceId') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmVirtualMachineDataDisk.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmVirtualMachineDataDisk.ps1 new file mode 100644 index 000000000000..2fff7ecf48ac --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmVirtualMachineDataDisk.ps1 @@ -0,0 +1,164 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a data disk from a virtual machine. +.Description +The operation to delete a data disk from a virtual machine. +.Example +Remove-AzStackHCIVmVirtualMachineDataDisk -Name "testVm" -ResourceGroupName "test-rg" -DataDiskName "testVhd" + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualmachinedatadisk +#> +function Remove-AzStackHCIVmVirtualMachineDataDisk { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual machine. + ${ResourceId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # Data Disks - list of data disks to be removed from the virtual machine in id format. + ${DataDiskId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # Data Disks - list of data disks to be removed from the virtual machine in name format. + ${DataDiskName}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource Group of the Data Disks. + ${DataDiskResourceGroup} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmVirtualMachineDataDisk'; + ByResourceId = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmVirtualMachineDataDisk'; + } + if (('ByName') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmVirtualMachineNetworkInterface.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmVirtualMachineNetworkInterface.ps1 new file mode 100644 index 000000000000..4329a0e7ab91 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Remove-AzStackHCIVmVirtualMachineNetworkInterface.ps1 @@ -0,0 +1,164 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a network interface from a virtual machine. +.Description +The operation to delete a network interface from a virtual machine. +.Example +Remove-AzStackHCIVmVirtualMachineNetworkInterface -Name "testVm" -ResourceGroupName "test-rg" -NicName 'testNic' + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualmachinenetworkinterface +#> +function Remove-AzStackHCIVmVirtualMachineNetworkInterface { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual machine. + ${ResourceId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # NetworkInterfaces - list of network interfaces to be attached from the virtual machine in id format. + ${NicId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # NetworkInterfaces - list of network interfaces to be removed from the virtual machine in name format. + ${NicName}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # NetworkInterfaces - resource group of the network interfaces + ${NicResourceGroup} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmVirtualMachineNetworkInterface'; + ByResourceId = 'Az.StackHCIVm.custom\Remove-AzStackHCIVmVirtualMachineNetworkInterface'; + } + if (('ByName') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Restart-AzStackHCIVmVirtualMachine.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Restart-AzStackHCIVmVirtualMachine.ps1 new file mode 100644 index 000000000000..35e86a3043a3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Restart-AzStackHCIVmVirtualMachine.ps1 @@ -0,0 +1,202 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to restart a virtual machine instance. +.Description +The operation to restart a virtual machine instance. +.Example +Restart-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/restart-azstackhcivmvirtualmachine +#> +function Restart-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual machine. + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Restart-AzStackHCIVmVirtualMachine'; + ByResourceId = 'Az.StackHCIVm.custom\Restart-AzStackHCIVmVirtualMachine'; + } + if (('ByName') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Start-AzStackHCIVmVirtualMachine.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Start-AzStackHCIVmVirtualMachine.ps1 new file mode 100644 index 000000000000..236d98d5ae0f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Start-AzStackHCIVmVirtualMachine.ps1 @@ -0,0 +1,202 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to start a virtual machine instance. +.Description +The operation to start a virtual machine instance. +.Example +Start-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/start-azstackhcivmvirtualmachine +#> +function Start-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual machine. + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Start-AzStackHCIVmVirtualMachine'; + ByResourceId = 'Az.StackHCIVm.custom\Start-AzStackHCIVmVirtualMachine'; + } + if (('ByName') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Stop-AzStackHCIVmVirtualMachine.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Stop-AzStackHCIVmVirtualMachine.ps1 new file mode 100644 index 000000000000..391a3e97a56c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Stop-AzStackHCIVmVirtualMachine.ps1 @@ -0,0 +1,204 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to stop a virtual machine instance. +.Description +The operation to stop a virtual machine instance. +.Example +Stop-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHCIVmIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/stop-azstackhcivmvirtualmachine +#> +function Stop-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual machine. + ${ResourceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Stop-AzStackHCIVmVirtualMachine'; + ByResourceId = 'Az.StackHCIVm.custom\Stop-AzStackHCIVmVirtualMachine'; + } + if (('ByName') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Update-AzStackHCIVmImage.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Update-AzStackHCIVmImage.ps1 new file mode 100644 index 000000000000..cd193228bcc8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Update-AzStackHCIVmImage.ps1 @@ -0,0 +1,154 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update an image. +.Description +The operation to update an image. +Please note some properties can be set only during image creation. +.Example +Update-AzStackHCIVmImage -Name "testImage" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmimage +#> +function Update-AzStackHCIVmImage { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages], [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages])] +[CmdletBinding(DefaultParameterSetName='GalleryImage', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the gallery image + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the image. + ${ResourceId}, + + [Parameter(ParameterSetName='ByName')] + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + GalleryImage = 'Az.StackHCIVm.custom\Update-AzStackHCIVmImage'; + ByName = 'Az.StackHCIVm.custom\Update-AzStackHCIVmImage'; + ByResourceId = 'Az.StackHCIVm.custom\Update-AzStackHCIVmImage'; + } + if (('ByName', 'ByResourceId') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Update-AzStackHCIVmLogicalNetwork.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Update-AzStackHCIVmLogicalNetwork.ps1 new file mode 100644 index 000000000000..4e511a99a38c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Update-AzStackHCIVmLogicalNetwork.ps1 @@ -0,0 +1,252 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update a logical network. +.Description +The operation to update a logical network. +.Example +Update-AzStackHCIVmLogicalNetwork -Name "testLnet" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmlogicalnetwork +#> +function Update-AzStackHCIVmLogicalNetwork { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('LogicalNetworkName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the logical network + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual network. + ${ResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmLogicalNetwork_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmLogicalNetwork_UpdateViaIdentityExpanded'; + ByResourceId = 'Az.StackHCIVm.custom\Update-AzStackHCIVmLogicalNetwork_ByResourceId'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Update-AzStackHCIVmNetworkInterface.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Update-AzStackHCIVmNetworkInterface.ps1 new file mode 100644 index 000000000000..3b86e4b3b66f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Update-AzStackHCIVmNetworkInterface.ps1 @@ -0,0 +1,252 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update a network interface. +.Description +The operation to update a network interface. +.Example +Update-AzStackHCIVmNetworkInterface -Name "testNic" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmnetworkinterface +#> +function Update-AzStackHCIVmNetworkInterface { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('NetworkInterfaceName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the network interface + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the network interface. + ${ResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmNetworkInterface_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmNetworkInterface_UpdateViaIdentityExpanded'; + ByResourceId = 'Az.StackHCIVm.custom\Update-AzStackHCIVmNetworkInterface_ByResourceId'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Update-AzStackHCIVmStoragePath.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Update-AzStackHCIVmStoragePath.ps1 new file mode 100644 index 000000000000..267d27e340d8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Update-AzStackHCIVmStoragePath.ps1 @@ -0,0 +1,252 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update a storage container. +.Description +The operation to update a storage container. +.Example +Update-AzStackHCIVmStoragePath -Name "testVhd" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmstoragepath +#> +function Update-AzStackHCIVmStoragePath { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('StorageContainerName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the storage container + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the storage path. + ${ResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmStoragePath_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmStoragePath_UpdateViaIdentityExpanded'; + ByResourceId = 'Az.StackHCIVm.custom\Update-AzStackHCIVmStoragePath_ByResourceId'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Update-AzStackHCIVmVirtualHardDisk.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Update-AzStackHCIVmVirtualHardDisk.ps1 new file mode 100644 index 000000000000..e5bb574d7121 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Update-AzStackHCIVmVirtualHardDisk.ps1 @@ -0,0 +1,252 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update a virtual hard disk. +.Description +The operation to update a virtual hard disk. +.Example +Update-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" -Tag @{"tagname" = "tagvalue"} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmvirtualharddisk +#> +function Update-AzStackHCIVmVirtualHardDisk { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks])] +[CmdletBinding(DefaultParameterSetName='ByResourceId', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('VirtualHardDiskName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual hard disk + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='ByResourceId')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual hard disk . + ${ResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(ParameterSetName='UpdateExpanded', DontShow)] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmVirtualHardDisk_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmVirtualHardDisk_UpdateViaIdentityExpanded'; + ByResourceId = 'Az.StackHCIVm.custom\Update-AzStackHCIVmVirtualHardDisk_ByResourceId'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/exports/Update-AzStackHCIVmVirtualMachine.ps1 b/src/StackHCI/StackHCIVm.Autorest/exports/Update-AzStackHCIVmVirtualMachine.ps1 new file mode 100644 index 000000000000..6549c4e0c341 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/exports/Update-AzStackHCIVmVirtualMachine.ps1 @@ -0,0 +1,232 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update a virtual machine instance. +.Description +The operation to update a virtual machine instance. +.Example +Update-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" -VmMemoryInMB "4" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmvirtualmachine +#> +function Update-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByName', Mandatory)] + [Alias('VirtualMachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual machine + ${Name}, + + [Parameter(ParameterSetName='ByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ByName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByResourceId', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The ARM Resource ID of the virtual network. + ${ResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether virtual machine agent should be provisioned on the virtual machine. + ${ProvisionVMAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether virtual machine configuration agent should be provisioned on the virtual machine. + ${ProvisionVMConfigAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # RAM in MB for the virtual machine instance + ${VmMemoryInMB}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # number of processors for the virtual machine instance + ${VmProcessor}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum] + # . + ${VmSize}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ByName = 'Az.StackHCIVm.custom\Update-AzStackHCIVmVirtualMachine'; + ByResourceId = 'Az.StackHCIVm.custom\Update-AzStackHCIVmVirtualMachine'; + } + if (('ByName') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generate-help.ps1 b/src/StackHCI/StackHCIVm.Autorest/generate-help.ps1 new file mode 100644 index 000000000000..9665d883f7c0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generate-help.ps1 @@ -0,0 +1,74 @@ +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$exportsFolder = Join-Path $PSScriptRoot 'exports' +if(-not (Test-Path $exportsFolder)) { + Write-Error "Exports folder '$exportsFolder' was not found." +} + +$directories = Get-ChildItem -Directory -Path $exportsFolder +$hasProfiles = ($directories | Measure-Object).Count -gt 0 +if(-not $hasProfiles) { + $directories = Get-Item -Path $exportsFolder +} + +$docsFolder = Join-Path $PSScriptRoot 'docs' +if(Test-Path $docsFolder) { + $null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue +} +$null = New-Item -ItemType Directory -Force -Path $docsFolder -ErrorAction SilentlyContinue +$examplesFolder = Join-Path $PSScriptRoot 'examples' + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.StackHCIVm.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +# Load DLL to use build-time cmdlets +Import-Module -Name $modulePath +Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.StackHCIVm.private.dll') +$instance = [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module]::Instance +# Module info is shared per profile +$moduleInfo = Get-Module -Name $moduleName + +foreach($directory in $directories) +{ + if($hasProfiles) { + Select-AzProfile -Name $directory.Name + } + # Reload module per profile + Import-Module -Name $modulePath -Force + + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $directory.FullName + $cmdletHelpInfo = $cmdletNames | ForEach-Object { Get-Help -Name $_ -Full } + $cmdletFunctionInfo = Get-ScriptCmdlet -ScriptFolder $directory.FullName -AsFunctionInfo + + $docsPath = Join-Path $docsFolder $directory.Name + $null = New-Item -ItemType Directory -Force -Path $docsPath -ErrorAction SilentlyContinue + $examplesPath = Join-Path $examplesFolder $directory.Name + $addComplexInterfaceInfo = ![System.Convert]::ToBoolean('true') + Export-HelpMarkdown -ModuleInfo $moduleInfo -FunctionInfo $cmdletFunctionInfo -HelpInfo $cmdletHelpInfo -DocsFolder $docsPath -ExamplesFolder $examplesPath -AddComplexInterfaceInfo:$addComplexInterfaceInfo + Write-Host -ForegroundColor Green "Created documentation in '$docsPath'" +} + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generate-info.json b/src/StackHCI/StackHCIVm.Autorest/generate-info.json new file mode 100644 index 000000000000..e96a563b1d35 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generate-info.json @@ -0,0 +1,8 @@ +{ + "autorest_core": "3.9.7", + "node": "v14.15.5", + "autorest_powershell": "3.0.512", + "autorest_modelerfour": "4.15.414", + "swagger_commit": "4a361fccb94e82da94a239d3563f1e3e3b9d007d", + "autorest": "`-- (empty)" +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generate-portal-ux.ps1 b/src/StackHCI/StackHCIVm.Autorest/generate-portal-ux.ps1 new file mode 100644 index 000000000000..425b6f01ee69 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generate-portal-ux.ps1 @@ -0,0 +1,375 @@ +# ---------------------------------------------------------------------------------- +# 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. +# +# This Script will create a folder dedicated to Azure-specific content and includes metadata files essential for enhancing the user experience (UX) within the Azure portal. +# These files are utilized by the Azure portal to effectively present the usage of cmdlets related to specific resources on portal pages. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$moduleName = 'Az.StackHCIVm' +$rootModuleName = 'Az.StackHCI' +if ($rootModuleName -eq "") +{ + $rootModuleName = $moduleName +} +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot "./$moduleName.psd1") +$modulePath = $modulePsd1.FullName + +# Load DLL to use build-time cmdlets +Import-Module -Name $modulePath +Import-Module -Name (Join-Path $PSScriptRoot "./bin/$moduleName.private.dll") +$instance = [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module]::Instance +# Module info is shared per profile +$moduleInfo = Get-Module -Name $moduleName +$parameterSetsInfo = Get-Module -Name "$moduleName.private" + +$buildinFunctions = @("Export-CmdletSurface", "Export-ExampleStub", "Export-FormatPs1xml", "Export-HelpMarkdown", "Export-ModelSurface", "Export-ProxyCmdlet", "Export-Psd1", "Export-TestStub", "Get-CommonParameter", "Get-ModuleGuid", "Get-ScriptCmdlet") + +function Test-FunctionSupported() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [string] + $FunctionName + ) + + If ($buildinfunctions.Contains($FunctionName)) { + return $false + } + + $cmdletName, $parameterSetName = $FunctionName.Split("_") + If ($parameterSetName.Contains("List") -or $parameterSetName.Contains("ViaIdentity")) { + return $false + } + If ($cmdletName.StartsWith("New") -or $cmdletName.StartsWith("Set") -or $cmdletName.StartsWith("Update")) { + return $false + } + + $parameterSetInfo = $parameterSetsInfo.ExportedCmdlets[$FunctionName] + foreach ($parameterInfo in $parameterSetInfo.Parameters.Values) + { + $category = (Get-ParameterAttribute -ParameterInfo $parameterInfo -AttributeName "CategoryAttribute").Categories + $invalideCategory = @('Query', 'Body') + if ($invalideCategory -contains $category) + { + return $false + } + } + + $customFiles = Get-ChildItem -Path custom -Filter "$cmdletName.*" + if ($customFiles.Length -ne 0) + { + return $false + } + + return $true +} + +function Get-MappedCmdletFromFunctionName() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [string] + $FunctionName + ) + + $cmdletName, $parameterSetName = $FunctionName.Split("_") + + return $cmdletName +} + +function Get-ParameterAttribute() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.ParameterMetadata] + $ParameterInfo, + [Parameter()] + [String] + $AttributeName + ) + return $ParameterInfo.Attributes | Where-Object { $_.TypeId.Name -eq $AttributeName } +} + +function Get-CmdletAttribute() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $CmdletInfo, + [Parameter()] + [String] + $AttributeName + ) + + return $CmdletInfo.ImplementingType.GetTypeInfo().GetCustomAttributes([System.object], $true) | Where-Object { $_.TypeId.Name -eq $AttributeName } +} + +function Get-CmdletDescription() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [String] + $CmdletName + ) + $helpInfo = Get-Help $CmdletName -Full + + $description = $helpInfo.Description.Text + if ($null -eq $description) + { + return "" + } + return $description +} + +# Test whether the parameter is from swagger http path +function Test-ParameterFromSwagger() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.ParameterMetadata] + $ParameterInfo + ) + $category = (Get-ParameterAttribute -ParameterInfo $ParameterInfo -AttributeName "CategoryAttribute").Categories + $doNotExport = Get-ParameterAttribute -ParameterInfo $ParameterInfo -AttributeName "DoNotExportAttribute" + if ($null -ne $doNotExport) + { + return $false + } + + $valideCategory = @('Path') + if ($valideCategory -contains $category) + { + return $true + } + return $false +} + +function New-ExampleForParameterSet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $ParameterSetInfo + ) + $parameters = $ParameterSetInfo.Parameters.Values | Where-Object { Test-ParameterFromSwagger $_ } + $result = @() + foreach ($parameter in $parameters) + { + $category = (Get-ParameterAttribute -parameterInfo $parameter -AttributeName "CategoryAttribute").Categories + $sourceName = (Get-ParameterAttribute -parameterInfo $parameter -AttributeName "InfoAttribute").SerializedName + $name = $parameter.Name + $result += [ordered]@{ + name = "-$Name" + value = "[$category.$sourceName]" + } + } + + return $result +} + +function New-ParameterArrayInParameterSet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $ParameterSetInfo + ) + $parameters = $ParameterSetInfo.Parameters.Values | Where-Object { Test-ParameterFromSwagger $_ } + $result = @() + foreach ($parameter in $parameters) + { + $isMandatory = (Get-ParameterAttribute -parameterInfo $parameter -AttributeName "ParameterAttribute").Mandatory + $parameterName = $parameter.Name + $parameterType = $parameter.ParameterType.ToString().Split('.')[1] + if ($parameter.SwitchParameter) + { + $parameterSignature = "-$parameterName" + } + else + { + $parameterSignature = "-$parameterName <$parameterType>" + } + if ($parameterName -eq "SubscriptionId") + { + $isMandatory = $false + } + if (-not $isMandatory) + { + $parameterSignature = "[$parameterSignature]" + } + $result += $parameterSignature + } + + return $result +} + +function New-MetadataForParameterSet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $ParameterSetInfo + ) + $httpAttribute = Get-CmdletAttribute -CmdletInfo $ParameterSetInfo -AttributeName "HttpPathAttribute" + $httpPath = $httpAttribute.Path + $apiVersion = $httpAttribute.ApiVersion + $provider = [System.Text.RegularExpressions.Regex]::New("/providers/([\w+\.]+)/").Match($httpPath).Groups[1].Value + $resourcePath = "/" + $httpPath.Split("$provider/")[1] + $resourceType = [System.Text.RegularExpressions.Regex]::New("/([\w]+)/\{\w+\}").Matches($resourcePath) | ForEach-Object {$_.groups[1].Value} | Join-String -Separator "/" + $cmdletName = Get-MappedCmdletFromFunctionName $ParameterSetInfo.Name + $description = (Get-CmdletAttribute -CmdletInfo $ParameterSetInfo -AttributeName "DescriptionAttribute").Description + [object[]]$example = New-ExampleForParameterSet $ParameterSetInfo + [string[]]$signature = New-ParameterArrayInParameterSet $ParameterSetInfo + + return @{ + Path = $httpPath + Provider = $provider + ResourceType = $resourceType + ApiVersion = $apiVersion + CmdletName = $cmdletName + Description = $description + Example = $example + Signature = @{ + parameters = $signature + } + } +} + +function Merge-WithExistCmdletMetadata() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Collections.Specialized.OrderedDictionary] + $ExistedCmdletInfo, + [Parameter()] + [Hashtable] + $ParameterSetMetadata + ) + $ExistedCmdletInfo.help.parameterSets += $ParameterSetMetadata.Signature + $ExistedCmdletInfo.examples += [ordered]@{ + description = $ParameterSetMetadata.Description + parameters = $ParameterSetMetadata.Example + } + + return $ExistedCmdletInfo +} + +function New-MetadataForCmdlet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [Hashtable] + $ParameterSetMetadata + ) + $cmdletName = $ParameterSetMetadata.CmdletName + $description = Get-CmdletDescription $cmdletName + $result = [ordered]@{ + name = $cmdletName + description = $description + path = $ParameterSetMetadata.Path + help = [ordered]@{ + learnMore = [ordered]@{ + url = "https://learn.microsoft.com/powershell/module/$rootModuleName/$cmdletName".ToLower() + } + parameterSets = @() + } + examples = @() + } + $result = Merge-WithExistCmdletMetadata -ExistedCmdletInfo $result -ParameterSetMetadata $ParameterSetMetadata + return $result +} + +$parameterSets = $parameterSetsInfo.ExportedCmdlets.Keys | Where-Object { Test-functionSupported($_) } +$resourceTypes = @{} +foreach ($parameterSetName in $parameterSets) +{ + $cmdletInfo = $parameterSetsInfo.ExportedCommands[$parameterSetName] + $parameterSetMetadata = New-MetadataForParameterSet -ParameterSetInfo $cmdletInfo + $cmdletName = $parameterSetMetadata.CmdletName + if (-not ($moduleInfo.ExportedCommands.ContainsKey($cmdletName))) + { + continue + } + if ($resourceTypes.ContainsKey($parameterSetMetadata.ResourceType)) + { + $ExistedCmdletInfo = $resourceTypes[$parameterSetMetadata.ResourceType].commands | Where-Object { $_.name -eq $cmdletName } + if ($ExistedCmdletInfo) + { + $ExistedCmdletInfo = Merge-WithExistCmdletMetadata -ExistedCmdletInfo $ExistedCmdletInfo -ParameterSetMetadata $parameterSetMetadata + } + else + { + $cmdletInfo = New-MetadataForCmdlet -ParameterSetMetadata $parameterSetMetadata + $resourceTypes[$parameterSetMetadata.ResourceType].commands += $cmdletInfo + } + } + else + { + $cmdletInfo = New-MetadataForCmdlet -ParameterSetMetadata $parameterSetMetadata + $resourceTypes[$parameterSetMetadata.ResourceType] = [ordered]@{ + resourceType = $parameterSetMetadata.ResourceType + apiVersion = $parameterSetMetadata.ApiVersion + learnMore = @{ + url = "https://learn.microsoft.com/powershell/module/$rootModuleName".ToLower() + } + commands = @($cmdletInfo) + provider = $parameterSetMetadata.Provider + } + } +} + +$UXFolder = 'UX' +if (Test-Path $UXFolder) +{ + Remove-Item -Path $UXFolder -Recurse +} +$null = New-Item -ItemType Directory -Path $UXFolder + +foreach ($resourceType in $resourceTypes.Keys) +{ + $resourceTypeFileName = $resourceType -replace "/", "-" + if ($resourceTypeFileName -eq "") + { + continue + } + $resourceTypeInfo = $resourceTypes[$resourceType] + $provider = $resourceTypeInfo.provider + $providerFolder = "$UXFolder/$provider" + if (-not (Test-Path $providerFolder)) + { + $null = New-Item -ItemType Directory -Path $providerFolder + } + $resourceTypeInfo.Remove("provider") + $resourceTypeInfo | ConvertTo-Json -Depth 10 | Out-File "$providerFolder/$resourceTypeFileName.json" +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/Module.cs b/src/StackHCI/StackHCIVm.Autorest/generated/Module.cs new file mode 100644 index 000000000000..ef4cf448eae8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/Module.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using SendAsyncStepDelegate = global::System.Func, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>; + using PipelineChangeDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>; + using GetParameterDelegate = global::System.Func; + using ModuleLoadPipelineDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>, global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>>; + using ArgumentCompleterDelegate = global::System.Func; + using GetTelemetryIdDelegate = global::System.Func; + using TelemetryDelegate = global::System.Action; + using NewRequestPipelineDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>, global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>>; + using SignalDelegate = global::System.Func, global::System.Threading.Tasks.Task>; + using EventListenerDelegate = global::System.Func, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Management.Automation.InvocationInfo, string, string, string, global::System.Exception, global::System.Threading.Tasks.Task>; + using NextDelegate = global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>; + + /// A class that contains the module-common code and data. + public partial class Module + { + /// The currently selected profile. + public string Profile = global::System.String.Empty; + + public global::System.Net.Http.HttpClientHandler _handler = new global::System.Net.Http.HttpClientHandler(); + + /// the ISendAsync pipeline instance + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline _pipeline; + + /// the ISendAsync pipeline instance (when proxy is enabled) + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline _pipelineWithProxy; + + public bool _useProxy = false; + + public global::System.Net.WebProxy _webProxy = new global::System.Net.WebProxy(); + + /// Gets completion data for azure specific fields + public ArgumentCompleterDelegate ArgumentCompleter { get; set; } + + /// The instance of the Client API + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM ClientAPI { get; set; } + + /// A delegate that gets called for each signalled event + public EventListenerDelegate EventListener { get; set; } + + /// The delegate to call to get parameter data from a common module. + public GetParameterDelegate GetParameterValue { get; set; } + + /// The delegate to get the telemetry Id. + public GetTelemetryIdDelegate GetTelemetryId { get; set; } + + /// Backing field for property. + private static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module _instance; + + /// the singleton of this module class + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module Instance => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module._instance?? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module._instance = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module()); + + /// The Name of this module + public string Name => @"Az.StackHCIVm"; + + /// The delegate to call when this module is loaded (supporting a commmon module). + public ModuleLoadPipelineDelegate OnModuleLoad { get; set; } + + /// The delegate to call before each new request (supporting a commmon module). + public NewRequestPipelineDelegate OnNewRequest { get; set; } + + /// The name of the currently selected Azure profile + public global::System.String ProfileName { get; set; } + + /// The ResourceID for this module (azure arm). + public string ResourceId => @"Az.StackHCIVm"; + + /// The delegate for creating a telemetry. + public TelemetryDelegate Telemetry { get; set; } + + /// The from the cmdlet + /// The HttpPipeline for the request + + partial void AfterCreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline pipeline); + + /// The from the cmdlet + /// The HttpPipeline for the request + + partial void BeforeCreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline pipeline); + + partial void CustomInit(); + + /// Creates an instance of the HttpPipeline for each call. + /// The from the cmdlet + /// the cmdlet's correlation id. + /// the cmdlet's process record correlation id. + /// the cmdlet's parameterset name. + /// a dict for extensible parameters + /// An instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline for the remote call. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline CreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, string correlationId, string processRecordId, string parameterSetName = null, global::System.Collections.Generic.IDictionary extensibleParameters = null) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline pipeline = null; + BeforeCreatePipeline(invocationInfo, ref pipeline); + pipeline = (pipeline ?? (_useProxy ? _pipelineWithProxy : _pipeline)).Clone(); + AfterCreatePipeline(invocationInfo, ref pipeline); + pipeline.Append(new Runtime.CmdInfoHandler(processRecordId, invocationInfo, parameterSetName).SendAsync); + OnNewRequest?.Invoke( invocationInfo, correlationId,processRecordId, (step)=> { pipeline.Prepend(step); } , (step)=> { pipeline.Append(step); } ); + return pipeline; + } + + /// Gets parameters from a common module. + /// The from the cmdlet + /// the cmdlet's correlation id. + /// The name of the parameter to get the value for. + /// + /// The parameter value from the common module. (Note: this should be type converted on the way back) + /// + public object GetParameter(global::System.Management.Automation.InvocationInfo invocationInfo, string correlationId, string parameterName) => GetParameterValue?.Invoke( ResourceId, Name, invocationInfo, correlationId,parameterName ); + + /// Initialization steps performed after the module is loaded. + public void Init() + { + OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipeline.Prepend(step); } , (step)=> { _pipeline.Append(step); } ); + OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipelineWithProxy.Prepend(step); } , (step)=> { _pipelineWithProxy.Append(step); } ); + CustomInit(); + } + + /// Creates the module instance. + private Module() + { + // constructor + ClientAPI = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM(); + _handler.Proxy = _webProxy; + _pipeline = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpClientFactory(new global::System.Net.Http.HttpClient())); + _pipelineWithProxy = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpClientFactory(new global::System.Net.Http.HttpClient(_handler))); + } + + /// The HTTP Proxy to use. + /// The HTTP Proxy Credentials + /// True if the proxy should use default credentials + public void SetProxyConfiguration(global::System.Uri proxy, global::System.Management.Automation.PSCredential proxyCredential, bool proxyUseDefaultCredentials) + { + _useProxy = proxy != null; + if (proxy == null) + { + return; + } + // set the proxy configuration + _webProxy.Address = proxy; + _webProxy.BypassProxyOnLocal = false; + if (proxyUseDefaultCredentials) + { + _webProxy.Credentials = null; + _webProxy.UseDefaultCredentials = true; + } + else + { + _webProxy.UseDefaultCredentials = false; + _webProxy.Credentials = proxyCredential ?.GetNetworkCredential(); + } + } + + /// Called to dispatch events to the common module listener + /// The ID of the event + /// The cancellation token for the event + /// A delegate to get the detailed event data + /// The callback for the event dispatcher + /// The from the cmdlet + /// the cmdlet's parameterset name. + /// the cmdlet's correlation id. + /// the cmdlet's process record correlation id. + /// the exception that is being thrown (if available) + /// + /// A that will be complete when handling of the event is completed. + /// + public async global::System.Threading.Tasks.Task Signal(string id, global::System.Threading.CancellationToken token, global::System.Func getEventData, SignalDelegate signal, global::System.Management.Automation.InvocationInfo invocationInfo, string parameterSetName, string correlationId, string processRecordId, global::System.Exception exception) + { + using( NoSynchronizationContext ) + { + await EventListener?.Invoke(id,token,getEventData, signal, invocationInfo, parameterSetName, correlationId,processRecordId,exception); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Any.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Any.PowerShell.cs new file mode 100644 index 000000000000..43c097e009a5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Any.PowerShell.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Any object + [System.ComponentModel.TypeConverter(typeof(AnyTypeConverter))] + public partial class Any + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Any(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Any(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IAny DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Any(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IAny DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Any(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IAny FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Any object + [System.ComponentModel.TypeConverter(typeof(AnyTypeConverter))] + public partial interface IAny + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Any.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Any.TypeConverter.cs new file mode 100644 index 000000000000..90846d21bf48 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Any.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AnyTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IAny ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IAny).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Any.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Any.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Any.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Any.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Any.cs new file mode 100644 index 000000000000..9c9e211dcae0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Any.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Any object + public partial class Any : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IAny, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IAnyInternal + { + + /// Creates an new instance. + public Any() + { + + } + } + /// Any object + public partial interface IAny : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + + } + /// Any object + internal partial interface IAnyInternal + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Any.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Any.json.cs new file mode 100644 index 000000000000..a6697e3a63e9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Any.json.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Any object + public partial class Any + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal Any(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IAny. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IAny. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IAny FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new Any(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorAdditionalInfo.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorAdditionalInfo.PowerShell.cs new file mode 100644 index 000000000000..b516739b72a0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorAdditionalInfo.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The resource management error additional info. + [System.ComponentModel.TypeConverter(typeof(ErrorAdditionalInfoTypeConverter))] + public partial class ErrorAdditionalInfo + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorAdditionalInfo(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorAdditionalInfo(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorAdditionalInfo(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfoInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfoInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Info")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfoInternal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IAny) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfoInternal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.AnyTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorAdditionalInfo(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfoInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfoInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Info")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfoInternal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IAny) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfoInternal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.AnyTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The resource management error additional info. + [System.ComponentModel.TypeConverter(typeof(ErrorAdditionalInfoTypeConverter))] + public partial interface IErrorAdditionalInfo + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorAdditionalInfo.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorAdditionalInfo.TypeConverter.cs new file mode 100644 index 000000000000..80a7f7f7cab7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorAdditionalInfo.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorAdditionalInfoTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorAdditionalInfo.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorAdditionalInfo.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorAdditionalInfo.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorAdditionalInfo.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorAdditionalInfo.cs new file mode 100644 index 000000000000..712fd4a94623 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorAdditionalInfo.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The resource management error additional info. + public partial class ErrorAdditionalInfo : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfoInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IAny _info; + + /// The additional info. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IAny Info { get => (this._info = this._info ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Any()); } + + /// Internal Acessors for Info + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IAny Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfoInternal.Info { get => (this._info = this._info ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Any()); set { {_info = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfoInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _type; + + /// The additional info type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public ErrorAdditionalInfo() + { + + } + } + /// The resource management error additional info. + public partial interface IErrorAdditionalInfo : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The additional info. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The additional info.", + SerializedName = @"info", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IAny) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IAny Info { get; } + /// The additional info type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The additional info type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// The resource management error additional info. + internal partial interface IErrorAdditionalInfoInternal + + { + /// The additional info. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IAny Info { get; set; } + /// The additional info type. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorAdditionalInfo.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorAdditionalInfo.json.cs new file mode 100644 index 000000000000..26706b110989 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorAdditionalInfo.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The resource management error additional info. + public partial class ErrorAdditionalInfo + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorAdditionalInfo(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + {_info = If( json?.PropertyT("info"), out var __jsonInfo) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Any.FromJson(__jsonInfo) : Info;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new ErrorAdditionalInfo(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._info ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._info.ToJson(null,serializationMode) : null, "info" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorDetailAutoGenerated.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorDetailAutoGenerated.PowerShell.cs new file mode 100644 index 000000000000..a5839b0ac9d7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorDetailAutoGenerated.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The error detail. + [System.ComponentModel.TypeConverter(typeof(ErrorDetailAutoGeneratedTypeConverter))] + public partial class ErrorDetailAutoGenerated + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorDetailAutoGenerated(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorDetailAutoGenerated(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorDetailAutoGenerated(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorDetailAutoGeneratedTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorDetailAutoGenerated(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorDetailAutoGeneratedTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The error detail. + [System.ComponentModel.TypeConverter(typeof(ErrorDetailAutoGeneratedTypeConverter))] + public partial interface IErrorDetailAutoGenerated + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorDetailAutoGenerated.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorDetailAutoGenerated.TypeConverter.cs new file mode 100644 index 000000000000..e62e93752390 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorDetailAutoGenerated.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorDetailAutoGeneratedTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorDetailAutoGenerated.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorDetailAutoGenerated.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorDetailAutoGenerated.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorDetailAutoGenerated.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorDetailAutoGenerated.cs new file mode 100644 index 000000000000..ab753d8d7043 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorDetailAutoGenerated.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The error detail. + public partial class ErrorDetailAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[] _additionalInfo; + + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[] AdditionalInfo { get => this._additionalInfo; } + + /// Backing field for property. + private string _code; + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Code { get => this._code; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated[] _detail; + + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated[] Detail { get => this._detail; } + + /// Backing field for property. + private string _message; + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Message { get => this._message; } + + /// Internal Acessors for AdditionalInfo + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal.AdditionalInfo { get => this._additionalInfo; set { {_additionalInfo = value;} } } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal.Code { get => this._code; set { {_code = value;} } } + + /// Internal Acessors for Detail + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal.Detail { get => this._detail; set { {_detail = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal.Message { get => this._message; set { {_message = value;} } } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal.Target { get => this._target; set { {_target = value;} } } + + /// Backing field for property. + private string _target; + + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Target { get => this._target; } + + /// Creates an new instance. + public ErrorDetailAutoGenerated() + { + + } + } + /// The error detail. + public partial interface IErrorDetailAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error additional info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[] AdditionalInfo { get; } + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error details.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated[] Detail { get; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error target.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + + } + /// The error detail. + internal partial interface IErrorDetailAutoGeneratedInternal + + { + /// The error additional info. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[] AdditionalInfo { get; set; } + /// The error code. + string Code { get; set; } + /// The error details. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated[] Detail { get; set; } + /// The error message. + string Message { get; set; } + /// The error target. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorDetailAutoGenerated.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorDetailAutoGenerated.json.cs new file mode 100644 index 000000000000..0947b7c59321 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorDetailAutoGenerated.json.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The error detail. + public partial class ErrorDetailAutoGenerated + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorDetailAutoGenerated(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)Code;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} + {_target = If( json?.PropertyT("target"), out var __jsonTarget) ? (string)__jsonTarget : (string)Target;} + {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? If( __jsonDetails as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorDetailAutoGenerated.FromJson(__u) )) ))() : null : Detail;} + {_additionalInfo = If( json?.PropertyT("additionalInfo"), out var __jsonAdditionalInfo) ? If( __jsonAdditionalInfo as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorAdditionalInfo.FromJson(__p) )) ))() : null : AdditionalInfo;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new ErrorDetailAutoGenerated(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._target)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._target.ToString()) : null, "target" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._detail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._detail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("details",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._additionalInfo) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __s in this._additionalInfo ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("additionalInfo",__r); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorResponseAutoGenerated.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorResponseAutoGenerated.PowerShell.cs new file mode 100644 index 000000000000..d856e2a0c5aa --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorResponseAutoGenerated.PowerShell.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + /// + [System.ComponentModel.TypeConverter(typeof(ErrorResponseAutoGeneratedTypeConverter))] + public partial class ErrorResponseAutoGenerated + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGenerated DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorResponseAutoGenerated(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGenerated DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorResponseAutoGenerated(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorResponseAutoGenerated(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorDetailAutoGeneratedTypeConverter.ConvertFrom); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorDetailAutoGeneratedTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorResponseAutoGenerated(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorDetailAutoGeneratedTypeConverter.ConvertFrom); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorDetailAutoGeneratedTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGenerated FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + [System.ComponentModel.TypeConverter(typeof(ErrorResponseAutoGeneratedTypeConverter))] + public partial interface IErrorResponseAutoGenerated + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorResponseAutoGenerated.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorResponseAutoGenerated.TypeConverter.cs new file mode 100644 index 000000000000..57afe7bcb7bc --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorResponseAutoGenerated.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorResponseAutoGeneratedTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGenerated ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGenerated).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorResponseAutoGenerated.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorResponseAutoGenerated.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorResponseAutoGenerated.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorResponseAutoGenerated.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorResponseAutoGenerated.cs new file mode 100644 index 000000000000..09ced39b05f3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorResponseAutoGenerated.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + /// + public partial class ErrorResponseAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGenerated, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal + { + + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[] AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)Error).AdditionalInfo; } + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)Error).Code; } + + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated[] Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)Error).Detail; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated _error; + + /// The error object. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorDetailAutoGenerated()); set => this._error = value; } + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)Error).Message; } + + /// Internal Acessors for AdditionalInfo + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)Error).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)Error).AdditionalInfo = value; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)Error).Code = value; } + + /// Internal Acessors for Detail + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)Error).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)Error).Detail = value; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorDetailAutoGenerated()); set { {_error = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)Error).Message = value; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGeneratedInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)Error).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)Error).Target = value; } + + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGeneratedInternal)Error).Target; } + + /// Creates an new instance. + public ErrorResponseAutoGenerated() + { + + } + } + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + public partial interface IErrorResponseAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error additional info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[] AdditionalInfo { get; } + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error details.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated[] Detail { get; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error target.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + + } + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + internal partial interface IErrorResponseAutoGeneratedInternal + + { + /// The error additional info. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[] AdditionalInfo { get; set; } + /// The error code. + string Code { get; set; } + /// The error details. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated[] Detail { get; set; } + /// The error object. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorDetailAutoGenerated Error { get; set; } + /// The error message. + string Message { get; set; } + /// The error target. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorResponseAutoGenerated.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorResponseAutoGenerated.json.cs new file mode 100644 index 000000000000..d7e1e871b0c2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20/ErrorResponseAutoGenerated.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + /// + public partial class ErrorResponseAutoGenerated + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorResponseAutoGenerated(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorDetailAutoGenerated.FromJson(__jsonError) : Error;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGenerated. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGenerated. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGenerated FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new ErrorResponseAutoGenerated(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._error ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._error.ToJson(null,serializationMode) : null, "error" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentConfiguration.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentConfiguration.PowerShell.cs new file mode 100644 index 000000000000..e20a57fec986 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentConfiguration.PowerShell.cs @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// Configurable properties that the user can set locally via the azcmagent config command, or remotely via ARM. + /// + [System.ComponentModel.TypeConverter(typeof(AgentConfigurationTypeConverter))] + public partial class AgentConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AgentConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProxyUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ProxyUrl = (string) content.GetValueForProperty("ProxyUrl",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ProxyUrl, global::System.Convert.ToString); + } + if (content.Contains("IncomingConnectionsPort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).IncomingConnectionsPort = (string[]) content.GetValueForProperty("IncomingConnectionsPort",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).IncomingConnectionsPort, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("ExtensionsAllowList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ExtensionsAllowList = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[]) content.GetValueForProperty("ExtensionsAllowList",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ExtensionsAllowList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ConfigurationExtensionTypeConverter.ConvertFrom)); + } + if (content.Contains("ExtensionsBlockList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ExtensionsBlockList = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[]) content.GetValueForProperty("ExtensionsBlockList",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ExtensionsBlockList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ConfigurationExtensionTypeConverter.ConvertFrom)); + } + if (content.Contains("ProxyBypass")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ProxyBypass = (string[]) content.GetValueForProperty("ProxyBypass",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ProxyBypass, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("ExtensionsEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ExtensionsEnabled = (string) content.GetValueForProperty("ExtensionsEnabled",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ExtensionsEnabled, global::System.Convert.ToString); + } + if (content.Contains("GuestConfigurationEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).GuestConfigurationEnabled = (string) content.GetValueForProperty("GuestConfigurationEnabled",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).GuestConfigurationEnabled, global::System.Convert.ToString); + } + if (content.Contains("ConfigMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ConfigMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode?) content.GetValueForProperty("ConfigMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ConfigMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AgentConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProxyUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ProxyUrl = (string) content.GetValueForProperty("ProxyUrl",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ProxyUrl, global::System.Convert.ToString); + } + if (content.Contains("IncomingConnectionsPort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).IncomingConnectionsPort = (string[]) content.GetValueForProperty("IncomingConnectionsPort",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).IncomingConnectionsPort, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("ExtensionsAllowList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ExtensionsAllowList = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[]) content.GetValueForProperty("ExtensionsAllowList",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ExtensionsAllowList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ConfigurationExtensionTypeConverter.ConvertFrom)); + } + if (content.Contains("ExtensionsBlockList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ExtensionsBlockList = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[]) content.GetValueForProperty("ExtensionsBlockList",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ExtensionsBlockList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ConfigurationExtensionTypeConverter.ConvertFrom)); + } + if (content.Contains("ProxyBypass")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ProxyBypass = (string[]) content.GetValueForProperty("ProxyBypass",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ProxyBypass, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("ExtensionsEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ExtensionsEnabled = (string) content.GetValueForProperty("ExtensionsEnabled",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ExtensionsEnabled, global::System.Convert.ToString); + } + if (content.Contains("GuestConfigurationEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).GuestConfigurationEnabled = (string) content.GetValueForProperty("GuestConfigurationEnabled",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).GuestConfigurationEnabled, global::System.Convert.ToString); + } + if (content.Contains("ConfigMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ConfigMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode?) content.GetValueForProperty("ConfigMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)this).ConfigMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AgentConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AgentConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Configurable properties that the user can set locally via the azcmagent config command, or remotely via ARM. + [System.ComponentModel.TypeConverter(typeof(AgentConfigurationTypeConverter))] + public partial interface IAgentConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentConfiguration.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..f27a9b6d8373 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentConfiguration.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AgentConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AgentConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AgentConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AgentConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentConfiguration.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentConfiguration.cs new file mode 100644 index 000000000000..018c4acf9bcd --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentConfiguration.cs @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// Configurable properties that the user can set locally via the azcmagent config command, or remotely via ARM. + /// + public partial class AgentConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode? _configMode; + + /// + /// Name of configuration mode to use. Modes are pre-defined configurations of security controls, extension allowlists and + /// guest configuration, maintained by Microsoft. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode? ConfigMode { get => this._configMode; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] _extensionsAllowList; + + /// Array of extensions that are allowed to be installed or updated. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] ExtensionsAllowList { get => this._extensionsAllowList; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] _extensionsBlockList; + + /// Array of extensions that are blocked (cannot be installed or updated) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] ExtensionsBlockList { get => this._extensionsBlockList; } + + /// Backing field for property. + private string _extensionsEnabled; + + /// Specifies whether the extension service is enabled or disabled. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ExtensionsEnabled { get => this._extensionsEnabled; } + + /// Backing field for property. + private string _guestConfigurationEnabled; + + /// Specified whether the guest configuration service is enabled or disabled. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string GuestConfigurationEnabled { get => this._guestConfigurationEnabled; } + + /// Backing field for property. + private string[] _incomingConnectionsPort; + + /// Specifies the list of ports that the agent will be able to listen on. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string[] IncomingConnectionsPort { get => this._incomingConnectionsPort; } + + /// Internal Acessors for ConfigMode + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal.ConfigMode { get => this._configMode; set { {_configMode = value;} } } + + /// Internal Acessors for ExtensionsAllowList + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal.ExtensionsAllowList { get => this._extensionsAllowList; set { {_extensionsAllowList = value;} } } + + /// Internal Acessors for ExtensionsBlockList + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal.ExtensionsBlockList { get => this._extensionsBlockList; set { {_extensionsBlockList = value;} } } + + /// Internal Acessors for ExtensionsEnabled + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal.ExtensionsEnabled { get => this._extensionsEnabled; set { {_extensionsEnabled = value;} } } + + /// Internal Acessors for GuestConfigurationEnabled + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal.GuestConfigurationEnabled { get => this._guestConfigurationEnabled; set { {_guestConfigurationEnabled = value;} } } + + /// Internal Acessors for IncomingConnectionsPort + string[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal.IncomingConnectionsPort { get => this._incomingConnectionsPort; set { {_incomingConnectionsPort = value;} } } + + /// Internal Acessors for ProxyBypass + string[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal.ProxyBypass { get => this._proxyBypass; set { {_proxyBypass = value;} } } + + /// Internal Acessors for ProxyUrl + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal.ProxyUrl { get => this._proxyUrl; set { {_proxyUrl = value;} } } + + /// Backing field for property. + private string[] _proxyBypass; + + /// List of service names which should not use the specified proxy server. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string[] ProxyBypass { get => this._proxyBypass; } + + /// Backing field for property. + private string _proxyUrl; + + /// Specifies the URL of the proxy to be used. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ProxyUrl { get => this._proxyUrl; } + + /// Creates an new instance. + public AgentConfiguration() + { + + } + } + /// Configurable properties that the user can set locally via the azcmagent config command, or remotely via ARM. + public partial interface IAgentConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// + /// Name of configuration mode to use. Modes are pre-defined configurations of security controls, extension allowlists and + /// guest configuration, maintained by Microsoft. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Name of configuration mode to use. Modes are pre-defined configurations of security controls, extension allowlists and guest configuration, maintained by Microsoft.", + SerializedName = @"configMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode? ConfigMode { get; } + /// Array of extensions that are allowed to be installed or updated. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Array of extensions that are allowed to be installed or updated.", + SerializedName = @"extensionsAllowList", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] ExtensionsAllowList { get; } + /// Array of extensions that are blocked (cannot be installed or updated) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Array of extensions that are blocked (cannot be installed or updated)", + SerializedName = @"extensionsBlockList", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] ExtensionsBlockList { get; } + /// Specifies whether the extension service is enabled or disabled. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies whether the extension service is enabled or disabled.", + SerializedName = @"extensionsEnabled", + PossibleTypes = new [] { typeof(string) })] + string ExtensionsEnabled { get; } + /// Specified whether the guest configuration service is enabled or disabled. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specified whether the guest configuration service is enabled or disabled.", + SerializedName = @"guestConfigurationEnabled", + PossibleTypes = new [] { typeof(string) })] + string GuestConfigurationEnabled { get; } + /// Specifies the list of ports that the agent will be able to listen on. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the list of ports that the agent will be able to listen on.", + SerializedName = @"incomingConnectionsPorts", + PossibleTypes = new [] { typeof(string) })] + string[] IncomingConnectionsPort { get; } + /// List of service names which should not use the specified proxy server. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"List of service names which should not use the specified proxy server.", + SerializedName = @"proxyBypass", + PossibleTypes = new [] { typeof(string) })] + string[] ProxyBypass { get; } + /// Specifies the URL of the proxy to be used. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the URL of the proxy to be used.", + SerializedName = @"proxyUrl", + PossibleTypes = new [] { typeof(string) })] + string ProxyUrl { get; } + + } + /// Configurable properties that the user can set locally via the azcmagent config command, or remotely via ARM. + internal partial interface IAgentConfigurationInternal + + { + /// + /// Name of configuration mode to use. Modes are pre-defined configurations of security controls, extension allowlists and + /// guest configuration, maintained by Microsoft. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode? ConfigMode { get; set; } + /// Array of extensions that are allowed to be installed or updated. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] ExtensionsAllowList { get; set; } + /// Array of extensions that are blocked (cannot be installed or updated) + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] ExtensionsBlockList { get; set; } + /// Specifies whether the extension service is enabled or disabled. + string ExtensionsEnabled { get; set; } + /// Specified whether the guest configuration service is enabled or disabled. + string GuestConfigurationEnabled { get; set; } + /// Specifies the list of ports that the agent will be able to listen on. + string[] IncomingConnectionsPort { get; set; } + /// List of service names which should not use the specified proxy server. + string[] ProxyBypass { get; set; } + /// Specifies the URL of the proxy to be used. + string ProxyUrl { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentConfiguration.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentConfiguration.json.cs new file mode 100644 index 000000000000..a8b056dde319 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentConfiguration.json.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// Configurable properties that the user can set locally via the azcmagent config command, or remotely via ARM. + /// + public partial class AgentConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal AgentConfiguration(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_proxyUrl = If( json?.PropertyT("proxyUrl"), out var __jsonProxyUrl) ? (string)__jsonProxyUrl : (string)ProxyUrl;} + {_incomingConnectionsPort = If( json?.PropertyT("incomingConnectionsPorts"), out var __jsonIncomingConnectionsPorts) ? If( __jsonIncomingConnectionsPorts as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : IncomingConnectionsPort;} + {_extensionsAllowList = If( json?.PropertyT("extensionsAllowList"), out var __jsonExtensionsAllowList) ? If( __jsonExtensionsAllowList as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ConfigurationExtension.FromJson(__p) )) ))() : null : ExtensionsAllowList;} + {_extensionsBlockList = If( json?.PropertyT("extensionsBlockList"), out var __jsonExtensionsBlockList) ? If( __jsonExtensionsBlockList as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __l) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__l, (__k)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ConfigurationExtension.FromJson(__k) )) ))() : null : ExtensionsBlockList;} + {_proxyBypass = If( json?.PropertyT("proxyBypass"), out var __jsonProxyBypass) ? If( __jsonProxyBypass as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __g) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__g, (__f)=>(string) (__f is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString __e ? (string)(__e.ToString()) : null)) ))() : null : ProxyBypass;} + {_extensionsEnabled = If( json?.PropertyT("extensionsEnabled"), out var __jsonExtensionsEnabled) ? (string)__jsonExtensionsEnabled : (string)ExtensionsEnabled;} + {_guestConfigurationEnabled = If( json?.PropertyT("guestConfigurationEnabled"), out var __jsonGuestConfigurationEnabled) ? (string)__jsonGuestConfigurationEnabled : (string)GuestConfigurationEnabled;} + {_configMode = If( json?.PropertyT("configMode"), out var __jsonConfigMode) ? (string)__jsonConfigMode : (string)ConfigMode;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new AgentConfiguration(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._proxyUrl)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._proxyUrl.ToString()) : null, "proxyUrl" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._incomingConnectionsPort) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._incomingConnectionsPort ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("incomingConnectionsPorts",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._extensionsAllowList) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __s in this._extensionsAllowList ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("extensionsAllowList",__r); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._extensionsBlockList) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __n in this._extensionsBlockList ) + { + AddIf(__n?.ToJson(null, serializationMode) ,__m.Add); + } + container.Add("extensionsBlockList",__m); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._proxyBypass) + { + var __h = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __i in this._proxyBypass ) + { + AddIf(null != (((object)__i)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(__i.ToString()) : null ,__h.Add); + } + container.Add("proxyBypass",__h); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._extensionsEnabled)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._extensionsEnabled.ToString()) : null, "extensionsEnabled" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._guestConfigurationEnabled)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._guestConfigurationEnabled.ToString()) : null, "guestConfigurationEnabled" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._configMode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._configMode.ToString()) : null, "configMode" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentUpgrade.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentUpgrade.PowerShell.cs new file mode 100644 index 000000000000..596b0d58df2f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentUpgrade.PowerShell.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The info w.r.t Agent Upgrade. + [System.ComponentModel.TypeConverter(typeof(AgentUpgradeTypeConverter))] + public partial class AgentUpgrade + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AgentUpgrade(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DesiredVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).DesiredVersion = (string) content.GetValueForProperty("DesiredVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).DesiredVersion, global::System.Convert.ToString); + } + if (content.Contains("CorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).CorrelationId = (string) content.GetValueForProperty("CorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).CorrelationId, global::System.Convert.ToString); + } + if (content.Contains("EnableAutomaticUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).EnableAutomaticUpgrade = (bool?) content.GetValueForProperty("EnableAutomaticUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).EnableAutomaticUpgrade, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastAttemptDesiredVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).LastAttemptDesiredVersion = (string) content.GetValueForProperty("LastAttemptDesiredVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).LastAttemptDesiredVersion, global::System.Convert.ToString); + } + if (content.Contains("LastAttemptTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).LastAttemptTimestamp = (string) content.GetValueForProperty("LastAttemptTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).LastAttemptTimestamp, global::System.Convert.ToString); + } + if (content.Contains("LastAttemptStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).LastAttemptStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum?) content.GetValueForProperty("LastAttemptStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).LastAttemptStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum.CreateFrom); + } + if (content.Contains("LastAttemptMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).LastAttemptMessage = (string) content.GetValueForProperty("LastAttemptMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).LastAttemptMessage, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AgentUpgrade(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DesiredVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).DesiredVersion = (string) content.GetValueForProperty("DesiredVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).DesiredVersion, global::System.Convert.ToString); + } + if (content.Contains("CorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).CorrelationId = (string) content.GetValueForProperty("CorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).CorrelationId, global::System.Convert.ToString); + } + if (content.Contains("EnableAutomaticUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).EnableAutomaticUpgrade = (bool?) content.GetValueForProperty("EnableAutomaticUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).EnableAutomaticUpgrade, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastAttemptDesiredVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).LastAttemptDesiredVersion = (string) content.GetValueForProperty("LastAttemptDesiredVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).LastAttemptDesiredVersion, global::System.Convert.ToString); + } + if (content.Contains("LastAttemptTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).LastAttemptTimestamp = (string) content.GetValueForProperty("LastAttemptTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).LastAttemptTimestamp, global::System.Convert.ToString); + } + if (content.Contains("LastAttemptStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).LastAttemptStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum?) content.GetValueForProperty("LastAttemptStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).LastAttemptStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum.CreateFrom); + } + if (content.Contains("LastAttemptMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).LastAttemptMessage = (string) content.GetValueForProperty("LastAttemptMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)this).LastAttemptMessage, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AgentUpgrade(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AgentUpgrade(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The info w.r.t Agent Upgrade. + [System.ComponentModel.TypeConverter(typeof(AgentUpgradeTypeConverter))] + public partial interface IAgentUpgrade + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentUpgrade.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentUpgrade.TypeConverter.cs new file mode 100644 index 000000000000..94d7c643d636 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentUpgrade.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AgentUpgradeTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AgentUpgrade.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AgentUpgrade.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AgentUpgrade.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentUpgrade.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentUpgrade.cs new file mode 100644 index 000000000000..330882eb147d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentUpgrade.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The info w.r.t Agent Upgrade. + public partial class AgentUpgrade : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal + { + + /// Backing field for property. + private string _correlationId; + + /// The correlation ID passed in from RSM per upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string CorrelationId { get => this._correlationId; set => this._correlationId = value; } + + /// Backing field for property. + private string _desiredVersion; + + /// Specifies the version info w.r.t AgentUpgrade for the machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string DesiredVersion { get => this._desiredVersion; set => this._desiredVersion = value; } + + /// Backing field for property. + private bool? _enableAutomaticUpgrade; + + /// Specifies if RSM should try to upgrade this machine + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public bool? EnableAutomaticUpgrade { get => this._enableAutomaticUpgrade; set => this._enableAutomaticUpgrade = value; } + + /// Backing field for property. + private string _lastAttemptDesiredVersion; + + /// Specifies the version of the last attempt + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string LastAttemptDesiredVersion { get => this._lastAttemptDesiredVersion; } + + /// Backing field for property. + private string _lastAttemptMessage; + + /// Failure message of last upgrade attempt if any. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string LastAttemptMessage { get => this._lastAttemptMessage; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum? _lastAttemptStatus; + + /// Specifies the status of Agent Upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum? LastAttemptStatus { get => this._lastAttemptStatus; } + + /// Backing field for property. + private string _lastAttemptTimestamp; + + /// Timestamp of last upgrade attempt + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string LastAttemptTimestamp { get => this._lastAttemptTimestamp; } + + /// Internal Acessors for LastAttemptDesiredVersion + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal.LastAttemptDesiredVersion { get => this._lastAttemptDesiredVersion; set { {_lastAttemptDesiredVersion = value;} } } + + /// Internal Acessors for LastAttemptMessage + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal.LastAttemptMessage { get => this._lastAttemptMessage; set { {_lastAttemptMessage = value;} } } + + /// Internal Acessors for LastAttemptStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal.LastAttemptStatus { get => this._lastAttemptStatus; set { {_lastAttemptStatus = value;} } } + + /// Internal Acessors for LastAttemptTimestamp + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal.LastAttemptTimestamp { get => this._lastAttemptTimestamp; set { {_lastAttemptTimestamp = value;} } } + + /// Creates an new instance. + public AgentUpgrade() + { + + } + } + /// The info w.r.t Agent Upgrade. + public partial interface IAgentUpgrade : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The correlation ID passed in from RSM per upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The correlation ID passed in from RSM per upgrade.", + SerializedName = @"correlationId", + PossibleTypes = new [] { typeof(string) })] + string CorrelationId { get; set; } + /// Specifies the version info w.r.t AgentUpgrade for the machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the version info w.r.t AgentUpgrade for the machine.", + SerializedName = @"desiredVersion", + PossibleTypes = new [] { typeof(string) })] + string DesiredVersion { get; set; } + /// Specifies if RSM should try to upgrade this machine + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies if RSM should try to upgrade this machine", + SerializedName = @"enableAutomaticUpgrade", + PossibleTypes = new [] { typeof(bool) })] + bool? EnableAutomaticUpgrade { get; set; } + /// Specifies the version of the last attempt + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the version of the last attempt", + SerializedName = @"lastAttemptDesiredVersion", + PossibleTypes = new [] { typeof(string) })] + string LastAttemptDesiredVersion { get; } + /// Failure message of last upgrade attempt if any. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Failure message of last upgrade attempt if any.", + SerializedName = @"lastAttemptMessage", + PossibleTypes = new [] { typeof(string) })] + string LastAttemptMessage { get; } + /// Specifies the status of Agent Upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the status of Agent Upgrade.", + SerializedName = @"lastAttemptStatus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum? LastAttemptStatus { get; } + /// Timestamp of last upgrade attempt + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Timestamp of last upgrade attempt", + SerializedName = @"lastAttemptTimestamp", + PossibleTypes = new [] { typeof(string) })] + string LastAttemptTimestamp { get; } + + } + /// The info w.r.t Agent Upgrade. + internal partial interface IAgentUpgradeInternal + + { + /// The correlation ID passed in from RSM per upgrade. + string CorrelationId { get; set; } + /// Specifies the version info w.r.t AgentUpgrade for the machine. + string DesiredVersion { get; set; } + /// Specifies if RSM should try to upgrade this machine + bool? EnableAutomaticUpgrade { get; set; } + /// Specifies the version of the last attempt + string LastAttemptDesiredVersion { get; set; } + /// Failure message of last upgrade attempt if any. + string LastAttemptMessage { get; set; } + /// Specifies the status of Agent Upgrade. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum? LastAttemptStatus { get; set; } + /// Timestamp of last upgrade attempt + string LastAttemptTimestamp { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentUpgrade.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentUpgrade.json.cs new file mode 100644 index 000000000000..7af6d8d85a33 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentUpgrade.json.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The info w.r.t Agent Upgrade. + public partial class AgentUpgrade + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal AgentUpgrade(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_desiredVersion = If( json?.PropertyT("desiredVersion"), out var __jsonDesiredVersion) ? (string)__jsonDesiredVersion : (string)DesiredVersion;} + {_correlationId = If( json?.PropertyT("correlationId"), out var __jsonCorrelationId) ? (string)__jsonCorrelationId : (string)CorrelationId;} + {_enableAutomaticUpgrade = If( json?.PropertyT("enableAutomaticUpgrade"), out var __jsonEnableAutomaticUpgrade) ? (bool?)__jsonEnableAutomaticUpgrade : EnableAutomaticUpgrade;} + {_lastAttemptDesiredVersion = If( json?.PropertyT("lastAttemptDesiredVersion"), out var __jsonLastAttemptDesiredVersion) ? (string)__jsonLastAttemptDesiredVersion : (string)LastAttemptDesiredVersion;} + {_lastAttemptTimestamp = If( json?.PropertyT("lastAttemptTimestamp"), out var __jsonLastAttemptTimestamp) ? (string)__jsonLastAttemptTimestamp : (string)LastAttemptTimestamp;} + {_lastAttemptStatus = If( json?.PropertyT("lastAttemptStatus"), out var __jsonLastAttemptStatus) ? (string)__jsonLastAttemptStatus : (string)LastAttemptStatus;} + {_lastAttemptMessage = If( json?.PropertyT("lastAttemptMessage"), out var __jsonLastAttemptMessage) ? (string)__jsonLastAttemptMessage : (string)LastAttemptMessage;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new AgentUpgrade(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._desiredVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._desiredVersion.ToString()) : null, "desiredVersion" ,container.Add ); + AddIf( null != (((object)this._correlationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._correlationId.ToString()) : null, "correlationId" ,container.Add ); + AddIf( null != this._enableAutomaticUpgrade ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonBoolean((bool)this._enableAutomaticUpgrade) : null, "enableAutomaticUpgrade" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._lastAttemptDesiredVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._lastAttemptDesiredVersion.ToString()) : null, "lastAttemptDesiredVersion" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._lastAttemptTimestamp)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._lastAttemptTimestamp.ToString()) : null, "lastAttemptTimestamp" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._lastAttemptStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._lastAttemptStatus.ToString()) : null, "lastAttemptStatus" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._lastAttemptMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._lastAttemptMessage.ToString()) : null, "lastAttemptMessage" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersion.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersion.PowerShell.cs new file mode 100644 index 000000000000..c05d98e4098a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersion.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes properties of Agent Version. + [System.ComponentModel.TypeConverter(typeof(AgentVersionTypeConverter))] + public partial class AgentVersion + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AgentVersion(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AgentVersion1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionInternal)this).AgentVersion1 = (string) content.GetValueForProperty("AgentVersion1",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionInternal)this).AgentVersion1, global::System.Convert.ToString); + } + if (content.Contains("DownloadLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionInternal)this).DownloadLink = (string) content.GetValueForProperty("DownloadLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionInternal)this).DownloadLink, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionInternal)this).OSType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AgentVersion(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AgentVersion1")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionInternal)this).AgentVersion1 = (string) content.GetValueForProperty("AgentVersion1",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionInternal)this).AgentVersion1, global::System.Convert.ToString); + } + if (content.Contains("DownloadLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionInternal)this).DownloadLink = (string) content.GetValueForProperty("DownloadLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionInternal)this).DownloadLink, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionInternal)this).OSType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AgentVersion(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AgentVersion(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes properties of Agent Version. + [System.ComponentModel.TypeConverter(typeof(AgentVersionTypeConverter))] + public partial interface IAgentVersion + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersion.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersion.TypeConverter.cs new file mode 100644 index 000000000000..60137cdd7966 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersion.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AgentVersionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AgentVersion.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AgentVersion.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AgentVersion.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersion.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersion.cs new file mode 100644 index 000000000000..1b2f529c061c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersion.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes properties of Agent Version. + public partial class AgentVersion : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionInternal + { + + /// Backing field for property. + private string _agentVersion1; + + /// Represents the agent version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string AgentVersion1 { get => this._agentVersion1; set => this._agentVersion1 = value; } + + /// Backing field for property. + private string _downloadLink; + + /// Represents the download link of specific agent version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string DownloadLink { get => this._downloadLink; set => this._downloadLink = value; } + + /// Backing field for property. + private string _oSType; + + /// Defines the os type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string OSType { get => this._oSType; set => this._oSType = value; } + + /// Creates an new instance. + public AgentVersion() + { + + } + } + /// Describes properties of Agent Version. + public partial interface IAgentVersion : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Represents the agent version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Represents the agent version.", + SerializedName = @"agentVersion", + PossibleTypes = new [] { typeof(string) })] + string AgentVersion1 { get; set; } + /// Represents the download link of specific agent version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Represents the download link of specific agent version.", + SerializedName = @"downloadLink", + PossibleTypes = new [] { typeof(string) })] + string DownloadLink { get; set; } + /// Defines the os type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Defines the os type.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; set; } + + } + /// Describes properties of Agent Version. + internal partial interface IAgentVersionInternal + + { + /// Represents the agent version. + string AgentVersion1 { get; set; } + /// Represents the download link of specific agent version. + string DownloadLink { get; set; } + /// Defines the os type. + string OSType { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersion.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersion.json.cs new file mode 100644 index 000000000000..863a60c3c6f9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersion.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes properties of Agent Version. + public partial class AgentVersion + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal AgentVersion(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_agentVersion1 = If( json?.PropertyT("agentVersion"), out var __jsonAgentVersion) ? (string)__jsonAgentVersion : (string)AgentVersion1;} + {_downloadLink = If( json?.PropertyT("downloadLink"), out var __jsonDownloadLink) ? (string)__jsonDownloadLink : (string)DownloadLink;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new AgentVersion(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._agentVersion1)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._agentVersion1.ToString()) : null, "agentVersion" ,container.Add ); + AddIf( null != (((object)this._downloadLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._downloadLink.ToString()) : null, "downloadLink" ,container.Add ); + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersionsList.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersionsList.PowerShell.cs new file mode 100644 index 000000000000..7b9abae15e9f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersionsList.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes AgentVersions List. + [System.ComponentModel.TypeConverter(typeof(AgentVersionsListTypeConverter))] + public partial class AgentVersionsList + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AgentVersionsList(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsListInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsListInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentVersionTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsListInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AgentVersionsList(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsListInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsListInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentVersionTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsListInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsList DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AgentVersionsList(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AgentVersionsList(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes AgentVersions List. + [System.ComponentModel.TypeConverter(typeof(AgentVersionsListTypeConverter))] + public partial interface IAgentVersionsList + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersionsList.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersionsList.TypeConverter.cs new file mode 100644 index 000000000000..a176e5db6a89 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersionsList.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AgentVersionsListTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsList ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsList).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AgentVersionsList.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AgentVersionsList.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AgentVersionsList.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersionsList.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersionsList.cs new file mode 100644 index 000000000000..2beddc0acb21 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersionsList.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes AgentVersions List. + public partial class AgentVersionsList : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsList, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsListInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The URI to fetch the next 10 available Agent Versions. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion[] _value; + + /// The list of available Agent Versions. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public AgentVersionsList() + { + + } + } + /// Describes AgentVersions List. + public partial interface IAgentVersionsList : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The URI to fetch the next 10 available Agent Versions. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The URI to fetch the next 10 available Agent Versions.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of available Agent Versions. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of available Agent Versions.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion[] Value { get; set; } + + } + /// Describes AgentVersions List. + internal partial interface IAgentVersionsListInternal + + { + /// The URI to fetch the next 10 available Agent Versions. + string NextLink { get; set; } + /// The list of available Agent Versions. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersionsList.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersionsList.json.cs new file mode 100644 index 000000000000..69c2da37fc76 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/AgentVersionsList.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes AgentVersions List. + public partial class AgentVersionsList + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal AgentVersionsList(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentVersion.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsList. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsList. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsList FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new AgentVersionsList(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/CloudMetadata.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/CloudMetadata.PowerShell.cs new file mode 100644 index 000000000000..f0056640b05c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/CloudMetadata.PowerShell.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The metadata of the cloud environment (Azure/GCP/AWS/OCI...). + [System.ComponentModel.TypeConverter(typeof(CloudMetadataTypeConverter))] + public partial class CloudMetadata + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CloudMetadata(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Provider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadataInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadataInternal)this).Provider, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CloudMetadata(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Provider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadataInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadataInternal)this).Provider, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CloudMetadata(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CloudMetadata(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The metadata of the cloud environment (Azure/GCP/AWS/OCI...). + [System.ComponentModel.TypeConverter(typeof(CloudMetadataTypeConverter))] + public partial interface ICloudMetadata + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/CloudMetadata.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/CloudMetadata.TypeConverter.cs new file mode 100644 index 000000000000..85fe1d66e41a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/CloudMetadata.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CloudMetadataTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CloudMetadata.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CloudMetadata.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CloudMetadata.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/CloudMetadata.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/CloudMetadata.cs new file mode 100644 index 000000000000..d56d269915a6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/CloudMetadata.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The metadata of the cloud environment (Azure/GCP/AWS/OCI...). + public partial class CloudMetadata : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadataInternal + { + + /// Internal Acessors for Provider + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadataInternal.Provider { get => this._provider; set { {_provider = value;} } } + + /// Backing field for property. + private string _provider; + + /// Specifies the cloud provider (Azure/AWS/GCP...). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Provider { get => this._provider; } + + /// Creates an new instance. + public CloudMetadata() + { + + } + } + /// The metadata of the cloud environment (Azure/GCP/AWS/OCI...). + public partial interface ICloudMetadata : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Specifies the cloud provider (Azure/AWS/GCP...). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the cloud provider (Azure/AWS/GCP...).", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string Provider { get; } + + } + /// The metadata of the cloud environment (Azure/GCP/AWS/OCI...). + internal partial interface ICloudMetadataInternal + + { + /// Specifies the cloud provider (Azure/AWS/GCP...). + string Provider { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/CloudMetadata.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/CloudMetadata.json.cs new file mode 100644 index 000000000000..620220029147 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/CloudMetadata.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The metadata of the cloud environment (Azure/GCP/AWS/OCI...). + public partial class CloudMetadata + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal CloudMetadata(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provider = If( json?.PropertyT("provider"), out var __jsonProvider) ? (string)__jsonProvider : (string)Provider;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new CloudMetadata(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provider)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._provider.ToString()) : null, "provider" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ConfigurationExtension.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ConfigurationExtension.PowerShell.cs new file mode 100644 index 000000000000..2afeb168f58d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ConfigurationExtension.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes properties that can identify extensions. + [System.ComponentModel.TypeConverter(typeof(ConfigurationExtensionTypeConverter))] + public partial class ConfigurationExtension + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ConfigurationExtension(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Publisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtensionInternal)this).Publisher = (string) content.GetValueForProperty("Publisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtensionInternal)this).Publisher, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtensionInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtensionInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ConfigurationExtension(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Publisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtensionInternal)this).Publisher = (string) content.GetValueForProperty("Publisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtensionInternal)this).Publisher, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtensionInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtensionInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ConfigurationExtension(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ConfigurationExtension(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes properties that can identify extensions. + [System.ComponentModel.TypeConverter(typeof(ConfigurationExtensionTypeConverter))] + public partial interface IConfigurationExtension + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ConfigurationExtension.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ConfigurationExtension.TypeConverter.cs new file mode 100644 index 000000000000..54fb6426b089 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ConfigurationExtension.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ConfigurationExtensionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ConfigurationExtension.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ConfigurationExtension.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ConfigurationExtension.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ConfigurationExtension.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ConfigurationExtension.cs new file mode 100644 index 000000000000..b8e9bf491973 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ConfigurationExtension.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes properties that can identify extensions. + public partial class ConfigurationExtension : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtensionInternal + { + + /// Internal Acessors for Publisher + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtensionInternal.Publisher { get => this._publisher; set { {_publisher = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtensionInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _publisher; + + /// Publisher of the extension. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Publisher { get => this._publisher; } + + /// Backing field for property. + private string _type; + + /// Type of the extension. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public ConfigurationExtension() + { + + } + } + /// Describes properties that can identify extensions. + public partial interface IConfigurationExtension : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Publisher of the extension. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Publisher of the extension.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + string Publisher { get; } + /// Type of the extension. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Type of the extension.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// Describes properties that can identify extensions. + internal partial interface IConfigurationExtensionInternal + + { + /// Publisher of the extension. + string Publisher { get; set; } + /// Type of the extension. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ConfigurationExtension.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ConfigurationExtension.json.cs new file mode 100644 index 000000000000..f78b36351de5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ConfigurationExtension.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes properties that can identify extensions. + public partial class ConfigurationExtension + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal ConfigurationExtension(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_publisher = If( json?.PropertyT("publisher"), out var __jsonPublisher) ? (string)__jsonPublisher : (string)Publisher;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new ConfigurationExtension(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._publisher)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._publisher.ToString()) : null, "publisher" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/DetectedProperties.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/DetectedProperties.PowerShell.cs new file mode 100644 index 000000000000..c73d93bceb84 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/DetectedProperties.PowerShell.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Detected properties from the machine. + [System.ComponentModel.TypeConverter(typeof(DetectedPropertiesTypeConverter))] + public partial class DetectedProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DetectedProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DetectedProperties(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DetectedProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DetectedProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Detected properties from the machine. + [System.ComponentModel.TypeConverter(typeof(DetectedPropertiesTypeConverter))] + public partial interface IDetectedProperties + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/DetectedProperties.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/DetectedProperties.TypeConverter.cs new file mode 100644 index 000000000000..122ef5b1b38b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/DetectedProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DetectedPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DetectedProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DetectedProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DetectedProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/DetectedProperties.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/DetectedProperties.cs new file mode 100644 index 000000000000..48746b24dfdd --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/DetectedProperties.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Detected properties from the machine. + public partial class DetectedProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedPropertiesInternal + { + + /// Creates an new instance. + public DetectedProperties() + { + + } + } + /// Detected properties from the machine. + public partial interface IDetectedProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + + } + /// Detected properties from the machine. + internal partial interface IDetectedPropertiesInternal + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/DetectedProperties.dictionary.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/DetectedProperties.dictionary.cs new file mode 100644 index 000000000000..c7767175da51 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/DetectedProperties.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class DetectedProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.DetectedProperties source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/DetectedProperties.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/DetectedProperties.json.cs new file mode 100644 index 000000000000..397d2457863a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/DetectedProperties.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Detected properties from the machine. + public partial class DetectedProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + /// + internal DetectedProperties(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new DetectedProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTarget.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTarget.PowerShell.cs new file mode 100644 index 000000000000..3884498ce504 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTarget.PowerShell.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes the Machine Extension Target Properties + [System.ComponentModel.TypeConverter(typeof(ExtensionTargetTypeConverter))] + public partial class ExtensionTarget + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTarget DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ExtensionTarget(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTarget DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ExtensionTarget(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ExtensionTarget(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ExtensionTarget(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTarget FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes the Machine Extension Target Properties + [System.ComponentModel.TypeConverter(typeof(ExtensionTargetTypeConverter))] + public partial interface IExtensionTarget + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTarget.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTarget.TypeConverter.cs new file mode 100644 index 000000000000..53bacb4618f1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTarget.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ExtensionTargetTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTarget ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTarget).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ExtensionTarget.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ExtensionTarget.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ExtensionTarget.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTarget.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTarget.cs new file mode 100644 index 000000000000..346c8d320048 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTarget.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the Machine Extension Target Properties + public partial class ExtensionTarget : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTarget, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTargetInternal + { + + /// Creates an new instance. + public ExtensionTarget() + { + + } + } + /// Describes the Machine Extension Target Properties + public partial interface IExtensionTarget : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + + } + /// Describes the Machine Extension Target Properties + internal partial interface IExtensionTargetInternal + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTarget.dictionary.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTarget.dictionary.cs new file mode 100644 index 000000000000..309b78fe2e94 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTarget.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class ExtensionTarget : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTargetProperties this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTargetProperties value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTargetProperties value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ExtensionTarget source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTarget.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTarget.json.cs new file mode 100644 index 000000000000..fcd51c401e84 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTarget.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the Machine Extension Target Properties + public partial class ExtensionTarget + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + /// + internal ExtensionTarget(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, (j) => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ExtensionTargetProperties.FromJson(j) ,exclusions ); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTarget. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTarget. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTarget FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new ExtensionTarget(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTargetProperties.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTargetProperties.PowerShell.cs new file mode 100644 index 000000000000..a7df0180a0b3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTargetProperties.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes the Machine Extension Target Version Properties + [System.ComponentModel.TypeConverter(typeof(ExtensionTargetPropertiesTypeConverter))] + public partial class ExtensionTargetProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTargetProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ExtensionTargetProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTargetProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ExtensionTargetProperties(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ExtensionTargetProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TargetVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTargetPropertiesInternal)this).TargetVersion = (string) content.GetValueForProperty("TargetVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTargetPropertiesInternal)this).TargetVersion, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ExtensionTargetProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TargetVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTargetPropertiesInternal)this).TargetVersion = (string) content.GetValueForProperty("TargetVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTargetPropertiesInternal)this).TargetVersion, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTargetProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes the Machine Extension Target Version Properties + [System.ComponentModel.TypeConverter(typeof(ExtensionTargetPropertiesTypeConverter))] + public partial interface IExtensionTargetProperties + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTargetProperties.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTargetProperties.TypeConverter.cs new file mode 100644 index 000000000000..ddc7b7b54cb0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTargetProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ExtensionTargetPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTargetProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTargetProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ExtensionTargetProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ExtensionTargetProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ExtensionTargetProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTargetProperties.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTargetProperties.cs new file mode 100644 index 000000000000..b85d12adce8a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTargetProperties.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the Machine Extension Target Version Properties + public partial class ExtensionTargetProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTargetProperties, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTargetPropertiesInternal + { + + /// Backing field for property. + private string _targetVersion; + + /// Properties for the specified Extension to Upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string TargetVersion { get => this._targetVersion; set => this._targetVersion = value; } + + /// Creates an new instance. + public ExtensionTargetProperties() + { + + } + } + /// Describes the Machine Extension Target Version Properties + public partial interface IExtensionTargetProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Properties for the specified Extension to Upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Properties for the specified Extension to Upgrade.", + SerializedName = @"targetVersion", + PossibleTypes = new [] { typeof(string) })] + string TargetVersion { get; set; } + + } + /// Describes the Machine Extension Target Version Properties + internal partial interface IExtensionTargetPropertiesInternal + + { + /// Properties for the specified Extension to Upgrade. + string TargetVersion { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTargetProperties.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTargetProperties.json.cs new file mode 100644 index 000000000000..c9125534cd6c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionTargetProperties.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the Machine Extension Target Version Properties + public partial class ExtensionTargetProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal ExtensionTargetProperties(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_targetVersion = If( json?.PropertyT("targetVersion"), out var __jsonTargetVersion) ? (string)__jsonTargetVersion : (string)TargetVersion;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTargetProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTargetProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTargetProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new ExtensionTargetProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._targetVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._targetVersion.ToString()) : null, "targetVersion" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValue.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValue.PowerShell.cs new file mode 100644 index 000000000000..f14c5aaa11c5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValue.PowerShell.cs @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes a Extension Metadata + [System.ComponentModel.TypeConverter(typeof(ExtensionValueTypeConverter))] + public partial class ExtensionValue + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ExtensionValue(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ExtensionValue(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ExtensionValue(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ExtensionValuePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("ExtensionType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueInternal)this).ExtensionType = (string) content.GetValueForProperty("ExtensionType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueInternal)this).ExtensionType, global::System.Convert.ToString); + } + if (content.Contains("Publisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueInternal)this).Publisher = (string) content.GetValueForProperty("Publisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueInternal)this).Publisher, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ExtensionValue(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ExtensionValuePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("ExtensionType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueInternal)this).ExtensionType = (string) content.GetValueForProperty("ExtensionType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueInternal)this).ExtensionType, global::System.Convert.ToString); + } + if (content.Contains("Publisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueInternal)this).Publisher = (string) content.GetValueForProperty("Publisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueInternal)this).Publisher, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes a Extension Metadata + [System.ComponentModel.TypeConverter(typeof(ExtensionValueTypeConverter))] + public partial interface IExtensionValue + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValue.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValue.TypeConverter.cs new file mode 100644 index 000000000000..3a237246e1fd --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValue.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ExtensionValueTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ExtensionValue.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ExtensionValue.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ExtensionValue.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValue.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValue.cs new file mode 100644 index 000000000000..b7f51aa32baa --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValue.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes a Extension Metadata + public partial class ExtensionValue : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueInternal, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Resource(); + + /// The type of the Extension being received. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ExtensionType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal)Property).ExtensionType; } + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Id; } + + /// Internal Acessors for ExtensionType + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueInternal.ExtensionType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal)Property).ExtensionType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal)Property).ExtensionType = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ExtensionValueProperties()); set { {_property = value;} } } + + /// Internal Acessors for Publisher + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueInternal.Publisher { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal)Property).Publisher; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal)Property).Publisher = value; } + + /// Internal Acessors for Version + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueInternal.Version { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal)Property).Version; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal)Property).Version = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemData = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueProperties _property; + + /// The single extension based on search criteria + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ExtensionValueProperties()); set => this._property = value; } + + /// The publisher of the Extension being received. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string Publisher { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal)Property).Publisher; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemData; } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Type; } + + /// The version of the Extension being received. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string Version { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal)Property).Version; } + + /// Creates an new instance. + public ExtensionValue() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Describes a Extension Metadata + public partial interface IExtensionValue : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource + { + /// The type of the Extension being received. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The type of the Extension being received.", + SerializedName = @"extensionType", + PossibleTypes = new [] { typeof(string) })] + string ExtensionType { get; } + /// The publisher of the Extension being received. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The publisher of the Extension being received.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + string Publisher { get; } + /// The version of the Extension being received. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The version of the Extension being received.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string Version { get; } + + } + /// Describes a Extension Metadata + internal partial interface IExtensionValueInternal : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal + { + /// The type of the Extension being received. + string ExtensionType { get; set; } + /// The single extension based on search criteria + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueProperties Property { get; set; } + /// The publisher of the Extension being received. + string Publisher { get; set; } + /// The version of the Extension being received. + string Version { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValue.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValue.json.cs new file mode 100644 index 000000000000..ce377a52ce5c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValue.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes a Extension Metadata + public partial class ExtensionValue + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal ExtensionValue(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ExtensionValueProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new ExtensionValue(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueListResult.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueListResult.PowerShell.cs new file mode 100644 index 000000000000..2db3db97b0ea --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueListResult.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The List Extension Metadata response. + [System.ComponentModel.TypeConverter(typeof(ExtensionValueListResultTypeConverter))] + public partial class ExtensionValueListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ExtensionValueListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ExtensionValueListResult(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ExtensionValueListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ExtensionValueTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ExtensionValueListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ExtensionValueTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The List Extension Metadata response. + [System.ComponentModel.TypeConverter(typeof(ExtensionValueListResultTypeConverter))] + public partial interface IExtensionValueListResult + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueListResult.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueListResult.TypeConverter.cs new file mode 100644 index 000000000000..ae247bb0a4a4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueListResult.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ExtensionValueListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ExtensionValueListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ExtensionValueListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ExtensionValueListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueListResult.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueListResult.cs new file mode 100644 index 000000000000..22b4e8a44d9f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueListResult.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The List Extension Metadata response. + public partial class ExtensionValueListResult : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueListResult, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueListResultInternal + { + + /// Internal Acessors for Value + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueListResultInternal.Value { get => this._value; set { {_value = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue[] _value; + + /// The list of extension metadata + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue[] Value { get => this._value; } + + /// Creates an new instance. + public ExtensionValueListResult() + { + + } + } + /// The List Extension Metadata response. + public partial interface IExtensionValueListResult : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The list of extension metadata + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of extension metadata", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue[] Value { get; } + + } + /// The List Extension Metadata response. + internal partial interface IExtensionValueListResultInternal + + { + /// The list of extension metadata + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueListResult.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueListResult.json.cs new file mode 100644 index 000000000000..eb4aa21f09d5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueListResult.json.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The List Extension Metadata response. + public partial class ExtensionValueListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal ExtensionValueListResult(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ExtensionValue.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new ExtensionValueListResult(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueProperties.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueProperties.PowerShell.cs new file mode 100644 index 000000000000..f4d4e7b23af0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueProperties.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes Extension Metadata properties + [System.ComponentModel.TypeConverter(typeof(ExtensionValuePropertiesTypeConverter))] + public partial class ExtensionValueProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ExtensionValueProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ExtensionValueProperties(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ExtensionValueProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("ExtensionType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal)this).ExtensionType = (string) content.GetValueForProperty("ExtensionType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal)this).ExtensionType, global::System.Convert.ToString); + } + if (content.Contains("Publisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal)this).Publisher = (string) content.GetValueForProperty("Publisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal)this).Publisher, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ExtensionValueProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("ExtensionType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal)this).ExtensionType = (string) content.GetValueForProperty("ExtensionType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal)this).ExtensionType, global::System.Convert.ToString); + } + if (content.Contains("Publisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal)this).Publisher = (string) content.GetValueForProperty("Publisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal)this).Publisher, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes Extension Metadata properties + [System.ComponentModel.TypeConverter(typeof(ExtensionValuePropertiesTypeConverter))] + public partial interface IExtensionValueProperties + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueProperties.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueProperties.TypeConverter.cs new file mode 100644 index 000000000000..c6d893ca9274 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ExtensionValuePropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ExtensionValueProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ExtensionValueProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ExtensionValueProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueProperties.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueProperties.cs new file mode 100644 index 000000000000..5f4052ee5f06 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueProperties.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes Extension Metadata properties + public partial class ExtensionValueProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueProperties, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal + { + + /// Backing field for property. + private string _extensionType; + + /// The type of the Extension being received. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ExtensionType { get => this._extensionType; } + + /// Internal Acessors for ExtensionType + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal.ExtensionType { get => this._extensionType; set { {_extensionType = value;} } } + + /// Internal Acessors for Publisher + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal.Publisher { get => this._publisher; set { {_publisher = value;} } } + + /// Internal Acessors for Version + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValuePropertiesInternal.Version { get => this._version; set { {_version = value;} } } + + /// Backing field for property. + private string _publisher; + + /// The publisher of the Extension being received. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Publisher { get => this._publisher; } + + /// Backing field for property. + private string _version; + + /// The version of the Extension being received. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Version { get => this._version; } + + /// Creates an new instance. + public ExtensionValueProperties() + { + + } + } + /// Describes Extension Metadata properties + public partial interface IExtensionValueProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The type of the Extension being received. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The type of the Extension being received.", + SerializedName = @"extensionType", + PossibleTypes = new [] { typeof(string) })] + string ExtensionType { get; } + /// The publisher of the Extension being received. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The publisher of the Extension being received.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + string Publisher { get; } + /// The version of the Extension being received. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The version of the Extension being received.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string Version { get; } + + } + /// Describes Extension Metadata properties + internal partial interface IExtensionValuePropertiesInternal + + { + /// The type of the Extension being received. + string ExtensionType { get; set; } + /// The publisher of the Extension being received. + string Publisher { get; set; } + /// The version of the Extension being received. + string Version { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueProperties.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueProperties.json.cs new file mode 100644 index 000000000000..53689e9a4e84 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ExtensionValueProperties.json.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes Extension Metadata properties + public partial class ExtensionValueProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal ExtensionValueProperties(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_version = If( json?.PropertyT("version"), out var __jsonVersion) ? (string)__jsonVersion : (string)Version;} + {_extensionType = If( json?.PropertyT("extensionType"), out var __jsonExtensionType) ? (string)__jsonExtensionType : (string)ExtensionType;} + {_publisher = If( json?.PropertyT("publisher"), out var __jsonPublisher) ? (string)__jsonPublisher : (string)Publisher;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new ExtensionValueProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._version)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._version.ToString()) : null, "version" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._extensionType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._extensionType.ToString()) : null, "extensionType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._publisher)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._publisher.ToString()) : null, "publisher" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataAutoGenerated.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataAutoGenerated.PowerShell.cs new file mode 100644 index 000000000000..af12a656c362 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataAutoGenerated.PowerShell.cs @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Defines the HybridIdentityMetadata. + [System.ComponentModel.TypeConverter(typeof(HybridIdentityMetadataAutoGeneratedTypeConverter))] + public partial class HybridIdentityMetadataAutoGenerated + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HybridIdentityMetadataAutoGenerated(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HybridIdentityMetadataAutoGenerated(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HybridIdentityMetadataAutoGenerated(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGenerated) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.HybridIdentityMetadataPropertiesAutoGeneratedTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Identity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IdentityTypeConverter.ConvertFrom); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("PublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).PublicKey, global::System.Convert.ToString); + } + if (content.Contains("IdentityPrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).IdentityPrincipalId = (string) content.GetValueForProperty("IdentityPrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).IdentityPrincipalId, global::System.Convert.ToString); + } + if (content.Contains("IdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).IdentityTenantId = (string) content.GetValueForProperty("IdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).IdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("IdentityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).IdentityType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType?) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).IdentityType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HybridIdentityMetadataAutoGenerated(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGenerated) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.HybridIdentityMetadataPropertiesAutoGeneratedTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Identity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IdentityTypeConverter.ConvertFrom); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("PublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).PublicKey, global::System.Convert.ToString); + } + if (content.Contains("IdentityPrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).IdentityPrincipalId = (string) content.GetValueForProperty("IdentityPrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).IdentityPrincipalId, global::System.Convert.ToString); + } + if (content.Contains("IdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).IdentityTenantId = (string) content.GetValueForProperty("IdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).IdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("IdentityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).IdentityType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType?) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal)this).IdentityType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Defines the HybridIdentityMetadata. + [System.ComponentModel.TypeConverter(typeof(HybridIdentityMetadataAutoGeneratedTypeConverter))] + public partial interface IHybridIdentityMetadataAutoGenerated + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataAutoGenerated.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataAutoGenerated.TypeConverter.cs new file mode 100644 index 000000000000..3e7228b9fd0f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataAutoGenerated.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HybridIdentityMetadataAutoGeneratedTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HybridIdentityMetadataAutoGenerated.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HybridIdentityMetadataAutoGenerated.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HybridIdentityMetadataAutoGenerated.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataAutoGenerated.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataAutoGenerated.cs new file mode 100644 index 000000000000..e24b8264764d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataAutoGenerated.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Defines the HybridIdentityMetadata. + public partial class HybridIdentityMetadataAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Resource(); + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Id; } + + /// The principal ID of resource identity. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentityPrincipalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)Property).IdentityPrincipalId; } + + /// The tenant ID of resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)Property).IdentityTenantId; } + + /// The identity type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)Property).IdentityType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)Property).IdentityType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType)""); } + + /// Internal Acessors for Identity + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal.Identity { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)Property).Identity; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)Property).Identity = value; } + + /// Internal Acessors for IdentityPrincipalId + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal.IdentityPrincipalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)Property).IdentityPrincipalId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)Property).IdentityPrincipalId = value; } + + /// Internal Acessors for IdentityTenantId + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal.IdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)Property).IdentityTenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)Property).IdentityTenantId = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGenerated Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGeneratedInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.HybridIdentityMetadataPropertiesAutoGenerated()); set { {_property = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemData = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGenerated _property; + + /// Resource properties. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGenerated Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.HybridIdentityMetadataPropertiesAutoGenerated()); set => this._property = value; } + + /// The Public Key. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string PublicKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)Property).PublicKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)Property).PublicKey = value ?? null; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemData; } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Type; } + + /// The unique identifier for the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string VMId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)Property).VMId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)Property).VMId = value ?? null; } + + /// Creates an new instance. + public HybridIdentityMetadataAutoGenerated() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Defines the HybridIdentityMetadata. + public partial interface IHybridIdentityMetadataAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource + { + /// The principal ID of resource identity. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The principal ID of resource identity.", + SerializedName = @"principalId", + PossibleTypes = new [] { typeof(string) })] + string IdentityPrincipalId { get; } + /// The tenant ID of resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The tenant ID of resource.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string IdentityTenantId { get; } + /// The identity type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identity type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get; set; } + /// The Public Key. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Public Key.", + SerializedName = @"publicKey", + PossibleTypes = new [] { typeof(string) })] + string PublicKey { get; set; } + /// The unique identifier for the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The unique identifier for the resource.", + SerializedName = @"vmId", + PossibleTypes = new [] { typeof(string) })] + string VMId { get; set; } + + } + /// Defines the HybridIdentityMetadata. + internal partial interface IHybridIdentityMetadataAutoGeneratedInternal : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal + { + /// Identity for the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity Identity { get; set; } + /// The principal ID of resource identity. + string IdentityPrincipalId { get; set; } + /// The tenant ID of resource. + string IdentityTenantId { get; set; } + /// The identity type. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get; set; } + /// Resource properties. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGenerated Property { get; set; } + /// The Public Key. + string PublicKey { get; set; } + /// The unique identifier for the resource. + string VMId { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataAutoGenerated.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataAutoGenerated.json.cs new file mode 100644 index 000000000000..e9bad75abcc2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataAutoGenerated.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Defines the HybridIdentityMetadata. + public partial class HybridIdentityMetadataAutoGenerated + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new HybridIdentityMetadataAutoGenerated(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal HybridIdentityMetadataAutoGenerated(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.HybridIdentityMetadataPropertiesAutoGenerated.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataListAutoGenerated.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataListAutoGenerated.PowerShell.cs new file mode 100644 index 000000000000..f4c8465dd8c3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataListAutoGenerated.PowerShell.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// List of HybridIdentityMetadata. + [System.ComponentModel.TypeConverter(typeof(HybridIdentityMetadataListAutoGeneratedTypeConverter))] + public partial class HybridIdentityMetadataListAutoGenerated + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataListAutoGenerated DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HybridIdentityMetadataListAutoGenerated(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataListAutoGenerated DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HybridIdentityMetadataListAutoGenerated(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataListAutoGenerated FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HybridIdentityMetadataListAutoGenerated(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataListAutoGeneratedInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataListAutoGeneratedInternal)this).NextLink, global::System.Convert.ToString); + } + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataListAutoGeneratedInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataListAutoGeneratedInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.HybridIdentityMetadataAutoGeneratedTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HybridIdentityMetadataListAutoGenerated(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataListAutoGeneratedInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataListAutoGeneratedInternal)this).NextLink, global::System.Convert.ToString); + } + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataListAutoGeneratedInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataListAutoGeneratedInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.HybridIdentityMetadataAutoGeneratedTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// List of HybridIdentityMetadata. + [System.ComponentModel.TypeConverter(typeof(HybridIdentityMetadataListAutoGeneratedTypeConverter))] + public partial interface IHybridIdentityMetadataListAutoGenerated + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataListAutoGenerated.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataListAutoGenerated.TypeConverter.cs new file mode 100644 index 000000000000..06d852f77fd5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataListAutoGenerated.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HybridIdentityMetadataListAutoGeneratedTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataListAutoGenerated ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataListAutoGenerated).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HybridIdentityMetadataListAutoGenerated.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HybridIdentityMetadataListAutoGenerated.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HybridIdentityMetadataListAutoGenerated.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataListAutoGenerated.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataListAutoGenerated.cs new file mode 100644 index 000000000000..dcf4f91d6b2c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataListAutoGenerated.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// List of HybridIdentityMetadata. + public partial class HybridIdentityMetadataListAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataListAutoGenerated, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataListAutoGeneratedInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Url to follow for getting next page of HybridIdentityMetadata. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated[] _value; + + /// Array of HybridIdentityMetadata + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public HybridIdentityMetadataListAutoGenerated() + { + + } + } + /// List of HybridIdentityMetadata. + public partial interface IHybridIdentityMetadataListAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Url to follow for getting next page of HybridIdentityMetadata. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Url to follow for getting next page of HybridIdentityMetadata.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Array of HybridIdentityMetadata + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Array of HybridIdentityMetadata", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated[] Value { get; set; } + + } + /// List of HybridIdentityMetadata. + internal partial interface IHybridIdentityMetadataListAutoGeneratedInternal + + { + /// Url to follow for getting next page of HybridIdentityMetadata. + string NextLink { get; set; } + /// Array of HybridIdentityMetadata + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataListAutoGenerated.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataListAutoGenerated.json.cs new file mode 100644 index 000000000000..391226836e2d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataListAutoGenerated.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// List of HybridIdentityMetadata. + public partial class HybridIdentityMetadataListAutoGenerated + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataListAutoGenerated. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataListAutoGenerated. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataListAutoGenerated FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new HybridIdentityMetadataListAutoGenerated(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal HybridIdentityMetadataListAutoGenerated(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.HybridIdentityMetadataAutoGenerated.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataPropertiesAutoGenerated.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataPropertiesAutoGenerated.PowerShell.cs new file mode 100644 index 000000000000..e39745639979 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataPropertiesAutoGenerated.PowerShell.cs @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Defines the resource properties. + [System.ComponentModel.TypeConverter(typeof(HybridIdentityMetadataPropertiesAutoGeneratedTypeConverter))] + public partial class HybridIdentityMetadataPropertiesAutoGenerated + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGenerated DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HybridIdentityMetadataPropertiesAutoGenerated(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGenerated DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HybridIdentityMetadataPropertiesAutoGenerated(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGenerated FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HybridIdentityMetadataPropertiesAutoGenerated(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Identity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IdentityTypeConverter.ConvertFrom); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("PublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).PublicKey, global::System.Convert.ToString); + } + if (content.Contains("IdentityPrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).IdentityPrincipalId = (string) content.GetValueForProperty("IdentityPrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).IdentityPrincipalId, global::System.Convert.ToString); + } + if (content.Contains("IdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).IdentityTenantId = (string) content.GetValueForProperty("IdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).IdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("IdentityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).IdentityType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType?) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).IdentityType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HybridIdentityMetadataPropertiesAutoGenerated(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Identity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IdentityTypeConverter.ConvertFrom); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("PublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).PublicKey, global::System.Convert.ToString); + } + if (content.Contains("IdentityPrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).IdentityPrincipalId = (string) content.GetValueForProperty("IdentityPrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).IdentityPrincipalId, global::System.Convert.ToString); + } + if (content.Contains("IdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).IdentityTenantId = (string) content.GetValueForProperty("IdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).IdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("IdentityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).IdentityType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType?) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal)this).IdentityType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Defines the resource properties. + [System.ComponentModel.TypeConverter(typeof(HybridIdentityMetadataPropertiesAutoGeneratedTypeConverter))] + public partial interface IHybridIdentityMetadataPropertiesAutoGenerated + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataPropertiesAutoGenerated.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataPropertiesAutoGenerated.TypeConverter.cs new file mode 100644 index 000000000000..da88ea5196af --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataPropertiesAutoGenerated.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HybridIdentityMetadataPropertiesAutoGeneratedTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGenerated ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGenerated).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HybridIdentityMetadataPropertiesAutoGenerated.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HybridIdentityMetadataPropertiesAutoGenerated.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HybridIdentityMetadataPropertiesAutoGenerated.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataPropertiesAutoGenerated.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataPropertiesAutoGenerated.cs new file mode 100644 index 000000000000..653f8b59f21d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataPropertiesAutoGenerated.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Defines the resource properties. + public partial class HybridIdentityMetadataPropertiesAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGenerated, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity _identity; + + /// Identity for the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity Identity { get => (this._identity = this._identity ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Identity()); } + + /// The principal ID of resource identity. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentityPrincipalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).PrincipalId; } + + /// The tenant ID of resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).TenantId; } + + /// The identity type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).Type = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType)""); } + + /// Internal Acessors for Identity + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal.Identity { get => (this._identity = this._identity ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Identity()); set { {_identity = value;} } } + + /// Internal Acessors for IdentityPrincipalId + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal.IdentityPrincipalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).PrincipalId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).PrincipalId = value; } + + /// Internal Acessors for IdentityTenantId + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGeneratedInternal.IdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).TenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).TenantId = value; } + + /// Backing field for property. + private string _publicKey; + + /// The Public Key. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string PublicKey { get => this._publicKey; set => this._publicKey = value; } + + /// Backing field for property. + private string _vMId; + + /// The unique identifier for the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string VMId { get => this._vMId; set => this._vMId = value; } + + /// + /// Creates an new instance. + /// + public HybridIdentityMetadataPropertiesAutoGenerated() + { + + } + } + /// Defines the resource properties. + public partial interface IHybridIdentityMetadataPropertiesAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The principal ID of resource identity. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The principal ID of resource identity.", + SerializedName = @"principalId", + PossibleTypes = new [] { typeof(string) })] + string IdentityPrincipalId { get; } + /// The tenant ID of resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The tenant ID of resource.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string IdentityTenantId { get; } + /// The identity type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identity type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get; set; } + /// The Public Key. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Public Key.", + SerializedName = @"publicKey", + PossibleTypes = new [] { typeof(string) })] + string PublicKey { get; set; } + /// The unique identifier for the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The unique identifier for the resource.", + SerializedName = @"vmId", + PossibleTypes = new [] { typeof(string) })] + string VMId { get; set; } + + } + /// Defines the resource properties. + internal partial interface IHybridIdentityMetadataPropertiesAutoGeneratedInternal + + { + /// Identity for the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity Identity { get; set; } + /// The principal ID of resource identity. + string IdentityPrincipalId { get; set; } + /// The tenant ID of resource. + string IdentityTenantId { get; set; } + /// The identity type. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get; set; } + /// The Public Key. + string PublicKey { get; set; } + /// The unique identifier for the resource. + string VMId { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataPropertiesAutoGenerated.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataPropertiesAutoGenerated.json.cs new file mode 100644 index 000000000000..7445ab722694 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/HybridIdentityMetadataPropertiesAutoGenerated.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Defines the resource properties. + public partial class HybridIdentityMetadataPropertiesAutoGenerated + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGenerated. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGenerated. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataPropertiesAutoGenerated FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new HybridIdentityMetadataPropertiesAutoGenerated(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal HybridIdentityMetadataPropertiesAutoGenerated(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_identity = If( json?.PropertyT("identity"), out var __jsonIdentity) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Identity.FromJson(__jsonIdentity) : Identity;} + {_vMId = If( json?.PropertyT("vmId"), out var __jsonVMId) ? (string)__jsonVMId : (string)VMId;} + {_publicKey = If( json?.PropertyT("publicKey"), out var __jsonPublicKey) ? (string)__jsonPublicKey : (string)PublicKey;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._identity ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._identity.ToJson(null,serializationMode) : null, "identity" ,container.Add ); + } + AddIf( null != (((object)this._vMId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._vMId.ToString()) : null, "vmId" ,container.Add ); + AddIf( null != (((object)this._publicKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._publicKey.ToString()) : null, "publicKey" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/IPAddress.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/IPAddress.PowerShell.cs new file mode 100644 index 000000000000..bb2f676d88e0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/IPAddress.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes properties of the IP address. + [System.ComponentModel.TypeConverter(typeof(IPAddressTypeConverter))] + public partial class IPAddress + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddress DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new IPAddress(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddress DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new IPAddress(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddress FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal IPAddress(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Subnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddressInternal)this).Subnet = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ISubnetAutoGenerated) content.GetValueForProperty("Subnet",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddressInternal)this).Subnet, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.SubnetAutoGeneratedTypeConverter.ConvertFrom); + } + if (content.Contains("Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddressInternal)this).Address = (string) content.GetValueForProperty("Address",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddressInternal)this).Address, global::System.Convert.ToString); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddressInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddressInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("SubnetAddressPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddressInternal)this).SubnetAddressPrefix = (string) content.GetValueForProperty("SubnetAddressPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddressInternal)this).SubnetAddressPrefix, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal IPAddress(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Subnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddressInternal)this).Subnet = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ISubnetAutoGenerated) content.GetValueForProperty("Subnet",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddressInternal)this).Subnet, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.SubnetAutoGeneratedTypeConverter.ConvertFrom); + } + if (content.Contains("Address")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddressInternal)this).Address = (string) content.GetValueForProperty("Address",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddressInternal)this).Address, global::System.Convert.ToString); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddressInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddressInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("SubnetAddressPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddressInternal)this).SubnetAddressPrefix = (string) content.GetValueForProperty("SubnetAddressPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddressInternal)this).SubnetAddressPrefix, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes properties of the IP address. + [System.ComponentModel.TypeConverter(typeof(IPAddressTypeConverter))] + public partial interface IIPAddress + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/IPAddress.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/IPAddress.TypeConverter.cs new file mode 100644 index 000000000000..1919b8108329 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/IPAddress.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class IPAddressTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddress ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddress).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return IPAddress.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return IPAddress.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return IPAddress.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/IPAddress.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/IPAddress.cs new file mode 100644 index 000000000000..946d41e7589f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/IPAddress.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes properties of the IP address. + public partial class IPAddress : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddress, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddressInternal + { + + /// Backing field for property. + private string _address; + + /// Represents the IP Address. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Address { get => this._address; set => this._address = value; } + + /// Internal Acessors for Subnet + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ISubnetAutoGenerated Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddressInternal.Subnet { get => (this._subnet = this._subnet ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.SubnetAutoGenerated()); set { {_subnet = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ISubnetAutoGenerated _subnet; + + /// The subnet to which this IP address belongs. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ISubnetAutoGenerated Subnet { get => (this._subnet = this._subnet ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.SubnetAutoGenerated()); } + + /// Represents address prefix. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string SubnetAddressPrefix { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ISubnetAutoGeneratedInternal)Subnet).AddressPrefix; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ISubnetAutoGeneratedInternal)Subnet).AddressPrefix = value ?? null; } + + /// Backing field for property. + private string _version; + + /// Represents the Ip Address Version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Version { get => this._version; set => this._version = value; } + + /// Creates an new instance. + public IPAddress() + { + + } + } + /// Describes properties of the IP address. + public partial interface IIPAddress : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Represents the IP Address. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Represents the IP Address.", + SerializedName = @"address", + PossibleTypes = new [] { typeof(string) })] + string Address { get; set; } + /// Represents address prefix. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Represents address prefix.", + SerializedName = @"addressPrefix", + PossibleTypes = new [] { typeof(string) })] + string SubnetAddressPrefix { get; set; } + /// Represents the Ip Address Version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Represents the Ip Address Version.", + SerializedName = @"ipAddressVersion", + PossibleTypes = new [] { typeof(string) })] + string Version { get; set; } + + } + /// Describes properties of the IP address. + internal partial interface IIPAddressInternal + + { + /// Represents the IP Address. + string Address { get; set; } + /// The subnet to which this IP address belongs. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ISubnetAutoGenerated Subnet { get; set; } + /// Represents address prefix. + string SubnetAddressPrefix { get; set; } + /// Represents the Ip Address Version. + string Version { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/IPAddress.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/IPAddress.json.cs new file mode 100644 index 000000000000..6dc1faf7b5ac --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/IPAddress.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes properties of the IP address. + public partial class IPAddress + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddress. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddress. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddress FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new IPAddress(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal IPAddress(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_subnet = If( json?.PropertyT("subnet"), out var __jsonSubnet) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.SubnetAutoGenerated.FromJson(__jsonSubnet) : Subnet;} + {_address = If( json?.PropertyT("address"), out var __jsonAddress) ? (string)__jsonAddress : (string)Address;} + {_version = If( json?.PropertyT("ipAddressVersion"), out var __jsonIPAddressVersion) ? (string)__jsonIPAddressVersion : (string)Version;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._subnet ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._subnet.ToJson(null,serializationMode) : null, "subnet" ,container.Add ); + } + AddIf( null != (((object)this._address)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._address.ToString()) : null, "address" ,container.Add ); + AddIf( null != (((object)this._version)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._version.ToString()) : null, "ipAddressVersion" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/Machine.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/Machine.PowerShell.cs new file mode 100644 index 000000000000..e64a690f390a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/Machine.PowerShell.cs @@ -0,0 +1,808 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes a hybrid machine. + [System.ComponentModel.TypeConverter(typeof(MachineTypeConverter))] + public partial class Machine + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Machine(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Machine(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Machine(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachinePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Identity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IdentityTypeConverter.ConvertFrom); + } + if (content.Contains("Resource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Resource = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension[]) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Resource, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionTypeConverter.ConvertFrom)); + } + if (content.Contains("Kind")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Kind = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind?) content.GetValueForProperty("Kind",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Kind, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind.CreateFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("LocationData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LocationData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData) content.GetValueForProperty("LocationData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LocationData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.LocationDataTypeConverter.ConvertFrom); + } + if (content.Contains("AgentConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfiguration) content.GetValueForProperty("AgentConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("ServiceStatuses")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ServiceStatuses = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatuses) content.GetValueForProperty("ServiceStatuses",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ServiceStatuses, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatusesTypeConverter.ConvertFrom); + } + if (content.Contains("CloudMetadata")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).CloudMetadata = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata) content.GetValueForProperty("CloudMetadata",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).CloudMetadata, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.CloudMetadataTypeConverter.ConvertFrom); + } + if (content.Contains("AgentUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgrade = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade) content.GetValueForProperty("AgentUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgrade, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentUpgradeTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile) content.GetValueForProperty("OSProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileTypeConverter.ConvertFrom); + } + if (content.Contains("NetworkProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).NetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfile) content.GetValueForProperty("NetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).NetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.NetworkProfileTypeConverter.ConvertFrom); + } + if (content.Contains("DetectedProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).DetectedProperty = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties) content.GetValueForProperty("DetectedProperty",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).DetectedProperty, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.DetectedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityPrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).IdentityPrincipalId = (string) content.GetValueForProperty("IdentityPrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).IdentityPrincipalId, global::System.Convert.ToString); + } + if (content.Contains("IdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).IdentityTenantId = (string) content.GetValueForProperty("IdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).IdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes.CreateFrom); + } + if (content.Contains("LastStatusChange")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LastStatusChange = (global::System.DateTime?) content.GetValueForProperty("LastStatusChange",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LastStatusChange, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[]) content.GetValueForProperty("ErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("AgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentVersion = (string) content.GetValueForProperty("AgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentVersion, global::System.Convert.ToString); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("Fqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Fqdn = (string) content.GetValueForProperty("Fqdn",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Fqdn, global::System.Convert.ToString); + } + if (content.Contains("ClientPublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ClientPublicKey = (string) content.GetValueForProperty("ClientPublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ClientPublicKey, global::System.Convert.ToString); + } + if (content.Contains("OSName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSName = (string) content.GetValueForProperty("OSName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSName, global::System.Convert.ToString); + } + if (content.Contains("OSVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSVersion = (string) content.GetValueForProperty("OSVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSVersion, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("VMUuid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).VMUuid = (string) content.GetValueForProperty("VMUuid",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).VMUuid, global::System.Convert.ToString); + } + if (content.Contains("Extension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Extension = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView[]) content.GetValueForProperty("Extension",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Extension, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceViewTypeConverter.ConvertFrom)); + } + if (content.Contains("OSSku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSSku = (string) content.GetValueForProperty("OSSku",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSSku, global::System.Convert.ToString); + } + if (content.Contains("DomainName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).DomainName = (string) content.GetValueForProperty("DomainName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).DomainName, global::System.Convert.ToString); + } + if (content.Contains("AdFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AdFqdn = (string) content.GetValueForProperty("AdFqdn",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AdFqdn, global::System.Convert.ToString); + } + if (content.Contains("DnsFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).DnsFqdn = (string) content.GetValueForProperty("DnsFqdn",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).DnsFqdn, global::System.Convert.ToString); + } + if (content.Contains("PrivateLinkScopeResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).PrivateLinkScopeResourceId = (string) content.GetValueForProperty("PrivateLinkScopeResourceId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).PrivateLinkScopeResourceId, global::System.Convert.ToString); + } + if (content.Contains("ParentClusterResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ParentClusterResourceId = (string) content.GetValueForProperty("ParentClusterResourceId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ParentClusterResourceId, global::System.Convert.ToString); + } + if (content.Contains("MssqlDiscovered")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).MssqlDiscovered = (string) content.GetValueForProperty("MssqlDiscovered",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).MssqlDiscovered, global::System.Convert.ToString); + } + if (content.Contains("LocationDataName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LocationDataName = (string) content.GetValueForProperty("LocationDataName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LocationDataName, global::System.Convert.ToString); + } + if (content.Contains("LocationDataCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LocationDataCity = (string) content.GetValueForProperty("LocationDataCity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LocationDataCity, global::System.Convert.ToString); + } + if (content.Contains("LocationDataDistrict")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LocationDataDistrict = (string) content.GetValueForProperty("LocationDataDistrict",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LocationDataDistrict, global::System.Convert.ToString); + } + if (content.Contains("AgentConfigurationProxyUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationProxyUrl = (string) content.GetValueForProperty("AgentConfigurationProxyUrl",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationProxyUrl, global::System.Convert.ToString); + } + if (content.Contains("AgentConfigurationProxyBypass")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationProxyBypass = (string[]) content.GetValueForProperty("AgentConfigurationProxyBypass",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationProxyBypass, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("AgentConfigurationExtensionsEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationExtensionsEnabled = (string) content.GetValueForProperty("AgentConfigurationExtensionsEnabled",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationExtensionsEnabled, global::System.Convert.ToString); + } + if (content.Contains("CloudMetadataProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).CloudMetadataProvider = (string) content.GetValueForProperty("CloudMetadataProvider",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).CloudMetadataProvider, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeDesiredVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeDesiredVersion = (string) content.GetValueForProperty("AgentUpgradeDesiredVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeDesiredVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeCorrelationId = (string) content.GetValueForProperty("AgentUpgradeCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeCorrelationId, global::System.Convert.ToString); + } + if (content.Contains("NetworkProfileNetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).NetworkProfileNetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface[]) content.GetValueForProperty("NetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).NetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.NetworkInterfaceTypeConverter.ConvertFrom)); + } + if (content.Contains("IdentityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).IdentityType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType?) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).IdentityType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType.CreateFrom); + } + if (content.Contains("LocationDataCountryOrRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LocationDataCountryOrRegion = (string) content.GetValueForProperty("LocationDataCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LocationDataCountryOrRegion, global::System.Convert.ToString); + } + if (content.Contains("AgentConfigurationIncomingConnectionsPort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationIncomingConnectionsPort = (string[]) content.GetValueForProperty("AgentConfigurationIncomingConnectionsPort",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationIncomingConnectionsPort, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("AgentConfigurationExtensionsAllowList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationExtensionsAllowList = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[]) content.GetValueForProperty("AgentConfigurationExtensionsAllowList",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationExtensionsAllowList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ConfigurationExtensionTypeConverter.ConvertFrom)); + } + if (content.Contains("AgentConfigurationExtensionsBlockList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationExtensionsBlockList = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[]) content.GetValueForProperty("AgentConfigurationExtensionsBlockList",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationExtensionsBlockList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ConfigurationExtensionTypeConverter.ConvertFrom)); + } + if (content.Contains("AgentConfigurationGuestConfigurationEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationGuestConfigurationEnabled = (string) content.GetValueForProperty("AgentConfigurationGuestConfigurationEnabled",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationGuestConfigurationEnabled, global::System.Convert.ToString); + } + if (content.Contains("AgentConfigurationConfigMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationConfigMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode?) content.GetValueForProperty("AgentConfigurationConfigMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationConfigMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode.CreateFrom); + } + if (content.Contains("ServiceStatusesExtensionService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ServiceStatusesExtensionService = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus) content.GetValueForProperty("ServiceStatusesExtensionService",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ServiceStatusesExtensionService, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ServiceStatusesGuestConfigurationService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ServiceStatusesGuestConfigurationService = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus) content.GetValueForProperty("ServiceStatusesGuestConfigurationService",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ServiceStatusesGuestConfigurationService, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatusTypeConverter.ConvertFrom); + } + if (content.Contains("AgentUpgradeEnableAutomaticUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeEnableAutomaticUpgrade = (bool?) content.GetValueForProperty("AgentUpgradeEnableAutomaticUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeEnableAutomaticUpgrade, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AgentUpgradeLastAttemptDesiredVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeLastAttemptDesiredVersion = (string) content.GetValueForProperty("AgentUpgradeLastAttemptDesiredVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeLastAttemptDesiredVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeLastAttemptTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeLastAttemptTimestamp = (string) content.GetValueForProperty("AgentUpgradeLastAttemptTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeLastAttemptTimestamp, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeLastAttemptStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeLastAttemptStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum?) content.GetValueForProperty("AgentUpgradeLastAttemptStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeLastAttemptStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum.CreateFrom); + } + if (content.Contains("AgentUpgradeLastAttemptMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeLastAttemptMessage = (string) content.GetValueForProperty("AgentUpgradeLastAttemptMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeLastAttemptMessage, global::System.Convert.ToString); + } + if (content.Contains("OSProfileWindowsConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSProfileWindowsConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration) content.GetValueForProperty("OSProfileWindowsConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSProfileWindowsConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileWindowsConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileLinuxConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSProfileLinuxConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration) content.GetValueForProperty("OSProfileLinuxConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSProfileLinuxConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileLinuxConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileComputerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSProfileComputerName = (string) content.GetValueForProperty("OSProfileComputerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSProfileComputerName, global::System.Convert.ToString); + } + if (content.Contains("WindowConfigurationPatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).WindowConfigurationPatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("WindowConfigurationPatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).WindowConfigurationPatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("LinuxConfigurationPatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LinuxConfigurationPatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("LinuxConfigurationPatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LinuxConfigurationPatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("ExtensionServiceStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ExtensionServiceStatus = (string) content.GetValueForProperty("ExtensionServiceStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ExtensionServiceStatus, global::System.Convert.ToString); + } + if (content.Contains("ExtensionServiceStartupType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ExtensionServiceStartupType = (string) content.GetValueForProperty("ExtensionServiceStartupType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ExtensionServiceStartupType, global::System.Convert.ToString); + } + if (content.Contains("GuestConfigurationServiceStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).GuestConfigurationServiceStatus = (string) content.GetValueForProperty("GuestConfigurationServiceStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).GuestConfigurationServiceStatus, global::System.Convert.ToString); + } + if (content.Contains("GuestConfigurationServiceStartupType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).GuestConfigurationServiceStartupType = (string) content.GetValueForProperty("GuestConfigurationServiceStartupType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).GuestConfigurationServiceStartupType, global::System.Convert.ToString); + } + if (content.Contains("WindowsConfigurationPatchSettingsAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).WindowsConfigurationPatchSettingsAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("WindowsConfigurationPatchSettingsAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).WindowsConfigurationPatchSettingsAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("WindowsConfigurationPatchSettingsPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).WindowsConfigurationPatchSettingsPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("WindowsConfigurationPatchSettingsPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).WindowsConfigurationPatchSettingsPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + if (content.Contains("LinuxConfigurationPatchSettingsAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LinuxConfigurationPatchSettingsAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("LinuxConfigurationPatchSettingsAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LinuxConfigurationPatchSettingsAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("LinuxConfigurationPatchSettingsPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LinuxConfigurationPatchSettingsPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("LinuxConfigurationPatchSettingsPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LinuxConfigurationPatchSettingsPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Machine(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachinePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Identity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IdentityTypeConverter.ConvertFrom); + } + if (content.Contains("Resource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Resource = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension[]) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Resource, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionTypeConverter.ConvertFrom)); + } + if (content.Contains("Kind")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Kind = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind?) content.GetValueForProperty("Kind",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Kind, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind.CreateFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("LocationData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LocationData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData) content.GetValueForProperty("LocationData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LocationData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.LocationDataTypeConverter.ConvertFrom); + } + if (content.Contains("AgentConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfiguration) content.GetValueForProperty("AgentConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("ServiceStatuses")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ServiceStatuses = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatuses) content.GetValueForProperty("ServiceStatuses",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ServiceStatuses, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatusesTypeConverter.ConvertFrom); + } + if (content.Contains("CloudMetadata")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).CloudMetadata = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata) content.GetValueForProperty("CloudMetadata",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).CloudMetadata, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.CloudMetadataTypeConverter.ConvertFrom); + } + if (content.Contains("AgentUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgrade = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade) content.GetValueForProperty("AgentUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgrade, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentUpgradeTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile) content.GetValueForProperty("OSProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileTypeConverter.ConvertFrom); + } + if (content.Contains("NetworkProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).NetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfile) content.GetValueForProperty("NetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).NetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.NetworkProfileTypeConverter.ConvertFrom); + } + if (content.Contains("DetectedProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).DetectedProperty = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties) content.GetValueForProperty("DetectedProperty",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).DetectedProperty, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.DetectedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityPrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).IdentityPrincipalId = (string) content.GetValueForProperty("IdentityPrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).IdentityPrincipalId, global::System.Convert.ToString); + } + if (content.Contains("IdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).IdentityTenantId = (string) content.GetValueForProperty("IdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).IdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes.CreateFrom); + } + if (content.Contains("LastStatusChange")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LastStatusChange = (global::System.DateTime?) content.GetValueForProperty("LastStatusChange",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LastStatusChange, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[]) content.GetValueForProperty("ErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("AgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentVersion = (string) content.GetValueForProperty("AgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentVersion, global::System.Convert.ToString); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("Fqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Fqdn = (string) content.GetValueForProperty("Fqdn",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Fqdn, global::System.Convert.ToString); + } + if (content.Contains("ClientPublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ClientPublicKey = (string) content.GetValueForProperty("ClientPublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ClientPublicKey, global::System.Convert.ToString); + } + if (content.Contains("OSName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSName = (string) content.GetValueForProperty("OSName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSName, global::System.Convert.ToString); + } + if (content.Contains("OSVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSVersion = (string) content.GetValueForProperty("OSVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSVersion, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("VMUuid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).VMUuid = (string) content.GetValueForProperty("VMUuid",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).VMUuid, global::System.Convert.ToString); + } + if (content.Contains("Extension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Extension = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView[]) content.GetValueForProperty("Extension",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).Extension, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceViewTypeConverter.ConvertFrom)); + } + if (content.Contains("OSSku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSSku = (string) content.GetValueForProperty("OSSku",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSSku, global::System.Convert.ToString); + } + if (content.Contains("DomainName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).DomainName = (string) content.GetValueForProperty("DomainName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).DomainName, global::System.Convert.ToString); + } + if (content.Contains("AdFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AdFqdn = (string) content.GetValueForProperty("AdFqdn",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AdFqdn, global::System.Convert.ToString); + } + if (content.Contains("DnsFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).DnsFqdn = (string) content.GetValueForProperty("DnsFqdn",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).DnsFqdn, global::System.Convert.ToString); + } + if (content.Contains("PrivateLinkScopeResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).PrivateLinkScopeResourceId = (string) content.GetValueForProperty("PrivateLinkScopeResourceId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).PrivateLinkScopeResourceId, global::System.Convert.ToString); + } + if (content.Contains("ParentClusterResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ParentClusterResourceId = (string) content.GetValueForProperty("ParentClusterResourceId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ParentClusterResourceId, global::System.Convert.ToString); + } + if (content.Contains("MssqlDiscovered")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).MssqlDiscovered = (string) content.GetValueForProperty("MssqlDiscovered",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).MssqlDiscovered, global::System.Convert.ToString); + } + if (content.Contains("LocationDataName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LocationDataName = (string) content.GetValueForProperty("LocationDataName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LocationDataName, global::System.Convert.ToString); + } + if (content.Contains("LocationDataCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LocationDataCity = (string) content.GetValueForProperty("LocationDataCity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LocationDataCity, global::System.Convert.ToString); + } + if (content.Contains("LocationDataDistrict")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LocationDataDistrict = (string) content.GetValueForProperty("LocationDataDistrict",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LocationDataDistrict, global::System.Convert.ToString); + } + if (content.Contains("AgentConfigurationProxyUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationProxyUrl = (string) content.GetValueForProperty("AgentConfigurationProxyUrl",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationProxyUrl, global::System.Convert.ToString); + } + if (content.Contains("AgentConfigurationProxyBypass")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationProxyBypass = (string[]) content.GetValueForProperty("AgentConfigurationProxyBypass",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationProxyBypass, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("AgentConfigurationExtensionsEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationExtensionsEnabled = (string) content.GetValueForProperty("AgentConfigurationExtensionsEnabled",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationExtensionsEnabled, global::System.Convert.ToString); + } + if (content.Contains("CloudMetadataProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).CloudMetadataProvider = (string) content.GetValueForProperty("CloudMetadataProvider",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).CloudMetadataProvider, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeDesiredVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeDesiredVersion = (string) content.GetValueForProperty("AgentUpgradeDesiredVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeDesiredVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeCorrelationId = (string) content.GetValueForProperty("AgentUpgradeCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeCorrelationId, global::System.Convert.ToString); + } + if (content.Contains("NetworkProfileNetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).NetworkProfileNetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface[]) content.GetValueForProperty("NetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).NetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.NetworkInterfaceTypeConverter.ConvertFrom)); + } + if (content.Contains("IdentityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).IdentityType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType?) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).IdentityType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType.CreateFrom); + } + if (content.Contains("LocationDataCountryOrRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LocationDataCountryOrRegion = (string) content.GetValueForProperty("LocationDataCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LocationDataCountryOrRegion, global::System.Convert.ToString); + } + if (content.Contains("AgentConfigurationIncomingConnectionsPort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationIncomingConnectionsPort = (string[]) content.GetValueForProperty("AgentConfigurationIncomingConnectionsPort",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationIncomingConnectionsPort, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("AgentConfigurationExtensionsAllowList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationExtensionsAllowList = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[]) content.GetValueForProperty("AgentConfigurationExtensionsAllowList",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationExtensionsAllowList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ConfigurationExtensionTypeConverter.ConvertFrom)); + } + if (content.Contains("AgentConfigurationExtensionsBlockList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationExtensionsBlockList = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[]) content.GetValueForProperty("AgentConfigurationExtensionsBlockList",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationExtensionsBlockList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ConfigurationExtensionTypeConverter.ConvertFrom)); + } + if (content.Contains("AgentConfigurationGuestConfigurationEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationGuestConfigurationEnabled = (string) content.GetValueForProperty("AgentConfigurationGuestConfigurationEnabled",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationGuestConfigurationEnabled, global::System.Convert.ToString); + } + if (content.Contains("AgentConfigurationConfigMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationConfigMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode?) content.GetValueForProperty("AgentConfigurationConfigMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentConfigurationConfigMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode.CreateFrom); + } + if (content.Contains("ServiceStatusesExtensionService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ServiceStatusesExtensionService = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus) content.GetValueForProperty("ServiceStatusesExtensionService",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ServiceStatusesExtensionService, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ServiceStatusesGuestConfigurationService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ServiceStatusesGuestConfigurationService = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus) content.GetValueForProperty("ServiceStatusesGuestConfigurationService",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ServiceStatusesGuestConfigurationService, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatusTypeConverter.ConvertFrom); + } + if (content.Contains("AgentUpgradeEnableAutomaticUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeEnableAutomaticUpgrade = (bool?) content.GetValueForProperty("AgentUpgradeEnableAutomaticUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeEnableAutomaticUpgrade, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AgentUpgradeLastAttemptDesiredVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeLastAttemptDesiredVersion = (string) content.GetValueForProperty("AgentUpgradeLastAttemptDesiredVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeLastAttemptDesiredVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeLastAttemptTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeLastAttemptTimestamp = (string) content.GetValueForProperty("AgentUpgradeLastAttemptTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeLastAttemptTimestamp, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeLastAttemptStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeLastAttemptStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum?) content.GetValueForProperty("AgentUpgradeLastAttemptStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeLastAttemptStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum.CreateFrom); + } + if (content.Contains("AgentUpgradeLastAttemptMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeLastAttemptMessage = (string) content.GetValueForProperty("AgentUpgradeLastAttemptMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).AgentUpgradeLastAttemptMessage, global::System.Convert.ToString); + } + if (content.Contains("OSProfileWindowsConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSProfileWindowsConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration) content.GetValueForProperty("OSProfileWindowsConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSProfileWindowsConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileWindowsConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileLinuxConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSProfileLinuxConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration) content.GetValueForProperty("OSProfileLinuxConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSProfileLinuxConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileLinuxConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileComputerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSProfileComputerName = (string) content.GetValueForProperty("OSProfileComputerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).OSProfileComputerName, global::System.Convert.ToString); + } + if (content.Contains("WindowConfigurationPatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).WindowConfigurationPatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("WindowConfigurationPatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).WindowConfigurationPatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("LinuxConfigurationPatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LinuxConfigurationPatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("LinuxConfigurationPatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LinuxConfigurationPatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("ExtensionServiceStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ExtensionServiceStatus = (string) content.GetValueForProperty("ExtensionServiceStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ExtensionServiceStatus, global::System.Convert.ToString); + } + if (content.Contains("ExtensionServiceStartupType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ExtensionServiceStartupType = (string) content.GetValueForProperty("ExtensionServiceStartupType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).ExtensionServiceStartupType, global::System.Convert.ToString); + } + if (content.Contains("GuestConfigurationServiceStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).GuestConfigurationServiceStatus = (string) content.GetValueForProperty("GuestConfigurationServiceStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).GuestConfigurationServiceStatus, global::System.Convert.ToString); + } + if (content.Contains("GuestConfigurationServiceStartupType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).GuestConfigurationServiceStartupType = (string) content.GetValueForProperty("GuestConfigurationServiceStartupType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).GuestConfigurationServiceStartupType, global::System.Convert.ToString); + } + if (content.Contains("WindowsConfigurationPatchSettingsAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).WindowsConfigurationPatchSettingsAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("WindowsConfigurationPatchSettingsAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).WindowsConfigurationPatchSettingsAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("WindowsConfigurationPatchSettingsPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).WindowsConfigurationPatchSettingsPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("WindowsConfigurationPatchSettingsPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).WindowsConfigurationPatchSettingsPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + if (content.Contains("LinuxConfigurationPatchSettingsAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LinuxConfigurationPatchSettingsAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("LinuxConfigurationPatchSettingsAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LinuxConfigurationPatchSettingsAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("LinuxConfigurationPatchSettingsPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LinuxConfigurationPatchSettingsPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("LinuxConfigurationPatchSettingsPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal)this).LinuxConfigurationPatchSettingsPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes a hybrid machine. + [System.ComponentModel.TypeConverter(typeof(MachineTypeConverter))] + public partial interface IMachine + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/Machine.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/Machine.TypeConverter.cs new file mode 100644 index 000000000000..34cda9b94ecc --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/Machine.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MachineTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Machine.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Machine.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Machine.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/Machine.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/Machine.cs new file mode 100644 index 000000000000..d485f9c268f8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/Machine.cs @@ -0,0 +1,1141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes a hybrid machine. + public partial class Machine : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResource(); + + /// Specifies the AD fully qualified display name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AdFqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AdFqdn; } + + /// + /// Name of configuration mode to use. Modes are pre-defined configurations of security controls, extension allowlists and + /// guest configuration, maintained by Microsoft. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode? AgentConfigurationConfigMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationConfigMode; } + + /// Array of extensions that are allowed to be installed or updated. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] AgentConfigurationExtensionsAllowList { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationExtensionsAllowList; } + + /// Array of extensions that are blocked (cannot be installed or updated) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] AgentConfigurationExtensionsBlockList { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationExtensionsBlockList; } + + /// Specifies whether the extension service is enabled or disabled. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentConfigurationExtensionsEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationExtensionsEnabled; } + + /// Specified whether the guest configuration service is enabled or disabled. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentConfigurationGuestConfigurationEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationGuestConfigurationEnabled; } + + /// Specifies the list of ports that the agent will be able to listen on. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string[] AgentConfigurationIncomingConnectionsPort { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationIncomingConnectionsPort; } + + /// List of service names which should not use the specified proxy server. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string[] AgentConfigurationProxyBypass { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationProxyBypass; } + + /// Specifies the URL of the proxy to be used. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentConfigurationProxyUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationProxyUrl; } + + /// The correlation ID passed in from RSM per upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentUpgradeCorrelationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentUpgradeCorrelationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentUpgradeCorrelationId = value ?? null; } + + /// Specifies the version info w.r.t AgentUpgrade for the machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentUpgradeDesiredVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentUpgradeDesiredVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentUpgradeDesiredVersion = value ?? null; } + + /// Specifies if RSM should try to upgrade this machine + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? AgentUpgradeEnableAutomaticUpgrade { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentUpgradeEnableAutomaticUpgrade; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentUpgradeEnableAutomaticUpgrade = value ?? default(bool); } + + /// Specifies the version of the last attempt + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentUpgradeLastAttemptDesiredVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentUpgradeLastAttemptDesiredVersion; } + + /// Failure message of last upgrade attempt if any. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentUpgradeLastAttemptMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentUpgradeLastAttemptMessage; } + + /// Specifies the status of Agent Upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum? AgentUpgradeLastAttemptStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentUpgradeLastAttemptStatus; } + + /// Timestamp of last upgrade attempt + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentUpgradeLastAttemptTimestamp { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentUpgradeLastAttemptTimestamp; } + + /// The hybrid machine agent full version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentVersion; } + + /// + /// Public Key that the client provides to be used during initial resource onboarding + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ClientPublicKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).ClientPublicKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).ClientPublicKey = value ?? null; } + + /// Specifies the cloud provider (Azure/AWS/GCP...). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string CloudMetadataProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).CloudMetadataProvider; } + + /// Detected properties from the machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties DetectedProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).DetectedProperty; } + + /// Specifies the hybrid machine display name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).DisplayName; } + + /// Specifies the DNS fully qualified display name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string DnsFqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).DnsFqdn; } + + /// Specifies the Windows domain name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string DomainName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).DomainName; } + + /// Details about the error state. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] ErrorDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).ErrorDetail; } + + /// Machine Extensions information (deprecated field) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView[] Extension { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).Extension; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).Extension = value ?? null /* arrayOf */; } + + /// The behavior of the service when the Arc-enabled machine starts up. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ExtensionServiceStartupType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).ExtensionServiceStartupType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).ExtensionServiceStartupType = value ?? null; } + + /// The current status of the service. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ExtensionServiceStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).ExtensionServiceStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).ExtensionServiceStatus = value ?? null; } + + /// Specifies the hybrid machine FQDN. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string Fqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).MachineFqdn; } + + /// The behavior of the service when the Arc-enabled machine starts up. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string GuestConfigurationServiceStartupType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).GuestConfigurationServiceStartupType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).GuestConfigurationServiceStartupType = value ?? null; } + + /// The current status of the service. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string GuestConfigurationServiceStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).GuestConfigurationServiceStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).GuestConfigurationServiceStatus = value ?? null; } + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity _identity; + + /// Identity for the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity Identity { get => (this._identity = this._identity ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Identity()); set => this._identity = value; } + + /// The principal ID of resource identity. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentityPrincipalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).PrincipalId; } + + /// The tenant ID of resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).TenantId; } + + /// The identity type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).Type = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType)""); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind? _kind; + + /// + /// Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind? Kind { get => this._kind; set => this._kind = value; } + + /// The time of the last status change. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public global::System.DateTime? LastStatusChange { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).LastStatusChange; } + + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? LinuxConfigurationPatchSettingsAssessmentMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).LinuxConfigurationPatchSettingsAssessmentMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).LinuxConfigurationPatchSettingsAssessmentMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes)""); } + + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? LinuxConfigurationPatchSettingsPatchMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).LinuxConfigurationPatchSettingsPatchMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).LinuxConfigurationPatchSettingsPatchMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes)""); } + + /// The geo-location where the resource lives + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Location = value ; } + + /// The city or locality where the resource is located. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string LocationDataCity { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).LocationDataCity; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).LocationDataCity = value ?? null; } + + /// The country or region where the resource is located + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string LocationDataCountryOrRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).LocationDataCountryOrRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).LocationDataCountryOrRegion = value ?? null; } + + /// The district, state, or province where the resource is located. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string LocationDataDistrict { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).LocationDataDistrict; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).LocationDataDistrict = value ?? null; } + + /// A canonical name for the geographic or physical location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string LocationDataName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).LocationDataName; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).LocationDataName = value ?? null; } + + /// Internal Acessors for AdFqdn + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.AdFqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AdFqdn; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AdFqdn = value; } + + /// Internal Acessors for AgentConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.AgentConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfiguration; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfiguration = value; } + + /// Internal Acessors for AgentConfigurationConfigMode + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.AgentConfigurationConfigMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationConfigMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationConfigMode = value; } + + /// Internal Acessors for AgentConfigurationExtensionsAllowList + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.AgentConfigurationExtensionsAllowList { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationExtensionsAllowList; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationExtensionsAllowList = value; } + + /// Internal Acessors for AgentConfigurationExtensionsBlockList + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.AgentConfigurationExtensionsBlockList { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationExtensionsBlockList; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationExtensionsBlockList = value; } + + /// Internal Acessors for AgentConfigurationExtensionsEnabled + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.AgentConfigurationExtensionsEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationExtensionsEnabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationExtensionsEnabled = value; } + + /// Internal Acessors for AgentConfigurationGuestConfigurationEnabled + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.AgentConfigurationGuestConfigurationEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationGuestConfigurationEnabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationGuestConfigurationEnabled = value; } + + /// Internal Acessors for AgentConfigurationIncomingConnectionsPort + string[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.AgentConfigurationIncomingConnectionsPort { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationIncomingConnectionsPort; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationIncomingConnectionsPort = value; } + + /// Internal Acessors for AgentConfigurationProxyBypass + string[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.AgentConfigurationProxyBypass { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationProxyBypass; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationProxyBypass = value; } + + /// Internal Acessors for AgentConfigurationProxyUrl + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.AgentConfigurationProxyUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationProxyUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentConfigurationProxyUrl = value; } + + /// Internal Acessors for AgentUpgrade + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.AgentUpgrade { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentUpgrade; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentUpgrade = value; } + + /// Internal Acessors for AgentUpgradeLastAttemptDesiredVersion + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.AgentUpgradeLastAttemptDesiredVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentUpgradeLastAttemptDesiredVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentUpgradeLastAttemptDesiredVersion = value; } + + /// Internal Acessors for AgentUpgradeLastAttemptMessage + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.AgentUpgradeLastAttemptMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentUpgradeLastAttemptMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentUpgradeLastAttemptMessage = value; } + + /// Internal Acessors for AgentUpgradeLastAttemptStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.AgentUpgradeLastAttemptStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentUpgradeLastAttemptStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentUpgradeLastAttemptStatus = value; } + + /// Internal Acessors for AgentUpgradeLastAttemptTimestamp + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.AgentUpgradeLastAttemptTimestamp { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentUpgradeLastAttemptTimestamp; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentUpgradeLastAttemptTimestamp = value; } + + /// Internal Acessors for AgentVersion + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.AgentVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).AgentVersion = value; } + + /// Internal Acessors for CloudMetadata + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.CloudMetadata { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).CloudMetadata; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).CloudMetadata = value; } + + /// Internal Acessors for CloudMetadataProvider + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.CloudMetadataProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).CloudMetadataProvider; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).CloudMetadataProvider = value; } + + /// Internal Acessors for DetectedProperty + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.DetectedProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).DetectedProperty; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).DetectedProperty = value; } + + /// Internal Acessors for DisplayName + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).DisplayName; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).DisplayName = value; } + + /// Internal Acessors for DnsFqdn + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.DnsFqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).DnsFqdn; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).DnsFqdn = value; } + + /// Internal Acessors for DomainName + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.DomainName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).DomainName; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).DomainName = value; } + + /// Internal Acessors for ErrorDetail + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.ErrorDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).ErrorDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).ErrorDetail = value; } + + /// Internal Acessors for Fqdn + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.Fqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).MachineFqdn; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).MachineFqdn = value; } + + /// Internal Acessors for Identity + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.Identity { get => (this._identity = this._identity ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Identity()); set { {_identity = value;} } } + + /// Internal Acessors for IdentityPrincipalId + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.IdentityPrincipalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).PrincipalId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).PrincipalId = value; } + + /// Internal Acessors for IdentityTenantId + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.IdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).TenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).TenantId = value; } + + /// Internal Acessors for LastStatusChange + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.LastStatusChange { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).LastStatusChange; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).LastStatusChange = value; } + + /// Internal Acessors for LinuxConfigurationPatchSetting + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.LinuxConfigurationPatchSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).LinuxConfigurationPatchSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).LinuxConfigurationPatchSetting = value; } + + /// Internal Acessors for LocationData + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.LocationData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).LocationData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).LocationData = value; } + + /// Internal Acessors for NetworkProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfile Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.NetworkProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).NetworkProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).NetworkProfile = value; } + + /// Internal Acessors for OSName + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.OSName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).OSName; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).OSName = value; } + + /// Internal Acessors for OSProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.OSProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).OSProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).OSProfile = value; } + + /// Internal Acessors for OSProfileComputerName + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.OSProfileComputerName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).OSProfileComputerName; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).OSProfileComputerName = value; } + + /// Internal Acessors for OSProfileLinuxConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.OSProfileLinuxConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).OSProfileLinuxConfiguration; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).OSProfileLinuxConfiguration = value; } + + /// Internal Acessors for OSProfileWindowsConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.OSProfileWindowsConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).OSProfileWindowsConfiguration; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).OSProfileWindowsConfiguration = value; } + + /// Internal Acessors for OSSku + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.OSSku { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).OSSku; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).OSSku = value; } + + /// Internal Acessors for OSVersion + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.OSVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).OSVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).OSVersion = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for Resource + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.Resource { get => this._resource; set { {_resource = value;} } } + + /// Internal Acessors for ServiceStatuses + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatuses Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.ServiceStatuses { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).ServiceStatuses; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).ServiceStatuses = value; } + + /// Internal Acessors for ServiceStatusesExtensionService + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.ServiceStatusesExtensionService { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).ServiceStatusesExtensionService; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).ServiceStatusesExtensionService = value; } + + /// Internal Acessors for ServiceStatusesGuestConfigurationService + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.ServiceStatusesGuestConfigurationService { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).ServiceStatusesGuestConfigurationService; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).ServiceStatusesGuestConfigurationService = value; } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.Status { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).Status = value; } + + /// Internal Acessors for VMUuid + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.VMUuid { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).VMUuid; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).VMUuid = value; } + + /// Internal Acessors for WindowConfigurationPatchSetting + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineInternal.WindowConfigurationPatchSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).WindowConfigurationPatchSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).WindowConfigurationPatchSetting = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type = value; } + + /// Specifies whether any MS SQL instance is discovered on the machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string MssqlDiscovered { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).MssqlDiscovered; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).MssqlDiscovered = value ?? null; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name; } + + /// The list of network interfaces. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface[] NetworkProfileNetworkInterface { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).NetworkProfileNetworkInterface; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).NetworkProfileNetworkInterface = value ?? null /* arrayOf */; } + + /// The Operating System running on the hybrid machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string OSName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).OSName; } + + /// Specifies the host OS name of the hybrid machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string OSProfileComputerName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).OSProfileComputerName; } + + /// Specifies the Operating System product SKU. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string OSSku { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).OSSku; } + + /// The type of Operating System (windows/linux). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string OSType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).OSType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).OSType = value ?? null; } + + /// The version of Operating System running on the hybrid machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string OSVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).OSVersion; } + + /// + /// The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ParentClusterResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).ParentClusterResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).ParentClusterResourceId = value ?? null; } + + /// The resource id of the private link scope this machine is assigned to, if any. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string PrivateLinkScopeResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).PrivateLinkScopeResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).PrivateLinkScopeResourceId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineProperties _property; + + /// Hybrid Compute Machine properties + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineProperties()); set => this._property = value; } + + /// The provisioning state, which only appears in the response. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).ProvisioningState; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension[] _resource; + + /// The list of extensions affiliated to the machine + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension[] Resource { get => this._resource; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// The status of the hybrid machine agent. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes? Status { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).Status; } + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData; } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Tag = value ?? null /* model class */; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type; } + + /// Specifies the hybrid machine unique ID. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string VMId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).VMId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).VMId = value ?? null; } + + /// Specifies the Arc Machine's unique SMBIOS ID + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string VMUuid { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).VMUuid; } + + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? WindowsConfigurationPatchSettingsAssessmentMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).WindowsConfigurationPatchSettingsAssessmentMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).WindowsConfigurationPatchSettingsAssessmentMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes)""); } + + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? WindowsConfigurationPatchSettingsPatchMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).WindowsConfigurationPatchSettingsPatchMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)Property).WindowsConfigurationPatchSettingsPatchMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes)""); } + + /// Creates an new instance. + public Machine() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__trackedResource), __trackedResource); + await eventListener.AssertObjectIsValid(nameof(__trackedResource), __trackedResource); + } + } + /// Describes a hybrid machine. + public partial interface IMachine : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource + { + /// Specifies the AD fully qualified display name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the AD fully qualified display name.", + SerializedName = @"adFqdn", + PossibleTypes = new [] { typeof(string) })] + string AdFqdn { get; } + /// + /// Name of configuration mode to use. Modes are pre-defined configurations of security controls, extension allowlists and + /// guest configuration, maintained by Microsoft. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Name of configuration mode to use. Modes are pre-defined configurations of security controls, extension allowlists and guest configuration, maintained by Microsoft.", + SerializedName = @"configMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode? AgentConfigurationConfigMode { get; } + /// Array of extensions that are allowed to be installed or updated. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Array of extensions that are allowed to be installed or updated.", + SerializedName = @"extensionsAllowList", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] AgentConfigurationExtensionsAllowList { get; } + /// Array of extensions that are blocked (cannot be installed or updated) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Array of extensions that are blocked (cannot be installed or updated)", + SerializedName = @"extensionsBlockList", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] AgentConfigurationExtensionsBlockList { get; } + /// Specifies whether the extension service is enabled or disabled. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies whether the extension service is enabled or disabled.", + SerializedName = @"extensionsEnabled", + PossibleTypes = new [] { typeof(string) })] + string AgentConfigurationExtensionsEnabled { get; } + /// Specified whether the guest configuration service is enabled or disabled. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specified whether the guest configuration service is enabled or disabled.", + SerializedName = @"guestConfigurationEnabled", + PossibleTypes = new [] { typeof(string) })] + string AgentConfigurationGuestConfigurationEnabled { get; } + /// Specifies the list of ports that the agent will be able to listen on. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the list of ports that the agent will be able to listen on.", + SerializedName = @"incomingConnectionsPorts", + PossibleTypes = new [] { typeof(string) })] + string[] AgentConfigurationIncomingConnectionsPort { get; } + /// List of service names which should not use the specified proxy server. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"List of service names which should not use the specified proxy server.", + SerializedName = @"proxyBypass", + PossibleTypes = new [] { typeof(string) })] + string[] AgentConfigurationProxyBypass { get; } + /// Specifies the URL of the proxy to be used. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the URL of the proxy to be used.", + SerializedName = @"proxyUrl", + PossibleTypes = new [] { typeof(string) })] + string AgentConfigurationProxyUrl { get; } + /// The correlation ID passed in from RSM per upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The correlation ID passed in from RSM per upgrade.", + SerializedName = @"correlationId", + PossibleTypes = new [] { typeof(string) })] + string AgentUpgradeCorrelationId { get; set; } + /// Specifies the version info w.r.t AgentUpgrade for the machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the version info w.r.t AgentUpgrade for the machine.", + SerializedName = @"desiredVersion", + PossibleTypes = new [] { typeof(string) })] + string AgentUpgradeDesiredVersion { get; set; } + /// Specifies if RSM should try to upgrade this machine + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies if RSM should try to upgrade this machine", + SerializedName = @"enableAutomaticUpgrade", + PossibleTypes = new [] { typeof(bool) })] + bool? AgentUpgradeEnableAutomaticUpgrade { get; set; } + /// Specifies the version of the last attempt + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the version of the last attempt", + SerializedName = @"lastAttemptDesiredVersion", + PossibleTypes = new [] { typeof(string) })] + string AgentUpgradeLastAttemptDesiredVersion { get; } + /// Failure message of last upgrade attempt if any. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Failure message of last upgrade attempt if any.", + SerializedName = @"lastAttemptMessage", + PossibleTypes = new [] { typeof(string) })] + string AgentUpgradeLastAttemptMessage { get; } + /// Specifies the status of Agent Upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the status of Agent Upgrade.", + SerializedName = @"lastAttemptStatus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum? AgentUpgradeLastAttemptStatus { get; } + /// Timestamp of last upgrade attempt + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Timestamp of last upgrade attempt", + SerializedName = @"lastAttemptTimestamp", + PossibleTypes = new [] { typeof(string) })] + string AgentUpgradeLastAttemptTimestamp { get; } + /// The hybrid machine agent full version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The hybrid machine agent full version.", + SerializedName = @"agentVersion", + PossibleTypes = new [] { typeof(string) })] + string AgentVersion { get; } + /// + /// Public Key that the client provides to be used during initial resource onboarding + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Public Key that the client provides to be used during initial resource onboarding", + SerializedName = @"clientPublicKey", + PossibleTypes = new [] { typeof(string) })] + string ClientPublicKey { get; set; } + /// Specifies the cloud provider (Azure/AWS/GCP...). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the cloud provider (Azure/AWS/GCP...).", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string CloudMetadataProvider { get; } + /// Detected properties from the machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Detected properties from the machine.", + SerializedName = @"detectedProperties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties DetectedProperty { get; } + /// Specifies the hybrid machine display name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the hybrid machine display name.", + SerializedName = @"displayName", + PossibleTypes = new [] { typeof(string) })] + string DisplayName { get; } + /// Specifies the DNS fully qualified display name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the DNS fully qualified display name.", + SerializedName = @"dnsFqdn", + PossibleTypes = new [] { typeof(string) })] + string DnsFqdn { get; } + /// Specifies the Windows domain name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the Windows domain name.", + SerializedName = @"domainName", + PossibleTypes = new [] { typeof(string) })] + string DomainName { get; } + /// Details about the error state. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Details about the error state.", + SerializedName = @"errorDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] ErrorDetail { get; } + /// Machine Extensions information (deprecated field) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Machine Extensions information (deprecated field)", + SerializedName = @"extensions", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView[] Extension { get; set; } + /// The behavior of the service when the Arc-enabled machine starts up. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The behavior of the service when the Arc-enabled machine starts up.", + SerializedName = @"startupType", + PossibleTypes = new [] { typeof(string) })] + string ExtensionServiceStartupType { get; set; } + /// The current status of the service. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The current status of the service.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + string ExtensionServiceStatus { get; set; } + /// Specifies the hybrid machine FQDN. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the hybrid machine FQDN.", + SerializedName = @"machineFqdn", + PossibleTypes = new [] { typeof(string) })] + string Fqdn { get; } + /// The behavior of the service when the Arc-enabled machine starts up. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The behavior of the service when the Arc-enabled machine starts up.", + SerializedName = @"startupType", + PossibleTypes = new [] { typeof(string) })] + string GuestConfigurationServiceStartupType { get; set; } + /// The current status of the service. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The current status of the service.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + string GuestConfigurationServiceStatus { get; set; } + /// The principal ID of resource identity. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The principal ID of resource identity.", + SerializedName = @"principalId", + PossibleTypes = new [] { typeof(string) })] + string IdentityPrincipalId { get; } + /// The tenant ID of resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The tenant ID of resource.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string IdentityTenantId { get; } + /// The identity type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identity type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get; set; } + /// + /// Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc.", + SerializedName = @"kind", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind? Kind { get; set; } + /// The time of the last status change. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The time of the last status change.", + SerializedName = @"lastStatusChange", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastStatusChange { get; } + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the assessment mode.", + SerializedName = @"assessmentMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? LinuxConfigurationPatchSettingsAssessmentMode { get; set; } + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the patch mode.", + SerializedName = @"patchMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? LinuxConfigurationPatchSettingsPatchMode { get; set; } + /// The city or locality where the resource is located. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The city or locality where the resource is located.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string LocationDataCity { get; set; } + /// The country or region where the resource is located + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The country or region where the resource is located", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + string LocationDataCountryOrRegion { get; set; } + /// The district, state, or province where the resource is located. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The district, state, or province where the resource is located.", + SerializedName = @"district", + PossibleTypes = new [] { typeof(string) })] + string LocationDataDistrict { get; set; } + /// A canonical name for the geographic or physical location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A canonical name for the geographic or physical location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string LocationDataName { get; set; } + /// Specifies whether any MS SQL instance is discovered on the machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies whether any MS SQL instance is discovered on the machine.", + SerializedName = @"mssqlDiscovered", + PossibleTypes = new [] { typeof(string) })] + string MssqlDiscovered { get; set; } + /// The list of network interfaces. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of network interfaces.", + SerializedName = @"networkInterfaces", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface[] NetworkProfileNetworkInterface { get; set; } + /// The Operating System running on the hybrid machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Operating System running on the hybrid machine.", + SerializedName = @"osName", + PossibleTypes = new [] { typeof(string) })] + string OSName { get; } + /// Specifies the host OS name of the hybrid machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the host OS name of the hybrid machine.", + SerializedName = @"computerName", + PossibleTypes = new [] { typeof(string) })] + string OSProfileComputerName { get; } + /// Specifies the Operating System product SKU. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the Operating System product SKU.", + SerializedName = @"osSku", + PossibleTypes = new [] { typeof(string) })] + string OSSku { get; } + /// The type of Operating System (windows/linux). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of Operating System (windows/linux).", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; set; } + /// The version of Operating System running on the hybrid machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The version of Operating System running on the hybrid machine.", + SerializedName = @"osVersion", + PossibleTypes = new [] { typeof(string) })] + string OSVersion { get; } + /// + /// The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any.", + SerializedName = @"parentClusterResourceId", + PossibleTypes = new [] { typeof(string) })] + string ParentClusterResourceId { get; set; } + /// The resource id of the private link scope this machine is assigned to, if any. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource id of the private link scope this machine is assigned to, if any.", + SerializedName = @"privateLinkScopeResourceId", + PossibleTypes = new [] { typeof(string) })] + string PrivateLinkScopeResourceId { get; set; } + /// The provisioning state, which only appears in the response. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The provisioning state, which only appears in the response.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningState { get; } + /// The list of extensions affiliated to the machine + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of extensions affiliated to the machine", + SerializedName = @"resources", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension[] Resource { get; } + /// The status of the hybrid machine agent. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The status of the hybrid machine agent.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes? Status { get; } + /// Specifies the hybrid machine unique ID. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the hybrid machine unique ID.", + SerializedName = @"vmId", + PossibleTypes = new [] { typeof(string) })] + string VMId { get; set; } + /// Specifies the Arc Machine's unique SMBIOS ID + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the Arc Machine's unique SMBIOS ID", + SerializedName = @"vmUuid", + PossibleTypes = new [] { typeof(string) })] + string VMUuid { get; } + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the assessment mode.", + SerializedName = @"assessmentMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? WindowsConfigurationPatchSettingsAssessmentMode { get; set; } + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the patch mode.", + SerializedName = @"patchMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? WindowsConfigurationPatchSettingsPatchMode { get; set; } + + } + /// Describes a hybrid machine. + internal partial interface IMachineInternal : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal + { + /// Specifies the AD fully qualified display name. + string AdFqdn { get; set; } + /// + /// Configurable properties that the user can set locally via the azcmagent config command, or remotely via ARM. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfiguration AgentConfiguration { get; set; } + /// + /// Name of configuration mode to use. Modes are pre-defined configurations of security controls, extension allowlists and + /// guest configuration, maintained by Microsoft. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode? AgentConfigurationConfigMode { get; set; } + /// Array of extensions that are allowed to be installed or updated. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] AgentConfigurationExtensionsAllowList { get; set; } + /// Array of extensions that are blocked (cannot be installed or updated) + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] AgentConfigurationExtensionsBlockList { get; set; } + /// Specifies whether the extension service is enabled or disabled. + string AgentConfigurationExtensionsEnabled { get; set; } + /// Specified whether the guest configuration service is enabled or disabled. + string AgentConfigurationGuestConfigurationEnabled { get; set; } + /// Specifies the list of ports that the agent will be able to listen on. + string[] AgentConfigurationIncomingConnectionsPort { get; set; } + /// List of service names which should not use the specified proxy server. + string[] AgentConfigurationProxyBypass { get; set; } + /// Specifies the URL of the proxy to be used. + string AgentConfigurationProxyUrl { get; set; } + /// The info of the machine w.r.t Agent Upgrade + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade AgentUpgrade { get; set; } + /// The correlation ID passed in from RSM per upgrade. + string AgentUpgradeCorrelationId { get; set; } + /// Specifies the version info w.r.t AgentUpgrade for the machine. + string AgentUpgradeDesiredVersion { get; set; } + /// Specifies if RSM should try to upgrade this machine + bool? AgentUpgradeEnableAutomaticUpgrade { get; set; } + /// Specifies the version of the last attempt + string AgentUpgradeLastAttemptDesiredVersion { get; set; } + /// Failure message of last upgrade attempt if any. + string AgentUpgradeLastAttemptMessage { get; set; } + /// Specifies the status of Agent Upgrade. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum? AgentUpgradeLastAttemptStatus { get; set; } + /// Timestamp of last upgrade attempt + string AgentUpgradeLastAttemptTimestamp { get; set; } + /// The hybrid machine agent full version. + string AgentVersion { get; set; } + /// + /// Public Key that the client provides to be used during initial resource onboarding + /// + string ClientPublicKey { get; set; } + /// The metadata of the cloud environment (Azure/GCP/AWS/OCI...). + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata CloudMetadata { get; set; } + /// Specifies the cloud provider (Azure/AWS/GCP...). + string CloudMetadataProvider { get; set; } + /// Detected properties from the machine. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties DetectedProperty { get; set; } + /// Specifies the hybrid machine display name. + string DisplayName { get; set; } + /// Specifies the DNS fully qualified display name. + string DnsFqdn { get; set; } + /// Specifies the Windows domain name. + string DomainName { get; set; } + /// Details about the error state. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] ErrorDetail { get; set; } + /// Machine Extensions information (deprecated field) + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView[] Extension { get; set; } + /// The behavior of the service when the Arc-enabled machine starts up. + string ExtensionServiceStartupType { get; set; } + /// The current status of the service. + string ExtensionServiceStatus { get; set; } + /// Specifies the hybrid machine FQDN. + string Fqdn { get; set; } + /// The behavior of the service when the Arc-enabled machine starts up. + string GuestConfigurationServiceStartupType { get; set; } + /// The current status of the service. + string GuestConfigurationServiceStatus { get; set; } + /// Identity for the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity Identity { get; set; } + /// The principal ID of resource identity. + string IdentityPrincipalId { get; set; } + /// The tenant ID of resource. + string IdentityTenantId { get; set; } + /// The identity type. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get; set; } + /// + /// Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind? Kind { get; set; } + /// The time of the last status change. + global::System.DateTime? LastStatusChange { get; set; } + /// Specifies the patch settings. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings LinuxConfigurationPatchSetting { get; set; } + /// Specifies the assessment mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? LinuxConfigurationPatchSettingsAssessmentMode { get; set; } + /// Specifies the patch mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? LinuxConfigurationPatchSettingsPatchMode { get; set; } + /// Metadata pertaining to the geographic location of the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData LocationData { get; set; } + /// The city or locality where the resource is located. + string LocationDataCity { get; set; } + /// The country or region where the resource is located + string LocationDataCountryOrRegion { get; set; } + /// The district, state, or province where the resource is located. + string LocationDataDistrict { get; set; } + /// A canonical name for the geographic or physical location. + string LocationDataName { get; set; } + /// Specifies whether any MS SQL instance is discovered on the machine. + string MssqlDiscovered { get; set; } + /// Information about the network the machine is on. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfile NetworkProfile { get; set; } + /// The list of network interfaces. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface[] NetworkProfileNetworkInterface { get; set; } + /// The Operating System running on the hybrid machine. + string OSName { get; set; } + /// Specifies the operating system settings for the hybrid machine. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile OSProfile { get; set; } + /// Specifies the host OS name of the hybrid machine. + string OSProfileComputerName { get; set; } + /// Specifies the linux configuration for update management. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration OSProfileLinuxConfiguration { get; set; } + /// Specifies the windows configuration for update management. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration OSProfileWindowsConfiguration { get; set; } + /// Specifies the Operating System product SKU. + string OSSku { get; set; } + /// The type of Operating System (windows/linux). + string OSType { get; set; } + /// The version of Operating System running on the hybrid machine. + string OSVersion { get; set; } + /// + /// The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + /// + string ParentClusterResourceId { get; set; } + /// The resource id of the private link scope this machine is assigned to, if any. + string PrivateLinkScopeResourceId { get; set; } + /// Hybrid Compute Machine properties + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineProperties Property { get; set; } + /// The provisioning state, which only appears in the response. + string ProvisioningState { get; set; } + /// The list of extensions affiliated to the machine + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension[] Resource { get; set; } + /// Statuses of dependent services that are reported back to ARM. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatuses ServiceStatuses { get; set; } + /// The state of the extension service on the Arc-enabled machine. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus ServiceStatusesExtensionService { get; set; } + /// The state of the guest configuration service on the Arc-enabled machine. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus ServiceStatusesGuestConfigurationService { get; set; } + /// The status of the hybrid machine agent. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes? Status { get; set; } + /// Specifies the hybrid machine unique ID. + string VMId { get; set; } + /// Specifies the Arc Machine's unique SMBIOS ID + string VMUuid { get; set; } + /// Specifies the patch settings. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings WindowConfigurationPatchSetting { get; set; } + /// Specifies the assessment mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? WindowsConfigurationPatchSettingsAssessmentMode { get; set; } + /// Specifies the patch mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? WindowsConfigurationPatchSettingsPatchMode { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/Machine.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/Machine.json.cs new file mode 100644 index 000000000000..03eb5454a397 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/Machine.json.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes a hybrid machine. + public partial class Machine + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new Machine(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal Machine(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineProperties.FromJson(__jsonProperties) : Property;} + {_identity = If( json?.PropertyT("identity"), out var __jsonIdentity) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Identity.FromJson(__jsonIdentity) : Identity;} + {_resource = If( json?.PropertyT("resources"), out var __jsonResources) ? If( __jsonResources as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtension.FromJson(__u) )) ))() : null : Resource;} + {_kind = If( json?.PropertyT("kind"), out var __jsonKind) ? (string)__jsonKind : (string)Kind;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __trackedResource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != this._identity ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._identity.ToJson(null,serializationMode) : null, "identity" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._resource) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._resource ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("resources",__w); + } + } + AddIf( null != (((object)this._kind)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._kind.ToString()) : null, "kind" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtension.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtension.PowerShell.cs new file mode 100644 index 000000000000..44069eb4f306 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtension.PowerShell.cs @@ -0,0 +1,392 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes a Machine Extension. + [System.ComponentModel.TypeConverter(typeof(MachineExtensionTypeConverter))] + public partial class MachineExtension + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MachineExtension(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MachineExtension(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MachineExtension(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("InstanceView")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).InstanceView = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView) content.GetValueForProperty("InstanceView",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).InstanceView, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceViewTypeConverter.ConvertFrom); + } + if (content.Contains("ForceUpdateTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).ForceUpdateTag = (string) content.GetValueForProperty("ForceUpdateTag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).ForceUpdateTag, global::System.Convert.ToString); + } + if (content.Contains("Publisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).Publisher = (string) content.GetValueForProperty("Publisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).Publisher, global::System.Convert.ToString); + } + if (content.Contains("PropertiesType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).PropertiesType = (string) content.GetValueForProperty("PropertiesType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).PropertiesType, global::System.Convert.ToString); + } + if (content.Contains("TypeHandlerVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).TypeHandlerVersion = (string) content.GetValueForProperty("TypeHandlerVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).TypeHandlerVersion, global::System.Convert.ToString); + } + if (content.Contains("EnableAutomaticUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).EnableAutomaticUpgrade = (bool?) content.GetValueForProperty("EnableAutomaticUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).EnableAutomaticUpgrade, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AutoUpgradeMinorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).AutoUpgradeMinorVersion = (bool?) content.GetValueForProperty("AutoUpgradeMinorVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).AutoUpgradeMinorVersion, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Setting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).Setting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings) content.GetValueForProperty("Setting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).Setting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionPropertiesSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("ProtectedSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).ProtectedSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings) content.GetValueForProperty("ProtectedSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).ProtectedSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionPropertiesProtectedSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("InstanceViewStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).InstanceViewStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus) content.GetValueForProperty("InstanceViewStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).InstanceViewStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceViewStatusTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceViewName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).InstanceViewName = (string) content.GetValueForProperty("InstanceViewName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).InstanceViewName, global::System.Convert.ToString); + } + if (content.Contains("InstanceViewType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).InstanceViewType = (string) content.GetValueForProperty("InstanceViewType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).InstanceViewType, global::System.Convert.ToString); + } + if (content.Contains("InstanceViewTypeHandlerVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).InstanceViewTypeHandlerVersion = (string) content.GetValueForProperty("InstanceViewTypeHandlerVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).InstanceViewTypeHandlerVersion, global::System.Convert.ToString); + } + if (content.Contains("StatusCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).StatusCode = (string) content.GetValueForProperty("StatusCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).StatusCode, global::System.Convert.ToString); + } + if (content.Contains("StatusLevel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).StatusLevel = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes?) content.GetValueForProperty("StatusLevel",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).StatusLevel, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes.CreateFrom); + } + if (content.Contains("StatusDisplayStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).StatusDisplayStatus = (string) content.GetValueForProperty("StatusDisplayStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).StatusDisplayStatus, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).StatusTime = (global::System.DateTime?) content.GetValueForProperty("StatusTime",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).StatusTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MachineExtension(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("InstanceView")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).InstanceView = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView) content.GetValueForProperty("InstanceView",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).InstanceView, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceViewTypeConverter.ConvertFrom); + } + if (content.Contains("ForceUpdateTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).ForceUpdateTag = (string) content.GetValueForProperty("ForceUpdateTag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).ForceUpdateTag, global::System.Convert.ToString); + } + if (content.Contains("Publisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).Publisher = (string) content.GetValueForProperty("Publisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).Publisher, global::System.Convert.ToString); + } + if (content.Contains("PropertiesType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).PropertiesType = (string) content.GetValueForProperty("PropertiesType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).PropertiesType, global::System.Convert.ToString); + } + if (content.Contains("TypeHandlerVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).TypeHandlerVersion = (string) content.GetValueForProperty("TypeHandlerVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).TypeHandlerVersion, global::System.Convert.ToString); + } + if (content.Contains("EnableAutomaticUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).EnableAutomaticUpgrade = (bool?) content.GetValueForProperty("EnableAutomaticUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).EnableAutomaticUpgrade, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AutoUpgradeMinorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).AutoUpgradeMinorVersion = (bool?) content.GetValueForProperty("AutoUpgradeMinorVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).AutoUpgradeMinorVersion, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Setting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).Setting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings) content.GetValueForProperty("Setting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).Setting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionPropertiesSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("ProtectedSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).ProtectedSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings) content.GetValueForProperty("ProtectedSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).ProtectedSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionPropertiesProtectedSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("InstanceViewStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).InstanceViewStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus) content.GetValueForProperty("InstanceViewStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).InstanceViewStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceViewStatusTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceViewName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).InstanceViewName = (string) content.GetValueForProperty("InstanceViewName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).InstanceViewName, global::System.Convert.ToString); + } + if (content.Contains("InstanceViewType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).InstanceViewType = (string) content.GetValueForProperty("InstanceViewType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).InstanceViewType, global::System.Convert.ToString); + } + if (content.Contains("InstanceViewTypeHandlerVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).InstanceViewTypeHandlerVersion = (string) content.GetValueForProperty("InstanceViewTypeHandlerVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).InstanceViewTypeHandlerVersion, global::System.Convert.ToString); + } + if (content.Contains("StatusCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).StatusCode = (string) content.GetValueForProperty("StatusCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).StatusCode, global::System.Convert.ToString); + } + if (content.Contains("StatusLevel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).StatusLevel = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes?) content.GetValueForProperty("StatusLevel",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).StatusLevel, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes.CreateFrom); + } + if (content.Contains("StatusDisplayStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).StatusDisplayStatus = (string) content.GetValueForProperty("StatusDisplayStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).StatusDisplayStatus, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).StatusTime = (global::System.DateTime?) content.GetValueForProperty("StatusTime",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal)this).StatusTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes a Machine Extension. + [System.ComponentModel.TypeConverter(typeof(MachineExtensionTypeConverter))] + public partial interface IMachineExtension + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtension.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtension.TypeConverter.cs new file mode 100644 index 000000000000..52142f28401a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtension.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MachineExtensionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MachineExtension.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MachineExtension.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MachineExtension.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtension.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtension.cs new file mode 100644 index 000000000000..f0b2964f4765 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtension.cs @@ -0,0 +1,413 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes a Machine Extension. + public partial class MachineExtension : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResource(); + + /// + /// Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, + /// however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? AutoUpgradeMinorVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).AutoUpgradeMinorVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).AutoUpgradeMinorVersion = value ?? default(bool); } + + /// + /// Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? EnableAutomaticUpgrade { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).EnableAutomaticUpgrade; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).EnableAutomaticUpgrade = value ?? default(bool); } + + /// + /// How the extension handler should be forced to update even if the extension configuration has not changed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ForceUpdateTag { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).ForceUpdateTag; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).ForceUpdateTag = value ?? null; } + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id; } + + /// The machine extension name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string InstanceViewName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).InstanceViewName; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).InstanceViewName = value ?? null; } + + /// Specifies the type of the extension; an example is "CustomScriptExtension". + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string InstanceViewType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).InstanceViewType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).InstanceViewType = value ?? null; } + + /// Specifies the version of the script handler. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string InstanceViewTypeHandlerVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).InstanceViewTypeHandlerVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).InstanceViewTypeHandlerVersion = value ?? null; } + + /// The geo-location where the resource lives + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Location = value ; } + + /// Internal Acessors for InstanceView + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal.InstanceView { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).InstanceView; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).InstanceView = value; } + + /// Internal Acessors for InstanceViewStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal.InstanceViewStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).InstanceViewStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).InstanceViewStatus = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name; } + + /// Specifies the type of the extension; an example is "CustomScriptExtension". + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string PropertiesType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).Type = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionProperties _property; + + /// Describes Machine Extension Properties. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionProperties()); set => this._property = value; } + + /// + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings ProtectedSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).ProtectedSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).ProtectedSetting = value ?? null /* model class */; } + + /// The provisioning state, which only appears in the response. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).ProvisioningState; } + + /// The name of the extension handler publisher. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string Publisher { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).Publisher; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).Publisher = value ?? null; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// Json formatted public settings for the extension. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings Setting { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).Setting; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).Setting = value ?? null /* model class */; } + + /// The status code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).StatusCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).StatusCode = value ?? null; } + + /// The short localizable label for the status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusDisplayStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).StatusDisplayStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).StatusDisplayStatus = value ?? null; } + + /// The level code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes? StatusLevel { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).StatusLevel; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).StatusLevel = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes)""); } + + /// The detailed status message, including for alerts and error messages. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).StatusMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).StatusMessage = value ?? null; } + + /// The time of the status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public global::System.DateTime? StatusTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).StatusTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).StatusTime = value ?? default(global::System.DateTime); } + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData; } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Tag = value ?? null /* model class */; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type; } + + /// Specifies the version of the script handler. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string TypeHandlerVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).TypeHandlerVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)Property).TypeHandlerVersion = value ?? null; } + + /// Creates an new instance. + public MachineExtension() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__trackedResource), __trackedResource); + await eventListener.AssertObjectIsValid(nameof(__trackedResource), __trackedResource); + } + } + /// Describes a Machine Extension. + public partial interface IMachineExtension : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource + { + /// + /// Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, + /// however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true.", + SerializedName = @"autoUpgradeMinorVersion", + PossibleTypes = new [] { typeof(bool) })] + bool? AutoUpgradeMinorVersion { get; set; } + /// + /// Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available.", + SerializedName = @"enableAutomaticUpgrade", + PossibleTypes = new [] { typeof(bool) })] + bool? EnableAutomaticUpgrade { get; set; } + /// + /// How the extension handler should be forced to update even if the extension configuration has not changed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"How the extension handler should be forced to update even if the extension configuration has not changed.", + SerializedName = @"forceUpdateTag", + PossibleTypes = new [] { typeof(string) })] + string ForceUpdateTag { get; set; } + /// The machine extension name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The machine extension name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string InstanceViewName { get; set; } + /// Specifies the type of the extension; an example is "CustomScriptExtension". + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the type of the extension; an example is ""CustomScriptExtension"".", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string InstanceViewType { get; set; } + /// Specifies the version of the script handler. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the version of the script handler.", + SerializedName = @"typeHandlerVersion", + PossibleTypes = new [] { typeof(string) })] + string InstanceViewTypeHandlerVersion { get; set; } + /// Specifies the type of the extension; an example is "CustomScriptExtension". + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the type of the extension; an example is ""CustomScriptExtension"".", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string PropertiesType { get; set; } + /// + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.", + SerializedName = @"protectedSettings", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings ProtectedSetting { get; set; } + /// The provisioning state, which only appears in the response. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The provisioning state, which only appears in the response.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningState { get; } + /// The name of the extension handler publisher. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extension handler publisher.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + string Publisher { get; set; } + /// Json formatted public settings for the extension. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Json formatted public settings for the extension.", + SerializedName = @"settings", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings Setting { get; set; } + /// The status code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string StatusCode { get; set; } + /// The short localizable label for the status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The short localizable label for the status.", + SerializedName = @"displayStatus", + PossibleTypes = new [] { typeof(string) })] + string StatusDisplayStatus { get; set; } + /// The level code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The level code.", + SerializedName = @"level", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes? StatusLevel { get; set; } + /// The detailed status message, including for alerts and error messages. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The detailed status message, including for alerts and error messages.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string StatusMessage { get; set; } + /// The time of the status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The time of the status.", + SerializedName = @"time", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StatusTime { get; set; } + /// Specifies the version of the script handler. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the version of the script handler.", + SerializedName = @"typeHandlerVersion", + PossibleTypes = new [] { typeof(string) })] + string TypeHandlerVersion { get; set; } + + } + /// Describes a Machine Extension. + internal partial interface IMachineExtensionInternal : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal + { + /// + /// Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, + /// however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + /// + bool? AutoUpgradeMinorVersion { get; set; } + /// + /// Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + /// + bool? EnableAutomaticUpgrade { get; set; } + /// + /// How the extension handler should be forced to update even if the extension configuration has not changed. + /// + string ForceUpdateTag { get; set; } + /// The machine extension instance view. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView InstanceView { get; set; } + /// The machine extension name. + string InstanceViewName { get; set; } + /// Instance view status. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus InstanceViewStatus { get; set; } + /// Specifies the type of the extension; an example is "CustomScriptExtension". + string InstanceViewType { get; set; } + /// Specifies the version of the script handler. + string InstanceViewTypeHandlerVersion { get; set; } + /// Specifies the type of the extension; an example is "CustomScriptExtension". + string PropertiesType { get; set; } + /// Describes Machine Extension Properties. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionProperties Property { get; set; } + /// + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings ProtectedSetting { get; set; } + /// The provisioning state, which only appears in the response. + string ProvisioningState { get; set; } + /// The name of the extension handler publisher. + string Publisher { get; set; } + /// Json formatted public settings for the extension. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings Setting { get; set; } + /// The status code. + string StatusCode { get; set; } + /// The short localizable label for the status. + string StatusDisplayStatus { get; set; } + /// The level code. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes? StatusLevel { get; set; } + /// The detailed status message, including for alerts and error messages. + string StatusMessage { get; set; } + /// The time of the status. + global::System.DateTime? StatusTime { get; set; } + /// Specifies the version of the script handler. + string TypeHandlerVersion { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtension.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtension.json.cs new file mode 100644 index 000000000000..3c5d314ca2a1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtension.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes a Machine Extension. + public partial class MachineExtension + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MachineExtension(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal MachineExtension(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __trackedResource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceView.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceView.PowerShell.cs new file mode 100644 index 000000000000..cc3f5ece6827 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceView.PowerShell.cs @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes the Machine Extension Instance View. + [System.ComponentModel.TypeConverter(typeof(MachineExtensionInstanceViewTypeConverter))] + public partial class MachineExtensionInstanceView + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MachineExtensionInstanceView(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MachineExtensionInstanceView(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MachineExtensionInstanceView(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceViewStatusTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("TypeHandlerVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).TypeHandlerVersion = (string) content.GetValueForProperty("TypeHandlerVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).TypeHandlerVersion, global::System.Convert.ToString); + } + if (content.Contains("StatusCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).StatusCode = (string) content.GetValueForProperty("StatusCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).StatusCode, global::System.Convert.ToString); + } + if (content.Contains("StatusLevel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).StatusLevel = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes?) content.GetValueForProperty("StatusLevel",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).StatusLevel, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes.CreateFrom); + } + if (content.Contains("StatusDisplayStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).StatusDisplayStatus = (string) content.GetValueForProperty("StatusDisplayStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).StatusDisplayStatus, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).StatusTime = (global::System.DateTime?) content.GetValueForProperty("StatusTime",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).StatusTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MachineExtensionInstanceView(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceViewStatusTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("TypeHandlerVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).TypeHandlerVersion = (string) content.GetValueForProperty("TypeHandlerVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).TypeHandlerVersion, global::System.Convert.ToString); + } + if (content.Contains("StatusCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).StatusCode = (string) content.GetValueForProperty("StatusCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).StatusCode, global::System.Convert.ToString); + } + if (content.Contains("StatusLevel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).StatusLevel = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes?) content.GetValueForProperty("StatusLevel",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).StatusLevel, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes.CreateFrom); + } + if (content.Contains("StatusDisplayStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).StatusDisplayStatus = (string) content.GetValueForProperty("StatusDisplayStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).StatusDisplayStatus, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).StatusTime = (global::System.DateTime?) content.GetValueForProperty("StatusTime",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)this).StatusTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes the Machine Extension Instance View. + [System.ComponentModel.TypeConverter(typeof(MachineExtensionInstanceViewTypeConverter))] + public partial interface IMachineExtensionInstanceView + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceView.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceView.TypeConverter.cs new file mode 100644 index 000000000000..0597ad310e69 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceView.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MachineExtensionInstanceViewTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MachineExtensionInstanceView.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MachineExtensionInstanceView.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MachineExtensionInstanceView.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceView.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceView.cs new file mode 100644 index 000000000000..f3c236aae442 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceView.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the Machine Extension Instance View. + public partial class MachineExtensionInstanceView : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal + { + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal.Status { get => (this._status = this._status ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceViewStatus()); set { {_status = value;} } } + + /// Backing field for property. + private string _name; + + /// The machine extension name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus _status; + + /// Instance view status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus Status { get => (this._status = this._status ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceViewStatus()); set => this._status = value; } + + /// The status code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)Status).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)Status).Code = value ?? null; } + + /// The short localizable label for the status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusDisplayStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)Status).DisplayStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)Status).DisplayStatus = value ?? null; } + + /// The level code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes? StatusLevel { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)Status).Level; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)Status).Level = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes)""); } + + /// The detailed status message, including for alerts and error messages. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)Status).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)Status).Message = value ?? null; } + + /// The time of the status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public global::System.DateTime? StatusTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)Status).Time; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)Status).Time = value ?? default(global::System.DateTime); } + + /// Backing field for property. + private string _type; + + /// Specifies the type of the extension; an example is "CustomScriptExtension". + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// Backing field for property. + private string _typeHandlerVersion; + + /// Specifies the version of the script handler. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string TypeHandlerVersion { get => this._typeHandlerVersion; set => this._typeHandlerVersion = value; } + + /// Creates an new instance. + public MachineExtensionInstanceView() + { + + } + } + /// Describes the Machine Extension Instance View. + public partial interface IMachineExtensionInstanceView : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The machine extension name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The machine extension name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// The status code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string StatusCode { get; set; } + /// The short localizable label for the status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The short localizable label for the status.", + SerializedName = @"displayStatus", + PossibleTypes = new [] { typeof(string) })] + string StatusDisplayStatus { get; set; } + /// The level code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The level code.", + SerializedName = @"level", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes? StatusLevel { get; set; } + /// The detailed status message, including for alerts and error messages. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The detailed status message, including for alerts and error messages.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string StatusMessage { get; set; } + /// The time of the status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The time of the status.", + SerializedName = @"time", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StatusTime { get; set; } + /// Specifies the type of the extension; an example is "CustomScriptExtension". + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the type of the extension; an example is ""CustomScriptExtension"".", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; set; } + /// Specifies the version of the script handler. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the version of the script handler.", + SerializedName = @"typeHandlerVersion", + PossibleTypes = new [] { typeof(string) })] + string TypeHandlerVersion { get; set; } + + } + /// Describes the Machine Extension Instance View. + internal partial interface IMachineExtensionInstanceViewInternal + + { + /// The machine extension name. + string Name { get; set; } + /// Instance view status. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus Status { get; set; } + /// The status code. + string StatusCode { get; set; } + /// The short localizable label for the status. + string StatusDisplayStatus { get; set; } + /// The level code. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes? StatusLevel { get; set; } + /// The detailed status message, including for alerts and error messages. + string StatusMessage { get; set; } + /// The time of the status. + global::System.DateTime? StatusTime { get; set; } + /// Specifies the type of the extension; an example is "CustomScriptExtension". + string Type { get; set; } + /// Specifies the version of the script handler. + string TypeHandlerVersion { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceView.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceView.json.cs new file mode 100644 index 000000000000..a1db3f8f7f96 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceView.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the Machine Extension Instance View. + public partial class MachineExtensionInstanceView + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MachineExtensionInstanceView(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal MachineExtensionInstanceView(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceViewStatus.FromJson(__jsonStatus) : Status;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + {_typeHandlerVersion = If( json?.PropertyT("typeHandlerVersion"), out var __jsonTypeHandlerVersion) ? (string)__jsonTypeHandlerVersion : (string)TypeHandlerVersion;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._status ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._status.ToJson(null,serializationMode) : null, "status" ,container.Add ); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AddIf( null != (((object)this._typeHandlerVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._typeHandlerVersion.ToString()) : null, "typeHandlerVersion" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceViewStatus.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceViewStatus.PowerShell.cs new file mode 100644 index 000000000000..767a6cb225fc --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceViewStatus.PowerShell.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Instance view status. + [System.ComponentModel.TypeConverter(typeof(MachineExtensionInstanceViewStatusTypeConverter))] + public partial class MachineExtensionInstanceViewStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MachineExtensionInstanceViewStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MachineExtensionInstanceViewStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MachineExtensionInstanceViewStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Level")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)this).Level = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes?) content.GetValueForProperty("Level",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)this).Level, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes.CreateFrom); + } + if (content.Contains("DisplayStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)this).DisplayStatus = (string) content.GetValueForProperty("DisplayStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)this).DisplayStatus, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Time")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)this).Time = (global::System.DateTime?) content.GetValueForProperty("Time",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)this).Time, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MachineExtensionInstanceViewStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Level")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)this).Level = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes?) content.GetValueForProperty("Level",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)this).Level, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes.CreateFrom); + } + if (content.Contains("DisplayStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)this).DisplayStatus = (string) content.GetValueForProperty("DisplayStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)this).DisplayStatus, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Time")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)this).Time = (global::System.DateTime?) content.GetValueForProperty("Time",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal)this).Time, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Instance view status. + [System.ComponentModel.TypeConverter(typeof(MachineExtensionInstanceViewStatusTypeConverter))] + public partial interface IMachineExtensionInstanceViewStatus + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceViewStatus.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceViewStatus.TypeConverter.cs new file mode 100644 index 000000000000..8b21be5ce2a7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceViewStatus.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MachineExtensionInstanceViewStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MachineExtensionInstanceViewStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MachineExtensionInstanceViewStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MachineExtensionInstanceViewStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceViewStatus.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceViewStatus.cs new file mode 100644 index 000000000000..a99466383df9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceViewStatus.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Instance view status. + public partial class MachineExtensionInstanceViewStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatusInternal + { + + /// Backing field for property. + private string _code; + + /// The status code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Code { get => this._code; set => this._code = value; } + + /// Backing field for property. + private string _displayStatus; + + /// The short localizable label for the status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string DisplayStatus { get => this._displayStatus; set => this._displayStatus = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes? _level; + + /// The level code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes? Level { get => this._level; set => this._level = value; } + + /// Backing field for property. + private string _message; + + /// The detailed status message, including for alerts and error messages. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Message { get => this._message; set => this._message = value; } + + /// Backing field for property. + private global::System.DateTime? _time; + + /// The time of the status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public global::System.DateTime? Time { get => this._time; set => this._time = value; } + + /// Creates an new instance. + public MachineExtensionInstanceViewStatus() + { + + } + } + /// Instance view status. + public partial interface IMachineExtensionInstanceViewStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The status code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; set; } + /// The short localizable label for the status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The short localizable label for the status.", + SerializedName = @"displayStatus", + PossibleTypes = new [] { typeof(string) })] + string DisplayStatus { get; set; } + /// The level code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The level code.", + SerializedName = @"level", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes? Level { get; set; } + /// The detailed status message, including for alerts and error messages. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The detailed status message, including for alerts and error messages.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; set; } + /// The time of the status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The time of the status.", + SerializedName = @"time", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? Time { get; set; } + + } + /// Instance view status. + internal partial interface IMachineExtensionInstanceViewStatusInternal + + { + /// The status code. + string Code { get; set; } + /// The short localizable label for the status. + string DisplayStatus { get; set; } + /// The level code. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes? Level { get; set; } + /// The detailed status message, including for alerts and error messages. + string Message { get; set; } + /// The time of the status. + global::System.DateTime? Time { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceViewStatus.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceViewStatus.json.cs new file mode 100644 index 000000000000..b1dd77ba1141 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionInstanceViewStatus.json.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Instance view status. + public partial class MachineExtensionInstanceViewStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MachineExtensionInstanceViewStatus(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal MachineExtensionInstanceViewStatus(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)Code;} + {_level = If( json?.PropertyT("level"), out var __jsonLevel) ? (string)__jsonLevel : (string)Level;} + {_displayStatus = If( json?.PropertyT("displayStatus"), out var __jsonDisplayStatus) ? (string)__jsonDisplayStatus : (string)DisplayStatus;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} + {_time = If( json?.PropertyT("time"), out var __jsonTime) ? global::System.DateTime.TryParse((string)__jsonTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonTimeValue) ? __jsonTimeValue : Time : Time;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + AddIf( null != (((object)this._level)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._level.ToString()) : null, "level" ,container.Add ); + AddIf( null != (((object)this._displayStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._displayStatus.ToString()) : null, "displayStatus" ,container.Add ); + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + AddIf( null != this._time ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._time?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "time" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionProperties.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionProperties.PowerShell.cs new file mode 100644 index 000000000000..eaf1f153133d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionProperties.PowerShell.cs @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes the properties of a Machine Extension. + [System.ComponentModel.TypeConverter(typeof(MachineExtensionPropertiesTypeConverter))] + public partial class MachineExtensionProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MachineExtensionProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MachineExtensionProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MachineExtensionProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceView")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).InstanceView = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView) content.GetValueForProperty("InstanceView",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).InstanceView, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceViewTypeConverter.ConvertFrom); + } + if (content.Contains("ForceUpdateTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).ForceUpdateTag = (string) content.GetValueForProperty("ForceUpdateTag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).ForceUpdateTag, global::System.Convert.ToString); + } + if (content.Contains("Publisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).Publisher = (string) content.GetValueForProperty("Publisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).Publisher, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("TypeHandlerVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).TypeHandlerVersion = (string) content.GetValueForProperty("TypeHandlerVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).TypeHandlerVersion, global::System.Convert.ToString); + } + if (content.Contains("EnableAutomaticUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).EnableAutomaticUpgrade = (bool?) content.GetValueForProperty("EnableAutomaticUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).EnableAutomaticUpgrade, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AutoUpgradeMinorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).AutoUpgradeMinorVersion = (bool?) content.GetValueForProperty("AutoUpgradeMinorVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).AutoUpgradeMinorVersion, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Setting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).Setting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings) content.GetValueForProperty("Setting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).Setting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionPropertiesSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("ProtectedSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).ProtectedSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings) content.GetValueForProperty("ProtectedSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).ProtectedSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionPropertiesProtectedSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("InstanceViewStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).InstanceViewStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus) content.GetValueForProperty("InstanceViewStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).InstanceViewStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceViewStatusTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceViewName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).InstanceViewName = (string) content.GetValueForProperty("InstanceViewName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).InstanceViewName, global::System.Convert.ToString); + } + if (content.Contains("InstanceViewType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).InstanceViewType = (string) content.GetValueForProperty("InstanceViewType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).InstanceViewType, global::System.Convert.ToString); + } + if (content.Contains("InstanceViewTypeHandlerVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).InstanceViewTypeHandlerVersion = (string) content.GetValueForProperty("InstanceViewTypeHandlerVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).InstanceViewTypeHandlerVersion, global::System.Convert.ToString); + } + if (content.Contains("StatusCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).StatusCode = (string) content.GetValueForProperty("StatusCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).StatusCode, global::System.Convert.ToString); + } + if (content.Contains("StatusLevel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).StatusLevel = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes?) content.GetValueForProperty("StatusLevel",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).StatusLevel, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes.CreateFrom); + } + if (content.Contains("StatusDisplayStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).StatusDisplayStatus = (string) content.GetValueForProperty("StatusDisplayStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).StatusDisplayStatus, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).StatusTime = (global::System.DateTime?) content.GetValueForProperty("StatusTime",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).StatusTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MachineExtensionProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceView")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).InstanceView = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView) content.GetValueForProperty("InstanceView",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).InstanceView, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceViewTypeConverter.ConvertFrom); + } + if (content.Contains("ForceUpdateTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).ForceUpdateTag = (string) content.GetValueForProperty("ForceUpdateTag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).ForceUpdateTag, global::System.Convert.ToString); + } + if (content.Contains("Publisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).Publisher = (string) content.GetValueForProperty("Publisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).Publisher, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("TypeHandlerVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).TypeHandlerVersion = (string) content.GetValueForProperty("TypeHandlerVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).TypeHandlerVersion, global::System.Convert.ToString); + } + if (content.Contains("EnableAutomaticUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).EnableAutomaticUpgrade = (bool?) content.GetValueForProperty("EnableAutomaticUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).EnableAutomaticUpgrade, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AutoUpgradeMinorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).AutoUpgradeMinorVersion = (bool?) content.GetValueForProperty("AutoUpgradeMinorVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).AutoUpgradeMinorVersion, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Setting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).Setting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings) content.GetValueForProperty("Setting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).Setting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionPropertiesSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("ProtectedSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).ProtectedSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings) content.GetValueForProperty("ProtectedSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).ProtectedSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionPropertiesProtectedSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("InstanceViewStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).InstanceViewStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus) content.GetValueForProperty("InstanceViewStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).InstanceViewStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceViewStatusTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceViewName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).InstanceViewName = (string) content.GetValueForProperty("InstanceViewName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).InstanceViewName, global::System.Convert.ToString); + } + if (content.Contains("InstanceViewType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).InstanceViewType = (string) content.GetValueForProperty("InstanceViewType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).InstanceViewType, global::System.Convert.ToString); + } + if (content.Contains("InstanceViewTypeHandlerVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).InstanceViewTypeHandlerVersion = (string) content.GetValueForProperty("InstanceViewTypeHandlerVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).InstanceViewTypeHandlerVersion, global::System.Convert.ToString); + } + if (content.Contains("StatusCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).StatusCode = (string) content.GetValueForProperty("StatusCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).StatusCode, global::System.Convert.ToString); + } + if (content.Contains("StatusLevel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).StatusLevel = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes?) content.GetValueForProperty("StatusLevel",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).StatusLevel, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes.CreateFrom); + } + if (content.Contains("StatusDisplayStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).StatusDisplayStatus = (string) content.GetValueForProperty("StatusDisplayStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).StatusDisplayStatus, global::System.Convert.ToString); + } + if (content.Contains("StatusMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).StatusMessage = (string) content.GetValueForProperty("StatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).StatusMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).StatusTime = (global::System.DateTime?) content.GetValueForProperty("StatusTime",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal)this).StatusTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes the properties of a Machine Extension. + [System.ComponentModel.TypeConverter(typeof(MachineExtensionPropertiesTypeConverter))] + public partial interface IMachineExtensionProperties + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionProperties.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionProperties.TypeConverter.cs new file mode 100644 index 000000000000..6a8ed6b28fcc --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MachineExtensionPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MachineExtensionProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MachineExtensionProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MachineExtensionProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionProperties.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionProperties.cs new file mode 100644 index 000000000000..136fa039447c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionProperties.cs @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the properties of a Machine Extension. + public partial class MachineExtensionProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionProperties, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal + { + + /// Backing field for property. + private bool? _autoUpgradeMinorVersion; + + /// + /// Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, + /// however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public bool? AutoUpgradeMinorVersion { get => this._autoUpgradeMinorVersion; set => this._autoUpgradeMinorVersion = value; } + + /// Backing field for property. + private bool? _enableAutomaticUpgrade; + + /// + /// Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public bool? EnableAutomaticUpgrade { get => this._enableAutomaticUpgrade; set => this._enableAutomaticUpgrade = value; } + + /// Backing field for property. + private string _forceUpdateTag; + + /// + /// How the extension handler should be forced to update even if the extension configuration has not changed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ForceUpdateTag { get => this._forceUpdateTag; set => this._forceUpdateTag = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView _instanceView; + + /// The machine extension instance view. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView InstanceView { get => (this._instanceView = this._instanceView ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceView()); set => this._instanceView = value; } + + /// The machine extension name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string InstanceViewName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)InstanceView).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)InstanceView).Name = value ?? null; } + + /// Specifies the type of the extension; an example is "CustomScriptExtension". + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string InstanceViewType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)InstanceView).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)InstanceView).Type = value ?? null; } + + /// Specifies the version of the script handler. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string InstanceViewTypeHandlerVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)InstanceView).TypeHandlerVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)InstanceView).TypeHandlerVersion = value ?? null; } + + /// Internal Acessors for InstanceView + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal.InstanceView { get => (this._instanceView = this._instanceView ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceView()); set { {_instanceView = value;} } } + + /// Internal Acessors for InstanceViewStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal.InstanceViewStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)InstanceView).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)InstanceView).Status = value; } + + /// Internal Acessors for ProvisioningState + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings _protectedSetting; + + /// + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings ProtectedSetting { get => (this._protectedSetting = this._protectedSetting ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionPropertiesProtectedSettings()); set => this._protectedSetting = value; } + + /// Backing field for property. + private string _provisioningState; + + /// The provisioning state, which only appears in the response. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ProvisioningState { get => this._provisioningState; } + + /// Backing field for property. + private string _publisher; + + /// The name of the extension handler publisher. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Publisher { get => this._publisher; set => this._publisher = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings _setting; + + /// Json formatted public settings for the extension. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings Setting { get => (this._setting = this._setting ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionPropertiesSettings()); set => this._setting = value; } + + /// The status code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)InstanceView).StatusCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)InstanceView).StatusCode = value ?? null; } + + /// The short localizable label for the status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusDisplayStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)InstanceView).StatusDisplayStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)InstanceView).StatusDisplayStatus = value ?? null; } + + /// The level code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes? StatusLevel { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)InstanceView).StatusLevel; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)InstanceView).StatusLevel = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes)""); } + + /// The detailed status message, including for alerts and error messages. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)InstanceView).StatusMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)InstanceView).StatusMessage = value ?? null; } + + /// The time of the status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public global::System.DateTime? StatusTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)InstanceView).StatusTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewInternal)InstanceView).StatusTime = value ?? default(global::System.DateTime); } + + /// Backing field for property. + private string _type; + + /// Specifies the type of the extension; an example is "CustomScriptExtension". + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// Backing field for property. + private string _typeHandlerVersion; + + /// Specifies the version of the script handler. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string TypeHandlerVersion { get => this._typeHandlerVersion; set => this._typeHandlerVersion = value; } + + /// Creates an new instance. + public MachineExtensionProperties() + { + + } + } + /// Describes the properties of a Machine Extension. + public partial interface IMachineExtensionProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// + /// Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, + /// however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true.", + SerializedName = @"autoUpgradeMinorVersion", + PossibleTypes = new [] { typeof(bool) })] + bool? AutoUpgradeMinorVersion { get; set; } + /// + /// Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available.", + SerializedName = @"enableAutomaticUpgrade", + PossibleTypes = new [] { typeof(bool) })] + bool? EnableAutomaticUpgrade { get; set; } + /// + /// How the extension handler should be forced to update even if the extension configuration has not changed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"How the extension handler should be forced to update even if the extension configuration has not changed.", + SerializedName = @"forceUpdateTag", + PossibleTypes = new [] { typeof(string) })] + string ForceUpdateTag { get; set; } + /// The machine extension name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The machine extension name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string InstanceViewName { get; set; } + /// Specifies the type of the extension; an example is "CustomScriptExtension". + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the type of the extension; an example is ""CustomScriptExtension"".", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string InstanceViewType { get; set; } + /// Specifies the version of the script handler. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the version of the script handler.", + SerializedName = @"typeHandlerVersion", + PossibleTypes = new [] { typeof(string) })] + string InstanceViewTypeHandlerVersion { get; set; } + /// + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.", + SerializedName = @"protectedSettings", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings ProtectedSetting { get; set; } + /// The provisioning state, which only appears in the response. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The provisioning state, which only appears in the response.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningState { get; } + /// The name of the extension handler publisher. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extension handler publisher.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + string Publisher { get; set; } + /// Json formatted public settings for the extension. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Json formatted public settings for the extension.", + SerializedName = @"settings", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings Setting { get; set; } + /// The status code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string StatusCode { get; set; } + /// The short localizable label for the status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The short localizable label for the status.", + SerializedName = @"displayStatus", + PossibleTypes = new [] { typeof(string) })] + string StatusDisplayStatus { get; set; } + /// The level code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The level code.", + SerializedName = @"level", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes? StatusLevel { get; set; } + /// The detailed status message, including for alerts and error messages. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The detailed status message, including for alerts and error messages.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string StatusMessage { get; set; } + /// The time of the status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The time of the status.", + SerializedName = @"time", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StatusTime { get; set; } + /// Specifies the type of the extension; an example is "CustomScriptExtension". + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the type of the extension; an example is ""CustomScriptExtension"".", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; set; } + /// Specifies the version of the script handler. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the version of the script handler.", + SerializedName = @"typeHandlerVersion", + PossibleTypes = new [] { typeof(string) })] + string TypeHandlerVersion { get; set; } + + } + /// Describes the properties of a Machine Extension. + internal partial interface IMachineExtensionPropertiesInternal + + { + /// + /// Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, + /// however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + /// + bool? AutoUpgradeMinorVersion { get; set; } + /// + /// Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + /// + bool? EnableAutomaticUpgrade { get; set; } + /// + /// How the extension handler should be forced to update even if the extension configuration has not changed. + /// + string ForceUpdateTag { get; set; } + /// The machine extension instance view. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView InstanceView { get; set; } + /// The machine extension name. + string InstanceViewName { get; set; } + /// Instance view status. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceViewStatus InstanceViewStatus { get; set; } + /// Specifies the type of the extension; an example is "CustomScriptExtension". + string InstanceViewType { get; set; } + /// Specifies the version of the script handler. + string InstanceViewTypeHandlerVersion { get; set; } + /// + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings ProtectedSetting { get; set; } + /// The provisioning state, which only appears in the response. + string ProvisioningState { get; set; } + /// The name of the extension handler publisher. + string Publisher { get; set; } + /// Json formatted public settings for the extension. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings Setting { get; set; } + /// The status code. + string StatusCode { get; set; } + /// The short localizable label for the status. + string StatusDisplayStatus { get; set; } + /// The level code. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes? StatusLevel { get; set; } + /// The detailed status message, including for alerts and error messages. + string StatusMessage { get; set; } + /// The time of the status. + global::System.DateTime? StatusTime { get; set; } + /// Specifies the type of the extension; an example is "CustomScriptExtension". + string Type { get; set; } + /// Specifies the version of the script handler. + string TypeHandlerVersion { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionProperties.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionProperties.json.cs new file mode 100644 index 000000000000..4fd014507229 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionProperties.json.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the properties of a Machine Extension. + public partial class MachineExtensionProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MachineExtensionProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal MachineExtensionProperties(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceView = If( json?.PropertyT("instanceView"), out var __jsonInstanceView) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceView.FromJson(__jsonInstanceView) : InstanceView;} + {_forceUpdateTag = If( json?.PropertyT("forceUpdateTag"), out var __jsonForceUpdateTag) ? (string)__jsonForceUpdateTag : (string)ForceUpdateTag;} + {_publisher = If( json?.PropertyT("publisher"), out var __jsonPublisher) ? (string)__jsonPublisher : (string)Publisher;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + {_typeHandlerVersion = If( json?.PropertyT("typeHandlerVersion"), out var __jsonTypeHandlerVersion) ? (string)__jsonTypeHandlerVersion : (string)TypeHandlerVersion;} + {_enableAutomaticUpgrade = If( json?.PropertyT("enableAutomaticUpgrade"), out var __jsonEnableAutomaticUpgrade) ? (bool?)__jsonEnableAutomaticUpgrade : EnableAutomaticUpgrade;} + {_autoUpgradeMinorVersion = If( json?.PropertyT("autoUpgradeMinorVersion"), out var __jsonAutoUpgradeMinorVersion) ? (bool?)__jsonAutoUpgradeMinorVersion : AutoUpgradeMinorVersion;} + {_setting = If( json?.PropertyT("settings"), out var __jsonSettings) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionPropertiesSettings.FromJson(__jsonSettings) : Setting;} + {_protectedSetting = If( json?.PropertyT("protectedSettings"), out var __jsonProtectedSettings) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionPropertiesProtectedSettings.FromJson(__jsonProtectedSettings) : ProtectedSetting;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._instanceView ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._instanceView.ToJson(null,serializationMode) : null, "instanceView" ,container.Add ); + AddIf( null != (((object)this._forceUpdateTag)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._forceUpdateTag.ToString()) : null, "forceUpdateTag" ,container.Add ); + AddIf( null != (((object)this._publisher)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._publisher.ToString()) : null, "publisher" ,container.Add ); + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AddIf( null != (((object)this._typeHandlerVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._typeHandlerVersion.ToString()) : null, "typeHandlerVersion" ,container.Add ); + AddIf( null != this._enableAutomaticUpgrade ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonBoolean((bool)this._enableAutomaticUpgrade) : null, "enableAutomaticUpgrade" ,container.Add ); + AddIf( null != this._autoUpgradeMinorVersion ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonBoolean((bool)this._autoUpgradeMinorVersion) : null, "autoUpgradeMinorVersion" ,container.Add ); + AddIf( null != this._setting ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._setting.ToJson(null,serializationMode) : null, "settings" ,container.Add ); + AddIf( null != this._protectedSetting ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._protectedSetting.ToJson(null,serializationMode) : null, "protectedSettings" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesProtectedSettings.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesProtectedSettings.PowerShell.cs new file mode 100644 index 000000000000..245887052b52 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesProtectedSettings.PowerShell.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// + [System.ComponentModel.TypeConverter(typeof(MachineExtensionPropertiesProtectedSettingsTypeConverter))] + public partial class MachineExtensionPropertiesProtectedSettings + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MachineExtensionPropertiesProtectedSettings(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MachineExtensionPropertiesProtectedSettings(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MachineExtensionPropertiesProtectedSettings(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MachineExtensionPropertiesProtectedSettings(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + [System.ComponentModel.TypeConverter(typeof(MachineExtensionPropertiesProtectedSettingsTypeConverter))] + public partial interface IMachineExtensionPropertiesProtectedSettings + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesProtectedSettings.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesProtectedSettings.TypeConverter.cs new file mode 100644 index 000000000000..ce2d937a6115 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesProtectedSettings.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MachineExtensionPropertiesProtectedSettingsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MachineExtensionPropertiesProtectedSettings.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MachineExtensionPropertiesProtectedSettings.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MachineExtensionPropertiesProtectedSettings.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesProtectedSettings.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesProtectedSettings.cs new file mode 100644 index 000000000000..fe9952172fe4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesProtectedSettings.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// + public partial class MachineExtensionPropertiesProtectedSettings : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettingsInternal + { + + /// + /// Creates an new instance. + /// + public MachineExtensionPropertiesProtectedSettings() + { + + } + } + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + public partial interface IMachineExtensionPropertiesProtectedSettings : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + + } + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + internal partial interface IMachineExtensionPropertiesProtectedSettingsInternal + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesProtectedSettings.dictionary.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesProtectedSettings.dictionary.cs new file mode 100644 index 000000000000..323396820662 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesProtectedSettings.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class MachineExtensionPropertiesProtectedSettings : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public global::System.Object this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, global::System.Object value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out global::System.Object value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionPropertiesProtectedSettings source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesProtectedSettings.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesProtectedSettings.json.cs new file mode 100644 index 000000000000..31336e72901e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesProtectedSettings.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// + public partial class MachineExtensionPropertiesProtectedSettings + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MachineExtensionPropertiesProtectedSettings(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + /// + internal MachineExtensionPropertiesProtectedSettings(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.DeserializeDictionary(()=>new global::System.Collections.Generic.Dictionary()),exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesSettings.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesSettings.PowerShell.cs new file mode 100644 index 000000000000..85f7af180acf --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesSettings.PowerShell.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Json formatted public settings for the extension. + [System.ComponentModel.TypeConverter(typeof(MachineExtensionPropertiesSettingsTypeConverter))] + public partial class MachineExtensionPropertiesSettings + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MachineExtensionPropertiesSettings(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MachineExtensionPropertiesSettings(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MachineExtensionPropertiesSettings(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MachineExtensionPropertiesSettings(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Json formatted public settings for the extension. + [System.ComponentModel.TypeConverter(typeof(MachineExtensionPropertiesSettingsTypeConverter))] + public partial interface IMachineExtensionPropertiesSettings + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesSettings.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesSettings.TypeConverter.cs new file mode 100644 index 000000000000..7adbc317395a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesSettings.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MachineExtensionPropertiesSettingsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MachineExtensionPropertiesSettings.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MachineExtensionPropertiesSettings.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MachineExtensionPropertiesSettings.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesSettings.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesSettings.cs new file mode 100644 index 000000000000..d7c18ed9a7b5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesSettings.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Json formatted public settings for the extension. + public partial class MachineExtensionPropertiesSettings : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettingsInternal + { + + /// Creates an new instance. + public MachineExtensionPropertiesSettings() + { + + } + } + /// Json formatted public settings for the extension. + public partial interface IMachineExtensionPropertiesSettings : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + + } + /// Json formatted public settings for the extension. + internal partial interface IMachineExtensionPropertiesSettingsInternal + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesSettings.dictionary.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesSettings.dictionary.cs new file mode 100644 index 000000000000..12cd666c4467 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesSettings.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class MachineExtensionPropertiesSettings : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public global::System.Object this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, global::System.Object value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out global::System.Object value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionPropertiesSettings source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesSettings.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesSettings.json.cs new file mode 100644 index 000000000000..1a5301bbfccb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionPropertiesSettings.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Json formatted public settings for the extension. + public partial class MachineExtensionPropertiesSettings + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MachineExtensionPropertiesSettings(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + /// + internal MachineExtensionPropertiesSettings(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.DeserializeDictionary(()=>new global::System.Collections.Generic.Dictionary()),exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdate.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdate.PowerShell.cs new file mode 100644 index 000000000000..b790403f93a3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdate.PowerShell.cs @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes a Machine Extension Update. + [System.ComponentModel.TypeConverter(typeof(MachineExtensionUpdateTypeConverter))] + public partial class MachineExtensionUpdate + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MachineExtensionUpdate(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MachineExtensionUpdate(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MachineExtensionUpdate(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdatePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ResourceUpdateTagsTypeConverter.ConvertFrom); + } + if (content.Contains("ForceUpdateTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).ForceUpdateTag = (string) content.GetValueForProperty("ForceUpdateTag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).ForceUpdateTag, global::System.Convert.ToString); + } + if (content.Contains("Publisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).Publisher = (string) content.GetValueForProperty("Publisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).Publisher, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("TypeHandlerVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).TypeHandlerVersion = (string) content.GetValueForProperty("TypeHandlerVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).TypeHandlerVersion, global::System.Convert.ToString); + } + if (content.Contains("EnableAutomaticUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).EnableAutomaticUpgrade = (bool?) content.GetValueForProperty("EnableAutomaticUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).EnableAutomaticUpgrade, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AutoUpgradeMinorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).AutoUpgradeMinorVersion = (bool?) content.GetValueForProperty("AutoUpgradeMinorVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).AutoUpgradeMinorVersion, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Setting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).Setting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings) content.GetValueForProperty("Setting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).Setting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdatePropertiesSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("ProtectedSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).ProtectedSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings) content.GetValueForProperty("ProtectedSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).ProtectedSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdatePropertiesProtectedSettingsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MachineExtensionUpdate(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdatePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ResourceUpdateTagsTypeConverter.ConvertFrom); + } + if (content.Contains("ForceUpdateTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).ForceUpdateTag = (string) content.GetValueForProperty("ForceUpdateTag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).ForceUpdateTag, global::System.Convert.ToString); + } + if (content.Contains("Publisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).Publisher = (string) content.GetValueForProperty("Publisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).Publisher, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("TypeHandlerVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).TypeHandlerVersion = (string) content.GetValueForProperty("TypeHandlerVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).TypeHandlerVersion, global::System.Convert.ToString); + } + if (content.Contains("EnableAutomaticUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).EnableAutomaticUpgrade = (bool?) content.GetValueForProperty("EnableAutomaticUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).EnableAutomaticUpgrade, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AutoUpgradeMinorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).AutoUpgradeMinorVersion = (bool?) content.GetValueForProperty("AutoUpgradeMinorVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).AutoUpgradeMinorVersion, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Setting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).Setting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings) content.GetValueForProperty("Setting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).Setting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdatePropertiesSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("ProtectedSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).ProtectedSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings) content.GetValueForProperty("ProtectedSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal)this).ProtectedSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdatePropertiesProtectedSettingsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes a Machine Extension Update. + [System.ComponentModel.TypeConverter(typeof(MachineExtensionUpdateTypeConverter))] + public partial interface IMachineExtensionUpdate + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdate.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdate.TypeConverter.cs new file mode 100644 index 000000000000..02d0d4dbea7d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdate.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MachineExtensionUpdateTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdate ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdate).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MachineExtensionUpdate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MachineExtensionUpdate.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MachineExtensionUpdate.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdate.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdate.cs new file mode 100644 index 000000000000..2d6626459a3f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdate.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes a Machine Extension Update. + public partial class MachineExtensionUpdate : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdate, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdate __resourceUpdate = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ResourceUpdate(); + + /// + /// Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, + /// however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? AutoUpgradeMinorVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)Property).AutoUpgradeMinorVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)Property).AutoUpgradeMinorVersion = value ?? default(bool); } + + /// + /// Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? EnableAutomaticUpgrade { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)Property).EnableAutomaticUpgrade; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)Property).EnableAutomaticUpgrade = value ?? default(bool); } + + /// + /// How the extension handler should be forced to update even if the extension configuration has not changed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ForceUpdateTag { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)Property).ForceUpdateTag; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)Property).ForceUpdateTag = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdateProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateProperties _property; + + /// Describes Machine Extension Update Properties. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdateProperties()); set => this._property = value; } + + /// + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings ProtectedSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)Property).ProtectedSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)Property).ProtectedSetting = value ?? null /* model class */; } + + /// The name of the extension handler publisher. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string Publisher { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)Property).Publisher; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)Property).Publisher = value ?? null; } + + /// Json formatted public settings for the extension. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings Setting { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)Property).Setting; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)Property).Setting = value ?? null /* model class */; } + + /// Resource tags + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateInternal)__resourceUpdate).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateInternal)__resourceUpdate).Tag = value ?? null /* model class */; } + + /// Specifies the type of the extension; an example is "CustomScriptExtension". + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)Property).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)Property).Type = value ?? null; } + + /// Specifies the version of the script handler. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string TypeHandlerVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)Property).TypeHandlerVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)Property).TypeHandlerVersion = value ?? null; } + + /// Creates an new instance. + public MachineExtensionUpdate() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resourceUpdate), __resourceUpdate); + await eventListener.AssertObjectIsValid(nameof(__resourceUpdate), __resourceUpdate); + } + } + /// Describes a Machine Extension Update. + public partial interface IMachineExtensionUpdate : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdate + { + /// + /// Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, + /// however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true.", + SerializedName = @"autoUpgradeMinorVersion", + PossibleTypes = new [] { typeof(bool) })] + bool? AutoUpgradeMinorVersion { get; set; } + /// + /// Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available.", + SerializedName = @"enableAutomaticUpgrade", + PossibleTypes = new [] { typeof(bool) })] + bool? EnableAutomaticUpgrade { get; set; } + /// + /// How the extension handler should be forced to update even if the extension configuration has not changed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"How the extension handler should be forced to update even if the extension configuration has not changed.", + SerializedName = @"forceUpdateTag", + PossibleTypes = new [] { typeof(string) })] + string ForceUpdateTag { get; set; } + /// + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.", + SerializedName = @"protectedSettings", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings ProtectedSetting { get; set; } + /// The name of the extension handler publisher. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extension handler publisher.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + string Publisher { get; set; } + /// Json formatted public settings for the extension. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Json formatted public settings for the extension.", + SerializedName = @"settings", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings Setting { get; set; } + /// Specifies the type of the extension; an example is "CustomScriptExtension". + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the type of the extension; an example is ""CustomScriptExtension"".", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; set; } + /// Specifies the version of the script handler. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the version of the script handler.", + SerializedName = @"typeHandlerVersion", + PossibleTypes = new [] { typeof(string) })] + string TypeHandlerVersion { get; set; } + + } + /// Describes a Machine Extension Update. + internal partial interface IMachineExtensionUpdateInternal : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateInternal + { + /// + /// Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, + /// however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + /// + bool? AutoUpgradeMinorVersion { get; set; } + /// + /// Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + /// + bool? EnableAutomaticUpgrade { get; set; } + /// + /// How the extension handler should be forced to update even if the extension configuration has not changed. + /// + string ForceUpdateTag { get; set; } + /// Describes Machine Extension Update Properties. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateProperties Property { get; set; } + /// + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings ProtectedSetting { get; set; } + /// The name of the extension handler publisher. + string Publisher { get; set; } + /// Json formatted public settings for the extension. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings Setting { get; set; } + /// Specifies the type of the extension; an example is "CustomScriptExtension". + string Type { get; set; } + /// Specifies the version of the script handler. + string TypeHandlerVersion { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdate.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdate.json.cs new file mode 100644 index 000000000000..0bcf123eb323 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdate.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes a Machine Extension Update. + public partial class MachineExtensionUpdate + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdate. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdate. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MachineExtensionUpdate(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal MachineExtensionUpdate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resourceUpdate = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ResourceUpdate(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdateProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resourceUpdate?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdateProperties.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdateProperties.PowerShell.cs new file mode 100644 index 000000000000..2526148cef7e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdateProperties.PowerShell.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes the properties of a Machine Extension. + [System.ComponentModel.TypeConverter(typeof(MachineExtensionUpdatePropertiesTypeConverter))] + public partial class MachineExtensionUpdateProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MachineExtensionUpdateProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MachineExtensionUpdateProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MachineExtensionUpdateProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ForceUpdateTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).ForceUpdateTag = (string) content.GetValueForProperty("ForceUpdateTag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).ForceUpdateTag, global::System.Convert.ToString); + } + if (content.Contains("Publisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).Publisher = (string) content.GetValueForProperty("Publisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).Publisher, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("TypeHandlerVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).TypeHandlerVersion = (string) content.GetValueForProperty("TypeHandlerVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).TypeHandlerVersion, global::System.Convert.ToString); + } + if (content.Contains("EnableAutomaticUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).EnableAutomaticUpgrade = (bool?) content.GetValueForProperty("EnableAutomaticUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).EnableAutomaticUpgrade, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AutoUpgradeMinorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).AutoUpgradeMinorVersion = (bool?) content.GetValueForProperty("AutoUpgradeMinorVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).AutoUpgradeMinorVersion, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Setting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).Setting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings) content.GetValueForProperty("Setting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).Setting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdatePropertiesSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("ProtectedSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).ProtectedSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings) content.GetValueForProperty("ProtectedSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).ProtectedSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdatePropertiesProtectedSettingsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MachineExtensionUpdateProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ForceUpdateTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).ForceUpdateTag = (string) content.GetValueForProperty("ForceUpdateTag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).ForceUpdateTag, global::System.Convert.ToString); + } + if (content.Contains("Publisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).Publisher = (string) content.GetValueForProperty("Publisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).Publisher, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("TypeHandlerVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).TypeHandlerVersion = (string) content.GetValueForProperty("TypeHandlerVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).TypeHandlerVersion, global::System.Convert.ToString); + } + if (content.Contains("EnableAutomaticUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).EnableAutomaticUpgrade = (bool?) content.GetValueForProperty("EnableAutomaticUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).EnableAutomaticUpgrade, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AutoUpgradeMinorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).AutoUpgradeMinorVersion = (bool?) content.GetValueForProperty("AutoUpgradeMinorVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).AutoUpgradeMinorVersion, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Setting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).Setting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings) content.GetValueForProperty("Setting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).Setting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdatePropertiesSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("ProtectedSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).ProtectedSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings) content.GetValueForProperty("ProtectedSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal)this).ProtectedSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdatePropertiesProtectedSettingsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes the properties of a Machine Extension. + [System.ComponentModel.TypeConverter(typeof(MachineExtensionUpdatePropertiesTypeConverter))] + public partial interface IMachineExtensionUpdateProperties + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdateProperties.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdateProperties.TypeConverter.cs new file mode 100644 index 000000000000..39375444b07a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdateProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MachineExtensionUpdatePropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MachineExtensionUpdateProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MachineExtensionUpdateProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MachineExtensionUpdateProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdateProperties.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdateProperties.cs new file mode 100644 index 000000000000..69dee85e14ee --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdateProperties.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the properties of a Machine Extension. + public partial class MachineExtensionUpdateProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateProperties, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesInternal + { + + /// Backing field for property. + private bool? _autoUpgradeMinorVersion; + + /// + /// Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, + /// however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public bool? AutoUpgradeMinorVersion { get => this._autoUpgradeMinorVersion; set => this._autoUpgradeMinorVersion = value; } + + /// Backing field for property. + private bool? _enableAutomaticUpgrade; + + /// + /// Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public bool? EnableAutomaticUpgrade { get => this._enableAutomaticUpgrade; set => this._enableAutomaticUpgrade = value; } + + /// Backing field for property. + private string _forceUpdateTag; + + /// + /// How the extension handler should be forced to update even if the extension configuration has not changed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ForceUpdateTag { get => this._forceUpdateTag; set => this._forceUpdateTag = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings _protectedSetting; + + /// + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings ProtectedSetting { get => (this._protectedSetting = this._protectedSetting ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdatePropertiesProtectedSettings()); set => this._protectedSetting = value; } + + /// Backing field for property. + private string _publisher; + + /// The name of the extension handler publisher. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Publisher { get => this._publisher; set => this._publisher = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings _setting; + + /// Json formatted public settings for the extension. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings Setting { get => (this._setting = this._setting ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdatePropertiesSettings()); set => this._setting = value; } + + /// Backing field for property. + private string _type; + + /// Specifies the type of the extension; an example is "CustomScriptExtension". + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// Backing field for property. + private string _typeHandlerVersion; + + /// Specifies the version of the script handler. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string TypeHandlerVersion { get => this._typeHandlerVersion; set => this._typeHandlerVersion = value; } + + /// Creates an new instance. + public MachineExtensionUpdateProperties() + { + + } + } + /// Describes the properties of a Machine Extension. + public partial interface IMachineExtensionUpdateProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// + /// Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, + /// however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true.", + SerializedName = @"autoUpgradeMinorVersion", + PossibleTypes = new [] { typeof(bool) })] + bool? AutoUpgradeMinorVersion { get; set; } + /// + /// Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available.", + SerializedName = @"enableAutomaticUpgrade", + PossibleTypes = new [] { typeof(bool) })] + bool? EnableAutomaticUpgrade { get; set; } + /// + /// How the extension handler should be forced to update even if the extension configuration has not changed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"How the extension handler should be forced to update even if the extension configuration has not changed.", + SerializedName = @"forceUpdateTag", + PossibleTypes = new [] { typeof(string) })] + string ForceUpdateTag { get; set; } + /// + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.", + SerializedName = @"protectedSettings", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings ProtectedSetting { get; set; } + /// The name of the extension handler publisher. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extension handler publisher.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + string Publisher { get; set; } + /// Json formatted public settings for the extension. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Json formatted public settings for the extension.", + SerializedName = @"settings", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings Setting { get; set; } + /// Specifies the type of the extension; an example is "CustomScriptExtension". + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the type of the extension; an example is ""CustomScriptExtension"".", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; set; } + /// Specifies the version of the script handler. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the version of the script handler.", + SerializedName = @"typeHandlerVersion", + PossibleTypes = new [] { typeof(string) })] + string TypeHandlerVersion { get; set; } + + } + /// Describes the properties of a Machine Extension. + internal partial interface IMachineExtensionUpdatePropertiesInternal + + { + /// + /// Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, + /// however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + /// + bool? AutoUpgradeMinorVersion { get; set; } + /// + /// Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + /// + bool? EnableAutomaticUpgrade { get; set; } + /// + /// How the extension handler should be forced to update even if the extension configuration has not changed. + /// + string ForceUpdateTag { get; set; } + /// + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings ProtectedSetting { get; set; } + /// The name of the extension handler publisher. + string Publisher { get; set; } + /// Json formatted public settings for the extension. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings Setting { get; set; } + /// Specifies the type of the extension; an example is "CustomScriptExtension". + string Type { get; set; } + /// Specifies the version of the script handler. + string TypeHandlerVersion { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdateProperties.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdateProperties.json.cs new file mode 100644 index 000000000000..ca5306093d7c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdateProperties.json.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the properties of a Machine Extension. + public partial class MachineExtensionUpdateProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdateProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MachineExtensionUpdateProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal MachineExtensionUpdateProperties(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_forceUpdateTag = If( json?.PropertyT("forceUpdateTag"), out var __jsonForceUpdateTag) ? (string)__jsonForceUpdateTag : (string)ForceUpdateTag;} + {_publisher = If( json?.PropertyT("publisher"), out var __jsonPublisher) ? (string)__jsonPublisher : (string)Publisher;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + {_typeHandlerVersion = If( json?.PropertyT("typeHandlerVersion"), out var __jsonTypeHandlerVersion) ? (string)__jsonTypeHandlerVersion : (string)TypeHandlerVersion;} + {_enableAutomaticUpgrade = If( json?.PropertyT("enableAutomaticUpgrade"), out var __jsonEnableAutomaticUpgrade) ? (bool?)__jsonEnableAutomaticUpgrade : EnableAutomaticUpgrade;} + {_autoUpgradeMinorVersion = If( json?.PropertyT("autoUpgradeMinorVersion"), out var __jsonAutoUpgradeMinorVersion) ? (bool?)__jsonAutoUpgradeMinorVersion : AutoUpgradeMinorVersion;} + {_setting = If( json?.PropertyT("settings"), out var __jsonSettings) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdatePropertiesSettings.FromJson(__jsonSettings) : Setting;} + {_protectedSetting = If( json?.PropertyT("protectedSettings"), out var __jsonProtectedSettings) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdatePropertiesProtectedSettings.FromJson(__jsonProtectedSettings) : ProtectedSetting;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._forceUpdateTag)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._forceUpdateTag.ToString()) : null, "forceUpdateTag" ,container.Add ); + AddIf( null != (((object)this._publisher)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._publisher.ToString()) : null, "publisher" ,container.Add ); + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AddIf( null != (((object)this._typeHandlerVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._typeHandlerVersion.ToString()) : null, "typeHandlerVersion" ,container.Add ); + AddIf( null != this._enableAutomaticUpgrade ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonBoolean((bool)this._enableAutomaticUpgrade) : null, "enableAutomaticUpgrade" ,container.Add ); + AddIf( null != this._autoUpgradeMinorVersion ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonBoolean((bool)this._autoUpgradeMinorVersion) : null, "autoUpgradeMinorVersion" ,container.Add ); + AddIf( null != this._setting ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._setting.ToJson(null,serializationMode) : null, "settings" ,container.Add ); + AddIf( null != this._protectedSetting ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._protectedSetting.ToJson(null,serializationMode) : null, "protectedSettings" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesProtectedSettings.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesProtectedSettings.PowerShell.cs new file mode 100644 index 000000000000..ca2274605f2c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesProtectedSettings.PowerShell.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// + [System.ComponentModel.TypeConverter(typeof(MachineExtensionUpdatePropertiesProtectedSettingsTypeConverter))] + public partial class MachineExtensionUpdatePropertiesProtectedSettings + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MachineExtensionUpdatePropertiesProtectedSettings(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MachineExtensionUpdatePropertiesProtectedSettings(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MachineExtensionUpdatePropertiesProtectedSettings(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MachineExtensionUpdatePropertiesProtectedSettings(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + [System.ComponentModel.TypeConverter(typeof(MachineExtensionUpdatePropertiesProtectedSettingsTypeConverter))] + public partial interface IMachineExtensionUpdatePropertiesProtectedSettings + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesProtectedSettings.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesProtectedSettings.TypeConverter.cs new file mode 100644 index 000000000000..f4ab36ed660b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesProtectedSettings.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MachineExtensionUpdatePropertiesProtectedSettingsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MachineExtensionUpdatePropertiesProtectedSettings.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MachineExtensionUpdatePropertiesProtectedSettings.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MachineExtensionUpdatePropertiesProtectedSettings.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesProtectedSettings.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesProtectedSettings.cs new file mode 100644 index 000000000000..d0ea1a219421 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesProtectedSettings.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// + public partial class MachineExtensionUpdatePropertiesProtectedSettings : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettingsInternal + { + + /// + /// Creates an new instance. + /// + public MachineExtensionUpdatePropertiesProtectedSettings() + { + + } + } + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + public partial interface IMachineExtensionUpdatePropertiesProtectedSettings : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + + } + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + internal partial interface IMachineExtensionUpdatePropertiesProtectedSettingsInternal + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesProtectedSettings.dictionary.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesProtectedSettings.dictionary.cs new file mode 100644 index 000000000000..f3915607ac95 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesProtectedSettings.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class MachineExtensionUpdatePropertiesProtectedSettings : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public global::System.Object this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, global::System.Object value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out global::System.Object value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdatePropertiesProtectedSettings source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesProtectedSettings.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesProtectedSettings.json.cs new file mode 100644 index 000000000000..13a118233e51 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesProtectedSettings.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// + public partial class MachineExtensionUpdatePropertiesProtectedSettings + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MachineExtensionUpdatePropertiesProtectedSettings(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + /// + internal MachineExtensionUpdatePropertiesProtectedSettings(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.DeserializeDictionary(()=>new global::System.Collections.Generic.Dictionary()),exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesSettings.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesSettings.PowerShell.cs new file mode 100644 index 000000000000..dd34923238f3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesSettings.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Json formatted public settings for the extension. + [System.ComponentModel.TypeConverter(typeof(MachineExtensionUpdatePropertiesSettingsTypeConverter))] + public partial class MachineExtensionUpdatePropertiesSettings + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MachineExtensionUpdatePropertiesSettings(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MachineExtensionUpdatePropertiesSettings(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MachineExtensionUpdatePropertiesSettings(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MachineExtensionUpdatePropertiesSettings(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Json formatted public settings for the extension. + [System.ComponentModel.TypeConverter(typeof(MachineExtensionUpdatePropertiesSettingsTypeConverter))] + public partial interface IMachineExtensionUpdatePropertiesSettings + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesSettings.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesSettings.TypeConverter.cs new file mode 100644 index 000000000000..458d61427d6a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesSettings.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MachineExtensionUpdatePropertiesSettingsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MachineExtensionUpdatePropertiesSettings.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MachineExtensionUpdatePropertiesSettings.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MachineExtensionUpdatePropertiesSettings.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesSettings.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesSettings.cs new file mode 100644 index 000000000000..9d19dc2eda5c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesSettings.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Json formatted public settings for the extension. + public partial class MachineExtensionUpdatePropertiesSettings : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettingsInternal + { + + /// + /// Creates an new instance. + /// + public MachineExtensionUpdatePropertiesSettings() + { + + } + } + /// Json formatted public settings for the extension. + public partial interface IMachineExtensionUpdatePropertiesSettings : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + + } + /// Json formatted public settings for the extension. + internal partial interface IMachineExtensionUpdatePropertiesSettingsInternal + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesSettings.dictionary.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesSettings.dictionary.cs new file mode 100644 index 000000000000..3877e331c12b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesSettings.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class MachineExtensionUpdatePropertiesSettings : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public global::System.Object this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, global::System.Object value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out global::System.Object value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdatePropertiesSettings source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesSettings.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesSettings.json.cs new file mode 100644 index 000000000000..adbae4cbd289 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpdatePropertiesSettings.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Json formatted public settings for the extension. + public partial class MachineExtensionUpdatePropertiesSettings + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MachineExtensionUpdatePropertiesSettings(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + /// + internal MachineExtensionUpdatePropertiesSettings(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.DeserializeDictionary(()=>new global::System.Collections.Generic.Dictionary()),exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpgrade.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpgrade.PowerShell.cs new file mode 100644 index 000000000000..a7a68242a02b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpgrade.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes the Machine Extension Upgrade Properties. + [System.ComponentModel.TypeConverter(typeof(MachineExtensionUpgradeTypeConverter))] + public partial class MachineExtensionUpgrade + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MachineExtensionUpgrade(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MachineExtensionUpgrade(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MachineExtensionUpgrade(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ExtensionTarget")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgradeInternal)this).ExtensionTarget = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTarget) content.GetValueForProperty("ExtensionTarget",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgradeInternal)this).ExtensionTarget, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ExtensionTargetTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MachineExtensionUpgrade(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ExtensionTarget")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgradeInternal)this).ExtensionTarget = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTarget) content.GetValueForProperty("ExtensionTarget",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgradeInternal)this).ExtensionTarget, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ExtensionTargetTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes the Machine Extension Upgrade Properties. + [System.ComponentModel.TypeConverter(typeof(MachineExtensionUpgradeTypeConverter))] + public partial interface IMachineExtensionUpgrade + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpgrade.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpgrade.TypeConverter.cs new file mode 100644 index 000000000000..79714d8d5251 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpgrade.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MachineExtensionUpgradeTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MachineExtensionUpgrade.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MachineExtensionUpgrade.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MachineExtensionUpgrade.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpgrade.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpgrade.cs new file mode 100644 index 000000000000..371c2358c92f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpgrade.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the Machine Extension Upgrade Properties. + public partial class MachineExtensionUpgrade : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgradeInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTarget _extensionTarget; + + /// Describes the Extension Target Properties. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTarget ExtensionTarget { get => (this._extensionTarget = this._extensionTarget ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ExtensionTarget()); set => this._extensionTarget = value; } + + /// Creates an new instance. + public MachineExtensionUpgrade() + { + + } + } + /// Describes the Machine Extension Upgrade Properties. + public partial interface IMachineExtensionUpgrade : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Describes the Extension Target Properties. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Describes the Extension Target Properties.", + SerializedName = @"extensionTargets", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTarget) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTarget ExtensionTarget { get; set; } + + } + /// Describes the Machine Extension Upgrade Properties. + internal partial interface IMachineExtensionUpgradeInternal + + { + /// Describes the Extension Target Properties. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTarget ExtensionTarget { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpgrade.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpgrade.json.cs new file mode 100644 index 000000000000..3f8bbc14d06f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionUpgrade.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the Machine Extension Upgrade Properties. + public partial class MachineExtensionUpgrade + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MachineExtensionUpgrade(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal MachineExtensionUpgrade(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_extensionTarget = If( json?.PropertyT("extensionTargets"), out var __jsonExtensionTargets) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ExtensionTarget.FromJson(__jsonExtensionTargets) : ExtensionTarget;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._extensionTarget ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._extensionTarget.ToJson(null,serializationMode) : null, "extensionTargets" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionsListResult.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionsListResult.PowerShell.cs new file mode 100644 index 000000000000..aff61ad5b9c3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionsListResult.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes the Machine Extensions List Result. + [System.ComponentModel.TypeConverter(typeof(MachineExtensionsListResultTypeConverter))] + public partial class MachineExtensionsListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionsListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MachineExtensionsListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionsListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MachineExtensionsListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionsListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MachineExtensionsListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionsListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionsListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionsListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionsListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MachineExtensionsListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionsListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionsListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionsListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionsListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes the Machine Extensions List Result. + [System.ComponentModel.TypeConverter(typeof(MachineExtensionsListResultTypeConverter))] + public partial interface IMachineExtensionsListResult + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionsListResult.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionsListResult.TypeConverter.cs new file mode 100644 index 000000000000..9a14e435071a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionsListResult.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MachineExtensionsListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionsListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionsListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MachineExtensionsListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MachineExtensionsListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MachineExtensionsListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionsListResult.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionsListResult.cs new file mode 100644 index 000000000000..e9b171b12d57 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionsListResult.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the Machine Extensions List Result. + public partial class MachineExtensionsListResult : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionsListResult, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionsListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + /// + /// The uri to fetch the next page of machine extensions. Call ListNext() with this to fetch the next page of extensions. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension[] _value; + + /// The list of extensions + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public MachineExtensionsListResult() + { + + } + } + /// Describes the Machine Extensions List Result. + public partial interface IMachineExtensionsListResult : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// + /// The uri to fetch the next page of machine extensions. Call ListNext() with this to fetch the next page of extensions. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The uri to fetch the next page of machine extensions. Call ListNext() with this to fetch the next page of extensions.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of extensions + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of extensions", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension[] Value { get; set; } + + } + /// Describes the Machine Extensions List Result. + internal partial interface IMachineExtensionsListResultInternal + + { + /// + /// The uri to fetch the next page of machine extensions. Call ListNext() with this to fetch the next page of extensions. + /// + string NextLink { get; set; } + /// The list of extensions + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionsListResult.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionsListResult.json.cs new file mode 100644 index 000000000000..f156f2bc06f0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineExtensionsListResult.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the Machine Extensions List Result. + public partial class MachineExtensionsListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionsListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionsListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionsListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MachineExtensionsListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal MachineExtensionsListResult(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtension.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineListResult.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineListResult.PowerShell.cs new file mode 100644 index 000000000000..de5427342e97 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineListResult.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The List hybrid machine operation response. + [System.ComponentModel.TypeConverter(typeof(MachineListResultTypeConverter))] + public partial class MachineListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MachineListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MachineListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MachineListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MachineListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The List hybrid machine operation response. + [System.ComponentModel.TypeConverter(typeof(MachineListResultTypeConverter))] + public partial interface IMachineListResult + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineListResult.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineListResult.TypeConverter.cs new file mode 100644 index 000000000000..28cbf740f5b3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineListResult.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MachineListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MachineListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MachineListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MachineListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineListResult.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineListResult.cs new file mode 100644 index 000000000000..dbd366150ff5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineListResult.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The List hybrid machine operation response. + public partial class MachineListResult : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineListResult, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + /// + /// The URI to fetch the next page of Machines. Call ListNext() with this URI to fetch the next page of hybrid machines. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine[] _value; + + /// The list of hybrid machines. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public MachineListResult() + { + + } + } + /// The List hybrid machine operation response. + public partial interface IMachineListResult : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// + /// The URI to fetch the next page of Machines. Call ListNext() with this URI to fetch the next page of hybrid machines. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The URI to fetch the next page of Machines. Call ListNext() with this URI to fetch the next page of hybrid machines.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of hybrid machines. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The list of hybrid machines.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine[] Value { get; set; } + + } + /// The List hybrid machine operation response. + internal partial interface IMachineListResultInternal + + { + /// + /// The URI to fetch the next page of Machines. Call ListNext() with this URI to fetch the next page of hybrid machines. + /// + string NextLink { get; set; } + /// The list of hybrid machines. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineListResult.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineListResult.json.cs new file mode 100644 index 000000000000..1e0922938849 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineListResult.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The List hybrid machine operation response. + public partial class MachineListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MachineListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal MachineListResult(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.Machine.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineProperties.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineProperties.PowerShell.cs new file mode 100644 index 000000000000..474fb057f1a5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineProperties.PowerShell.cs @@ -0,0 +1,658 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes the properties of a hybrid machine. + [System.ComponentModel.TypeConverter(typeof(MachinePropertiesTypeConverter))] + public partial class MachineProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MachineProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MachineProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MachineProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("LocationData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LocationData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData) content.GetValueForProperty("LocationData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LocationData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.LocationDataTypeConverter.ConvertFrom); + } + if (content.Contains("AgentConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfiguration) content.GetValueForProperty("AgentConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("ServiceStatuses")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ServiceStatuses = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatuses) content.GetValueForProperty("ServiceStatuses",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ServiceStatuses, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatusesTypeConverter.ConvertFrom); + } + if (content.Contains("CloudMetadata")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).CloudMetadata = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata) content.GetValueForProperty("CloudMetadata",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).CloudMetadata, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.CloudMetadataTypeConverter.ConvertFrom); + } + if (content.Contains("AgentUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgrade = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade) content.GetValueForProperty("AgentUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgrade, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentUpgradeTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile) content.GetValueForProperty("OSProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileTypeConverter.ConvertFrom); + } + if (content.Contains("NetworkProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).NetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfile) content.GetValueForProperty("NetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).NetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.NetworkProfileTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes.CreateFrom); + } + if (content.Contains("LastStatusChange")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LastStatusChange = (global::System.DateTime?) content.GetValueForProperty("LastStatusChange",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LastStatusChange, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[]) content.GetValueForProperty("ErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("AgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentVersion = (string) content.GetValueForProperty("AgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentVersion, global::System.Convert.ToString); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("MachineFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).MachineFqdn = (string) content.GetValueForProperty("MachineFqdn",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).MachineFqdn, global::System.Convert.ToString); + } + if (content.Contains("ClientPublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ClientPublicKey = (string) content.GetValueForProperty("ClientPublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ClientPublicKey, global::System.Convert.ToString); + } + if (content.Contains("OSName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSName = (string) content.GetValueForProperty("OSName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSName, global::System.Convert.ToString); + } + if (content.Contains("OSVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSVersion = (string) content.GetValueForProperty("OSVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSVersion, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("VMUuid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).VMUuid = (string) content.GetValueForProperty("VMUuid",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).VMUuid, global::System.Convert.ToString); + } + if (content.Contains("Extension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).Extension = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView[]) content.GetValueForProperty("Extension",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).Extension, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceViewTypeConverter.ConvertFrom)); + } + if (content.Contains("OSSku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSSku = (string) content.GetValueForProperty("OSSku",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSSku, global::System.Convert.ToString); + } + if (content.Contains("DomainName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).DomainName = (string) content.GetValueForProperty("DomainName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).DomainName, global::System.Convert.ToString); + } + if (content.Contains("AdFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AdFqdn = (string) content.GetValueForProperty("AdFqdn",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AdFqdn, global::System.Convert.ToString); + } + if (content.Contains("DnsFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).DnsFqdn = (string) content.GetValueForProperty("DnsFqdn",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).DnsFqdn, global::System.Convert.ToString); + } + if (content.Contains("PrivateLinkScopeResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).PrivateLinkScopeResourceId = (string) content.GetValueForProperty("PrivateLinkScopeResourceId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).PrivateLinkScopeResourceId, global::System.Convert.ToString); + } + if (content.Contains("ParentClusterResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ParentClusterResourceId = (string) content.GetValueForProperty("ParentClusterResourceId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ParentClusterResourceId, global::System.Convert.ToString); + } + if (content.Contains("MssqlDiscovered")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).MssqlDiscovered = (string) content.GetValueForProperty("MssqlDiscovered",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).MssqlDiscovered, global::System.Convert.ToString); + } + if (content.Contains("DetectedProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).DetectedProperty = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties) content.GetValueForProperty("DetectedProperty",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).DetectedProperty, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.DetectedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("LocationDataName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LocationDataName = (string) content.GetValueForProperty("LocationDataName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LocationDataName, global::System.Convert.ToString); + } + if (content.Contains("LocationDataCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LocationDataCity = (string) content.GetValueForProperty("LocationDataCity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LocationDataCity, global::System.Convert.ToString); + } + if (content.Contains("LocationDataDistrict")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LocationDataDistrict = (string) content.GetValueForProperty("LocationDataDistrict",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LocationDataDistrict, global::System.Convert.ToString); + } + if (content.Contains("AgentConfigurationProxyUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationProxyUrl = (string) content.GetValueForProperty("AgentConfigurationProxyUrl",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationProxyUrl, global::System.Convert.ToString); + } + if (content.Contains("AgentConfigurationProxyBypass")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationProxyBypass = (string[]) content.GetValueForProperty("AgentConfigurationProxyBypass",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationProxyBypass, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("AgentConfigurationExtensionsEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationExtensionsEnabled = (string) content.GetValueForProperty("AgentConfigurationExtensionsEnabled",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationExtensionsEnabled, global::System.Convert.ToString); + } + if (content.Contains("CloudMetadataProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).CloudMetadataProvider = (string) content.GetValueForProperty("CloudMetadataProvider",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).CloudMetadataProvider, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeDesiredVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeDesiredVersion = (string) content.GetValueForProperty("AgentUpgradeDesiredVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeDesiredVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeCorrelationId = (string) content.GetValueForProperty("AgentUpgradeCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeCorrelationId, global::System.Convert.ToString); + } + if (content.Contains("NetworkProfileNetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).NetworkProfileNetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface[]) content.GetValueForProperty("NetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).NetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.NetworkInterfaceTypeConverter.ConvertFrom)); + } + if (content.Contains("LocationDataCountryOrRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LocationDataCountryOrRegion = (string) content.GetValueForProperty("LocationDataCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LocationDataCountryOrRegion, global::System.Convert.ToString); + } + if (content.Contains("AgentConfigurationIncomingConnectionsPort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationIncomingConnectionsPort = (string[]) content.GetValueForProperty("AgentConfigurationIncomingConnectionsPort",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationIncomingConnectionsPort, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("AgentConfigurationExtensionsAllowList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationExtensionsAllowList = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[]) content.GetValueForProperty("AgentConfigurationExtensionsAllowList",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationExtensionsAllowList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ConfigurationExtensionTypeConverter.ConvertFrom)); + } + if (content.Contains("AgentConfigurationExtensionsBlockList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationExtensionsBlockList = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[]) content.GetValueForProperty("AgentConfigurationExtensionsBlockList",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationExtensionsBlockList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ConfigurationExtensionTypeConverter.ConvertFrom)); + } + if (content.Contains("AgentConfigurationGuestConfigurationEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationGuestConfigurationEnabled = (string) content.GetValueForProperty("AgentConfigurationGuestConfigurationEnabled",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationGuestConfigurationEnabled, global::System.Convert.ToString); + } + if (content.Contains("AgentConfigurationConfigMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationConfigMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode?) content.GetValueForProperty("AgentConfigurationConfigMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationConfigMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode.CreateFrom); + } + if (content.Contains("ServiceStatusesExtensionService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ServiceStatusesExtensionService = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus) content.GetValueForProperty("ServiceStatusesExtensionService",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ServiceStatusesExtensionService, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ServiceStatusesGuestConfigurationService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ServiceStatusesGuestConfigurationService = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus) content.GetValueForProperty("ServiceStatusesGuestConfigurationService",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ServiceStatusesGuestConfigurationService, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatusTypeConverter.ConvertFrom); + } + if (content.Contains("AgentUpgradeEnableAutomaticUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeEnableAutomaticUpgrade = (bool?) content.GetValueForProperty("AgentUpgradeEnableAutomaticUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeEnableAutomaticUpgrade, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AgentUpgradeLastAttemptDesiredVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeLastAttemptDesiredVersion = (string) content.GetValueForProperty("AgentUpgradeLastAttemptDesiredVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeLastAttemptDesiredVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeLastAttemptTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeLastAttemptTimestamp = (string) content.GetValueForProperty("AgentUpgradeLastAttemptTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeLastAttemptTimestamp, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeLastAttemptStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeLastAttemptStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum?) content.GetValueForProperty("AgentUpgradeLastAttemptStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeLastAttemptStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum.CreateFrom); + } + if (content.Contains("AgentUpgradeLastAttemptMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeLastAttemptMessage = (string) content.GetValueForProperty("AgentUpgradeLastAttemptMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeLastAttemptMessage, global::System.Convert.ToString); + } + if (content.Contains("OSProfileWindowsConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSProfileWindowsConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration) content.GetValueForProperty("OSProfileWindowsConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSProfileWindowsConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileWindowsConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileLinuxConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSProfileLinuxConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration) content.GetValueForProperty("OSProfileLinuxConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSProfileLinuxConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileLinuxConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileComputerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSProfileComputerName = (string) content.GetValueForProperty("OSProfileComputerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSProfileComputerName, global::System.Convert.ToString); + } + if (content.Contains("WindowConfigurationPatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).WindowConfigurationPatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("WindowConfigurationPatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).WindowConfigurationPatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("LinuxConfigurationPatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LinuxConfigurationPatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("LinuxConfigurationPatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LinuxConfigurationPatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("ExtensionServiceStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ExtensionServiceStatus = (string) content.GetValueForProperty("ExtensionServiceStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ExtensionServiceStatus, global::System.Convert.ToString); + } + if (content.Contains("ExtensionServiceStartupType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ExtensionServiceStartupType = (string) content.GetValueForProperty("ExtensionServiceStartupType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ExtensionServiceStartupType, global::System.Convert.ToString); + } + if (content.Contains("GuestConfigurationServiceStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).GuestConfigurationServiceStatus = (string) content.GetValueForProperty("GuestConfigurationServiceStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).GuestConfigurationServiceStatus, global::System.Convert.ToString); + } + if (content.Contains("GuestConfigurationServiceStartupType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).GuestConfigurationServiceStartupType = (string) content.GetValueForProperty("GuestConfigurationServiceStartupType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).GuestConfigurationServiceStartupType, global::System.Convert.ToString); + } + if (content.Contains("WindowsConfigurationPatchSettingsAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).WindowsConfigurationPatchSettingsAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("WindowsConfigurationPatchSettingsAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).WindowsConfigurationPatchSettingsAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("WindowsConfigurationPatchSettingsPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).WindowsConfigurationPatchSettingsPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("WindowsConfigurationPatchSettingsPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).WindowsConfigurationPatchSettingsPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + if (content.Contains("LinuxConfigurationPatchSettingsAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LinuxConfigurationPatchSettingsAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("LinuxConfigurationPatchSettingsAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LinuxConfigurationPatchSettingsAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("LinuxConfigurationPatchSettingsPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LinuxConfigurationPatchSettingsPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("LinuxConfigurationPatchSettingsPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LinuxConfigurationPatchSettingsPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MachineProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("LocationData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LocationData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData) content.GetValueForProperty("LocationData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LocationData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.LocationDataTypeConverter.ConvertFrom); + } + if (content.Contains("AgentConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfiguration) content.GetValueForProperty("AgentConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("ServiceStatuses")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ServiceStatuses = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatuses) content.GetValueForProperty("ServiceStatuses",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ServiceStatuses, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatusesTypeConverter.ConvertFrom); + } + if (content.Contains("CloudMetadata")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).CloudMetadata = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata) content.GetValueForProperty("CloudMetadata",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).CloudMetadata, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.CloudMetadataTypeConverter.ConvertFrom); + } + if (content.Contains("AgentUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgrade = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade) content.GetValueForProperty("AgentUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgrade, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentUpgradeTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile) content.GetValueForProperty("OSProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileTypeConverter.ConvertFrom); + } + if (content.Contains("NetworkProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).NetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfile) content.GetValueForProperty("NetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).NetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.NetworkProfileTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes.CreateFrom); + } + if (content.Contains("LastStatusChange")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LastStatusChange = (global::System.DateTime?) content.GetValueForProperty("LastStatusChange",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LastStatusChange, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[]) content.GetValueForProperty("ErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("AgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentVersion = (string) content.GetValueForProperty("AgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentVersion, global::System.Convert.ToString); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("MachineFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).MachineFqdn = (string) content.GetValueForProperty("MachineFqdn",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).MachineFqdn, global::System.Convert.ToString); + } + if (content.Contains("ClientPublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ClientPublicKey = (string) content.GetValueForProperty("ClientPublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ClientPublicKey, global::System.Convert.ToString); + } + if (content.Contains("OSName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSName = (string) content.GetValueForProperty("OSName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSName, global::System.Convert.ToString); + } + if (content.Contains("OSVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSVersion = (string) content.GetValueForProperty("OSVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSVersion, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("VMUuid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).VMUuid = (string) content.GetValueForProperty("VMUuid",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).VMUuid, global::System.Convert.ToString); + } + if (content.Contains("Extension")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).Extension = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView[]) content.GetValueForProperty("Extension",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).Extension, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceViewTypeConverter.ConvertFrom)); + } + if (content.Contains("OSSku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSSku = (string) content.GetValueForProperty("OSSku",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSSku, global::System.Convert.ToString); + } + if (content.Contains("DomainName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).DomainName = (string) content.GetValueForProperty("DomainName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).DomainName, global::System.Convert.ToString); + } + if (content.Contains("AdFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AdFqdn = (string) content.GetValueForProperty("AdFqdn",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AdFqdn, global::System.Convert.ToString); + } + if (content.Contains("DnsFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).DnsFqdn = (string) content.GetValueForProperty("DnsFqdn",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).DnsFqdn, global::System.Convert.ToString); + } + if (content.Contains("PrivateLinkScopeResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).PrivateLinkScopeResourceId = (string) content.GetValueForProperty("PrivateLinkScopeResourceId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).PrivateLinkScopeResourceId, global::System.Convert.ToString); + } + if (content.Contains("ParentClusterResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ParentClusterResourceId = (string) content.GetValueForProperty("ParentClusterResourceId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ParentClusterResourceId, global::System.Convert.ToString); + } + if (content.Contains("MssqlDiscovered")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).MssqlDiscovered = (string) content.GetValueForProperty("MssqlDiscovered",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).MssqlDiscovered, global::System.Convert.ToString); + } + if (content.Contains("DetectedProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).DetectedProperty = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties) content.GetValueForProperty("DetectedProperty",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).DetectedProperty, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.DetectedPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("LocationDataName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LocationDataName = (string) content.GetValueForProperty("LocationDataName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LocationDataName, global::System.Convert.ToString); + } + if (content.Contains("LocationDataCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LocationDataCity = (string) content.GetValueForProperty("LocationDataCity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LocationDataCity, global::System.Convert.ToString); + } + if (content.Contains("LocationDataDistrict")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LocationDataDistrict = (string) content.GetValueForProperty("LocationDataDistrict",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LocationDataDistrict, global::System.Convert.ToString); + } + if (content.Contains("AgentConfigurationProxyUrl")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationProxyUrl = (string) content.GetValueForProperty("AgentConfigurationProxyUrl",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationProxyUrl, global::System.Convert.ToString); + } + if (content.Contains("AgentConfigurationProxyBypass")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationProxyBypass = (string[]) content.GetValueForProperty("AgentConfigurationProxyBypass",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationProxyBypass, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("AgentConfigurationExtensionsEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationExtensionsEnabled = (string) content.GetValueForProperty("AgentConfigurationExtensionsEnabled",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationExtensionsEnabled, global::System.Convert.ToString); + } + if (content.Contains("CloudMetadataProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).CloudMetadataProvider = (string) content.GetValueForProperty("CloudMetadataProvider",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).CloudMetadataProvider, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeDesiredVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeDesiredVersion = (string) content.GetValueForProperty("AgentUpgradeDesiredVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeDesiredVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeCorrelationId = (string) content.GetValueForProperty("AgentUpgradeCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeCorrelationId, global::System.Convert.ToString); + } + if (content.Contains("NetworkProfileNetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).NetworkProfileNetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface[]) content.GetValueForProperty("NetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).NetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.NetworkInterfaceTypeConverter.ConvertFrom)); + } + if (content.Contains("LocationDataCountryOrRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LocationDataCountryOrRegion = (string) content.GetValueForProperty("LocationDataCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LocationDataCountryOrRegion, global::System.Convert.ToString); + } + if (content.Contains("AgentConfigurationIncomingConnectionsPort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationIncomingConnectionsPort = (string[]) content.GetValueForProperty("AgentConfigurationIncomingConnectionsPort",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationIncomingConnectionsPort, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("AgentConfigurationExtensionsAllowList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationExtensionsAllowList = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[]) content.GetValueForProperty("AgentConfigurationExtensionsAllowList",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationExtensionsAllowList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ConfigurationExtensionTypeConverter.ConvertFrom)); + } + if (content.Contains("AgentConfigurationExtensionsBlockList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationExtensionsBlockList = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[]) content.GetValueForProperty("AgentConfigurationExtensionsBlockList",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationExtensionsBlockList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ConfigurationExtensionTypeConverter.ConvertFrom)); + } + if (content.Contains("AgentConfigurationGuestConfigurationEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationGuestConfigurationEnabled = (string) content.GetValueForProperty("AgentConfigurationGuestConfigurationEnabled",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationGuestConfigurationEnabled, global::System.Convert.ToString); + } + if (content.Contains("AgentConfigurationConfigMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationConfigMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode?) content.GetValueForProperty("AgentConfigurationConfigMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentConfigurationConfigMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode.CreateFrom); + } + if (content.Contains("ServiceStatusesExtensionService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ServiceStatusesExtensionService = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus) content.GetValueForProperty("ServiceStatusesExtensionService",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ServiceStatusesExtensionService, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ServiceStatusesGuestConfigurationService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ServiceStatusesGuestConfigurationService = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus) content.GetValueForProperty("ServiceStatusesGuestConfigurationService",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ServiceStatusesGuestConfigurationService, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatusTypeConverter.ConvertFrom); + } + if (content.Contains("AgentUpgradeEnableAutomaticUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeEnableAutomaticUpgrade = (bool?) content.GetValueForProperty("AgentUpgradeEnableAutomaticUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeEnableAutomaticUpgrade, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AgentUpgradeLastAttemptDesiredVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeLastAttemptDesiredVersion = (string) content.GetValueForProperty("AgentUpgradeLastAttemptDesiredVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeLastAttemptDesiredVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeLastAttemptTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeLastAttemptTimestamp = (string) content.GetValueForProperty("AgentUpgradeLastAttemptTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeLastAttemptTimestamp, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeLastAttemptStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeLastAttemptStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum?) content.GetValueForProperty("AgentUpgradeLastAttemptStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeLastAttemptStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum.CreateFrom); + } + if (content.Contains("AgentUpgradeLastAttemptMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeLastAttemptMessage = (string) content.GetValueForProperty("AgentUpgradeLastAttemptMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).AgentUpgradeLastAttemptMessage, global::System.Convert.ToString); + } + if (content.Contains("OSProfileWindowsConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSProfileWindowsConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration) content.GetValueForProperty("OSProfileWindowsConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSProfileWindowsConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileWindowsConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileLinuxConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSProfileLinuxConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration) content.GetValueForProperty("OSProfileLinuxConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSProfileLinuxConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileLinuxConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileComputerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSProfileComputerName = (string) content.GetValueForProperty("OSProfileComputerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).OSProfileComputerName, global::System.Convert.ToString); + } + if (content.Contains("WindowConfigurationPatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).WindowConfigurationPatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("WindowConfigurationPatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).WindowConfigurationPatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("LinuxConfigurationPatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LinuxConfigurationPatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("LinuxConfigurationPatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LinuxConfigurationPatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("ExtensionServiceStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ExtensionServiceStatus = (string) content.GetValueForProperty("ExtensionServiceStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ExtensionServiceStatus, global::System.Convert.ToString); + } + if (content.Contains("ExtensionServiceStartupType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ExtensionServiceStartupType = (string) content.GetValueForProperty("ExtensionServiceStartupType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).ExtensionServiceStartupType, global::System.Convert.ToString); + } + if (content.Contains("GuestConfigurationServiceStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).GuestConfigurationServiceStatus = (string) content.GetValueForProperty("GuestConfigurationServiceStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).GuestConfigurationServiceStatus, global::System.Convert.ToString); + } + if (content.Contains("GuestConfigurationServiceStartupType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).GuestConfigurationServiceStartupType = (string) content.GetValueForProperty("GuestConfigurationServiceStartupType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).GuestConfigurationServiceStartupType, global::System.Convert.ToString); + } + if (content.Contains("WindowsConfigurationPatchSettingsAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).WindowsConfigurationPatchSettingsAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("WindowsConfigurationPatchSettingsAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).WindowsConfigurationPatchSettingsAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("WindowsConfigurationPatchSettingsPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).WindowsConfigurationPatchSettingsPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("WindowsConfigurationPatchSettingsPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).WindowsConfigurationPatchSettingsPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + if (content.Contains("LinuxConfigurationPatchSettingsAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LinuxConfigurationPatchSettingsAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("LinuxConfigurationPatchSettingsAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LinuxConfigurationPatchSettingsAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("LinuxConfigurationPatchSettingsPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LinuxConfigurationPatchSettingsPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("LinuxConfigurationPatchSettingsPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal)this).LinuxConfigurationPatchSettingsPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes the properties of a hybrid machine. + [System.ComponentModel.TypeConverter(typeof(MachinePropertiesTypeConverter))] + public partial interface IMachineProperties + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineProperties.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineProperties.TypeConverter.cs new file mode 100644 index 000000000000..819d1a5c8c29 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MachinePropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MachineProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MachineProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MachineProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineProperties.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineProperties.cs new file mode 100644 index 000000000000..ff8f2b2ffe1e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineProperties.cs @@ -0,0 +1,1054 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the properties of a hybrid machine. + public partial class MachineProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineProperties, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal + { + + /// Backing field for property. + private string _adFqdn; + + /// Specifies the AD fully qualified display name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string AdFqdn { get => this._adFqdn; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfiguration _agentConfiguration; + + /// + /// Configurable properties that the user can set locally via the azcmagent config command, or remotely via ARM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfiguration AgentConfiguration { get => (this._agentConfiguration = this._agentConfiguration ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentConfiguration()); } + + /// + /// Name of configuration mode to use. Modes are pre-defined configurations of security controls, extension allowlists and + /// guest configuration, maintained by Microsoft. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode? AgentConfigurationConfigMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).ConfigMode; } + + /// Array of extensions that are allowed to be installed or updated. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] AgentConfigurationExtensionsAllowList { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).ExtensionsAllowList; } + + /// Array of extensions that are blocked (cannot be installed or updated) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] AgentConfigurationExtensionsBlockList { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).ExtensionsBlockList; } + + /// Specifies whether the extension service is enabled or disabled. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentConfigurationExtensionsEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).ExtensionsEnabled; } + + /// Specified whether the guest configuration service is enabled or disabled. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentConfigurationGuestConfigurationEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).GuestConfigurationEnabled; } + + /// Specifies the list of ports that the agent will be able to listen on. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string[] AgentConfigurationIncomingConnectionsPort { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).IncomingConnectionsPort; } + + /// List of service names which should not use the specified proxy server. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string[] AgentConfigurationProxyBypass { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).ProxyBypass; } + + /// Specifies the URL of the proxy to be used. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentConfigurationProxyUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).ProxyUrl; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade _agentUpgrade; + + /// The info of the machine w.r.t Agent Upgrade + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade AgentUpgrade { get => (this._agentUpgrade = this._agentUpgrade ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentUpgrade()); set => this._agentUpgrade = value; } + + /// The correlation ID passed in from RSM per upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentUpgradeCorrelationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).CorrelationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).CorrelationId = value ?? null; } + + /// Specifies the version info w.r.t AgentUpgrade for the machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentUpgradeDesiredVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).DesiredVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).DesiredVersion = value ?? null; } + + /// Specifies if RSM should try to upgrade this machine + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? AgentUpgradeEnableAutomaticUpgrade { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).EnableAutomaticUpgrade; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).EnableAutomaticUpgrade = value ?? default(bool); } + + /// Specifies the version of the last attempt + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentUpgradeLastAttemptDesiredVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptDesiredVersion; } + + /// Failure message of last upgrade attempt if any. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentUpgradeLastAttemptMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptMessage; } + + /// Specifies the status of Agent Upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum? AgentUpgradeLastAttemptStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptStatus; } + + /// Timestamp of last upgrade attempt + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentUpgradeLastAttemptTimestamp { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptTimestamp; } + + /// Backing field for property. + private string _agentVersion; + + /// The hybrid machine agent full version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string AgentVersion { get => this._agentVersion; } + + /// Backing field for property. + private string _clientPublicKey; + + /// + /// Public Key that the client provides to be used during initial resource onboarding + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ClientPublicKey { get => this._clientPublicKey; set => this._clientPublicKey = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata _cloudMetadata; + + /// The metadata of the cloud environment (Azure/GCP/AWS/OCI...). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata CloudMetadata { get => (this._cloudMetadata = this._cloudMetadata ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.CloudMetadata()); set => this._cloudMetadata = value; } + + /// Specifies the cloud provider (Azure/AWS/GCP...). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string CloudMetadataProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadataInternal)CloudMetadata).Provider; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties _detectedProperty; + + /// Detected properties from the machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties DetectedProperty { get => (this._detectedProperty = this._detectedProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.DetectedProperties()); } + + /// Backing field for property. + private string _displayName; + + /// Specifies the hybrid machine display name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string DisplayName { get => this._displayName; } + + /// Backing field for property. + private string _dnsFqdn; + + /// Specifies the DNS fully qualified display name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string DnsFqdn { get => this._dnsFqdn; } + + /// Backing field for property. + private string _domainName; + + /// Specifies the Windows domain name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string DomainName { get => this._domainName; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] _errorDetail; + + /// Details about the error state. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] ErrorDetail { get => this._errorDetail; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView[] _extension; + + /// Machine Extensions information (deprecated field) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView[] Extension { get => this._extension; set => this._extension = value; } + + /// The behavior of the service when the Arc-enabled machine starts up. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ExtensionServiceStartupType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)ServiceStatuses).ExtensionServiceStartupType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)ServiceStatuses).ExtensionServiceStartupType = value ?? null; } + + /// The current status of the service. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ExtensionServiceStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)ServiceStatuses).ExtensionServiceStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)ServiceStatuses).ExtensionServiceStatus = value ?? null; } + + /// The behavior of the service when the Arc-enabled machine starts up. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string GuestConfigurationServiceStartupType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)ServiceStatuses).GuestConfigurationServiceStartupType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)ServiceStatuses).GuestConfigurationServiceStartupType = value ?? null; } + + /// The current status of the service. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string GuestConfigurationServiceStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)ServiceStatuses).GuestConfigurationServiceStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)ServiceStatuses).GuestConfigurationServiceStatus = value ?? null; } + + /// Backing field for property. + private global::System.DateTime? _lastStatusChange; + + /// The time of the last status change. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public global::System.DateTime? LastStatusChange { get => this._lastStatusChange; } + + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? LinuxConfigurationPatchSettingsAssessmentMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).LinuxConfigurationPatchSettingsAssessmentMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).LinuxConfigurationPatchSettingsAssessmentMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes)""); } + + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? LinuxConfigurationPatchSettingsPatchMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).LinuxConfigurationPatchSettingsPatchMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).LinuxConfigurationPatchSettingsPatchMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes)""); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData _locationData; + + /// Metadata pertaining to the geographic location of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData LocationData { get => (this._locationData = this._locationData ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.LocationData()); set => this._locationData = value; } + + /// The city or locality where the resource is located. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string LocationDataCity { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)LocationData).City; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)LocationData).City = value ?? null; } + + /// The country or region where the resource is located + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string LocationDataCountryOrRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)LocationData).CountryOrRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)LocationData).CountryOrRegion = value ?? null; } + + /// The district, state, or province where the resource is located. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string LocationDataDistrict { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)LocationData).District; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)LocationData).District = value ?? null; } + + /// A canonical name for the geographic or physical location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string LocationDataName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)LocationData).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)LocationData).Name = value ?? null; } + + /// Backing field for property. + private string _machineFqdn; + + /// Specifies the hybrid machine FQDN. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string MachineFqdn { get => this._machineFqdn; } + + /// Internal Acessors for AdFqdn + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.AdFqdn { get => this._adFqdn; set { {_adFqdn = value;} } } + + /// Internal Acessors for AgentConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.AgentConfiguration { get => (this._agentConfiguration = this._agentConfiguration ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentConfiguration()); set { {_agentConfiguration = value;} } } + + /// Internal Acessors for AgentConfigurationConfigMode + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.AgentConfigurationConfigMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).ConfigMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).ConfigMode = value; } + + /// Internal Acessors for AgentConfigurationExtensionsAllowList + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.AgentConfigurationExtensionsAllowList { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).ExtensionsAllowList; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).ExtensionsAllowList = value; } + + /// Internal Acessors for AgentConfigurationExtensionsBlockList + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.AgentConfigurationExtensionsBlockList { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).ExtensionsBlockList; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).ExtensionsBlockList = value; } + + /// Internal Acessors for AgentConfigurationExtensionsEnabled + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.AgentConfigurationExtensionsEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).ExtensionsEnabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).ExtensionsEnabled = value; } + + /// Internal Acessors for AgentConfigurationGuestConfigurationEnabled + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.AgentConfigurationGuestConfigurationEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).GuestConfigurationEnabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).GuestConfigurationEnabled = value; } + + /// Internal Acessors for AgentConfigurationIncomingConnectionsPort + string[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.AgentConfigurationIncomingConnectionsPort { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).IncomingConnectionsPort; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).IncomingConnectionsPort = value; } + + /// Internal Acessors for AgentConfigurationProxyBypass + string[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.AgentConfigurationProxyBypass { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).ProxyBypass; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).ProxyBypass = value; } + + /// Internal Acessors for AgentConfigurationProxyUrl + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.AgentConfigurationProxyUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).ProxyUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfigurationInternal)AgentConfiguration).ProxyUrl = value; } + + /// Internal Acessors for AgentUpgrade + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.AgentUpgrade { get => (this._agentUpgrade = this._agentUpgrade ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentUpgrade()); set { {_agentUpgrade = value;} } } + + /// Internal Acessors for AgentUpgradeLastAttemptDesiredVersion + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.AgentUpgradeLastAttemptDesiredVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptDesiredVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptDesiredVersion = value; } + + /// Internal Acessors for AgentUpgradeLastAttemptMessage + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.AgentUpgradeLastAttemptMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptMessage = value; } + + /// Internal Acessors for AgentUpgradeLastAttemptStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.AgentUpgradeLastAttemptStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptStatus = value; } + + /// Internal Acessors for AgentUpgradeLastAttemptTimestamp + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.AgentUpgradeLastAttemptTimestamp { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptTimestamp; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptTimestamp = value; } + + /// Internal Acessors for AgentVersion + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.AgentVersion { get => this._agentVersion; set { {_agentVersion = value;} } } + + /// Internal Acessors for CloudMetadata + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.CloudMetadata { get => (this._cloudMetadata = this._cloudMetadata ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.CloudMetadata()); set { {_cloudMetadata = value;} } } + + /// Internal Acessors for CloudMetadataProvider + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.CloudMetadataProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadataInternal)CloudMetadata).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadataInternal)CloudMetadata).Provider = value; } + + /// Internal Acessors for DetectedProperty + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.DetectedProperty { get => (this._detectedProperty = this._detectedProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.DetectedProperties()); set { {_detectedProperty = value;} } } + + /// Internal Acessors for DisplayName + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.DisplayName { get => this._displayName; set { {_displayName = value;} } } + + /// Internal Acessors for DnsFqdn + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.DnsFqdn { get => this._dnsFqdn; set { {_dnsFqdn = value;} } } + + /// Internal Acessors for DomainName + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.DomainName { get => this._domainName; set { {_domainName = value;} } } + + /// Internal Acessors for ErrorDetail + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.ErrorDetail { get => this._errorDetail; set { {_errorDetail = value;} } } + + /// Internal Acessors for LastStatusChange + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.LastStatusChange { get => this._lastStatusChange; set { {_lastStatusChange = value;} } } + + /// Internal Acessors for LinuxConfigurationPatchSetting + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.LinuxConfigurationPatchSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).LinuxConfigurationPatchSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).LinuxConfigurationPatchSetting = value; } + + /// Internal Acessors for LocationData + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.LocationData { get => (this._locationData = this._locationData ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.LocationData()); set { {_locationData = value;} } } + + /// Internal Acessors for MachineFqdn + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.MachineFqdn { get => this._machineFqdn; set { {_machineFqdn = value;} } } + + /// Internal Acessors for NetworkProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfile Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.NetworkProfile { get => (this._networkProfile = this._networkProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.NetworkProfile()); set { {_networkProfile = value;} } } + + /// Internal Acessors for OSName + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.OSName { get => this._oSName; set { {_oSName = value;} } } + + /// Internal Acessors for OSProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.OSProfile { get => (this._oSProfile = this._oSProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfile()); set { {_oSProfile = value;} } } + + /// Internal Acessors for OSProfileComputerName + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.OSProfileComputerName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).ComputerName; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).ComputerName = value; } + + /// Internal Acessors for OSProfileLinuxConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.OSProfileLinuxConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).LinuxConfiguration; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).LinuxConfiguration = value; } + + /// Internal Acessors for OSProfileWindowsConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.OSProfileWindowsConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).WindowsConfiguration; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).WindowsConfiguration = value; } + + /// Internal Acessors for OSSku + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.OSSku { get => this._oSSku; set { {_oSSku = value;} } } + + /// Internal Acessors for OSVersion + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.OSVersion { get => this._oSVersion; set { {_oSVersion = value;} } } + + /// Internal Acessors for ProvisioningState + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Internal Acessors for ServiceStatuses + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatuses Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.ServiceStatuses { get => (this._serviceStatuses = this._serviceStatuses ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatuses()); set { {_serviceStatuses = value;} } } + + /// Internal Acessors for ServiceStatusesExtensionService + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.ServiceStatusesExtensionService { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)ServiceStatuses).ExtensionService; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)ServiceStatuses).ExtensionService = value; } + + /// Internal Acessors for ServiceStatusesGuestConfigurationService + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.ServiceStatusesGuestConfigurationService { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)ServiceStatuses).GuestConfigurationService; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)ServiceStatuses).GuestConfigurationService = value; } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.Status { get => this._status; set { {_status = value;} } } + + /// Internal Acessors for VMUuid + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.VMUuid { get => this._vMUuid; set { {_vMUuid = value;} } } + + /// Internal Acessors for WindowConfigurationPatchSetting + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachinePropertiesInternal.WindowConfigurationPatchSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).WindowConfigurationPatchSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).WindowConfigurationPatchSetting = value; } + + /// Backing field for property. + private string _mssqlDiscovered; + + /// Specifies whether any MS SQL instance is discovered on the machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string MssqlDiscovered { get => this._mssqlDiscovered; set => this._mssqlDiscovered = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfile _networkProfile; + + /// Information about the network the machine is on. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfile NetworkProfile { get => (this._networkProfile = this._networkProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.NetworkProfile()); } + + /// The list of network interfaces. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface[] NetworkProfileNetworkInterface { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfileInternal)NetworkProfile).NetworkInterface; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfileInternal)NetworkProfile).NetworkInterface = value ?? null /* arrayOf */; } + + /// Backing field for property. + private string _oSName; + + /// The Operating System running on the hybrid machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string OSName { get => this._oSName; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile _oSProfile; + + /// Specifies the operating system settings for the hybrid machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile OSProfile { get => (this._oSProfile = this._oSProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfile()); set => this._oSProfile = value; } + + /// Specifies the host OS name of the hybrid machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string OSProfileComputerName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).ComputerName; } + + /// Backing field for property. + private string _oSSku; + + /// Specifies the Operating System product SKU. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string OSSku { get => this._oSSku; } + + /// Backing field for property. + private string _oSType; + + /// The type of Operating System (windows/linux). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string OSType { get => this._oSType; set => this._oSType = value; } + + /// Backing field for property. + private string _oSVersion; + + /// The version of Operating System running on the hybrid machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string OSVersion { get => this._oSVersion; } + + /// Backing field for property. + private string _parentClusterResourceId; + + /// + /// The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ParentClusterResourceId { get => this._parentClusterResourceId; set => this._parentClusterResourceId = value; } + + /// Backing field for property. + private string _privateLinkScopeResourceId; + + /// The resource id of the private link scope this machine is assigned to, if any. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string PrivateLinkScopeResourceId { get => this._privateLinkScopeResourceId; set => this._privateLinkScopeResourceId = value; } + + /// Backing field for property. + private string _provisioningState; + + /// The provisioning state, which only appears in the response. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ProvisioningState { get => this._provisioningState; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatuses _serviceStatuses; + + /// Statuses of dependent services that are reported back to ARM. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatuses ServiceStatuses { get => (this._serviceStatuses = this._serviceStatuses ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatuses()); set => this._serviceStatuses = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes? _status; + + /// The status of the hybrid machine agent. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes? Status { get => this._status; } + + /// Backing field for property. + private string _vMId; + + /// Specifies the hybrid machine unique ID. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string VMId { get => this._vMId; set => this._vMId = value; } + + /// Backing field for property. + private string _vMUuid; + + /// Specifies the Arc Machine's unique SMBIOS ID + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string VMUuid { get => this._vMUuid; } + + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? WindowsConfigurationPatchSettingsAssessmentMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).WindowsConfigurationPatchSettingsAssessmentMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).WindowsConfigurationPatchSettingsAssessmentMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes)""); } + + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? WindowsConfigurationPatchSettingsPatchMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).WindowsConfigurationPatchSettingsPatchMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).WindowsConfigurationPatchSettingsPatchMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes)""); } + + /// Creates an new instance. + public MachineProperties() + { + + } + } + /// Describes the properties of a hybrid machine. + public partial interface IMachineProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Specifies the AD fully qualified display name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the AD fully qualified display name.", + SerializedName = @"adFqdn", + PossibleTypes = new [] { typeof(string) })] + string AdFqdn { get; } + /// + /// Name of configuration mode to use. Modes are pre-defined configurations of security controls, extension allowlists and + /// guest configuration, maintained by Microsoft. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Name of configuration mode to use. Modes are pre-defined configurations of security controls, extension allowlists and guest configuration, maintained by Microsoft.", + SerializedName = @"configMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode? AgentConfigurationConfigMode { get; } + /// Array of extensions that are allowed to be installed or updated. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Array of extensions that are allowed to be installed or updated.", + SerializedName = @"extensionsAllowList", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] AgentConfigurationExtensionsAllowList { get; } + /// Array of extensions that are blocked (cannot be installed or updated) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Array of extensions that are blocked (cannot be installed or updated)", + SerializedName = @"extensionsBlockList", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] AgentConfigurationExtensionsBlockList { get; } + /// Specifies whether the extension service is enabled or disabled. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies whether the extension service is enabled or disabled.", + SerializedName = @"extensionsEnabled", + PossibleTypes = new [] { typeof(string) })] + string AgentConfigurationExtensionsEnabled { get; } + /// Specified whether the guest configuration service is enabled or disabled. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specified whether the guest configuration service is enabled or disabled.", + SerializedName = @"guestConfigurationEnabled", + PossibleTypes = new [] { typeof(string) })] + string AgentConfigurationGuestConfigurationEnabled { get; } + /// Specifies the list of ports that the agent will be able to listen on. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the list of ports that the agent will be able to listen on.", + SerializedName = @"incomingConnectionsPorts", + PossibleTypes = new [] { typeof(string) })] + string[] AgentConfigurationIncomingConnectionsPort { get; } + /// List of service names which should not use the specified proxy server. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"List of service names which should not use the specified proxy server.", + SerializedName = @"proxyBypass", + PossibleTypes = new [] { typeof(string) })] + string[] AgentConfigurationProxyBypass { get; } + /// Specifies the URL of the proxy to be used. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the URL of the proxy to be used.", + SerializedName = @"proxyUrl", + PossibleTypes = new [] { typeof(string) })] + string AgentConfigurationProxyUrl { get; } + /// The correlation ID passed in from RSM per upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The correlation ID passed in from RSM per upgrade.", + SerializedName = @"correlationId", + PossibleTypes = new [] { typeof(string) })] + string AgentUpgradeCorrelationId { get; set; } + /// Specifies the version info w.r.t AgentUpgrade for the machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the version info w.r.t AgentUpgrade for the machine.", + SerializedName = @"desiredVersion", + PossibleTypes = new [] { typeof(string) })] + string AgentUpgradeDesiredVersion { get; set; } + /// Specifies if RSM should try to upgrade this machine + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies if RSM should try to upgrade this machine", + SerializedName = @"enableAutomaticUpgrade", + PossibleTypes = new [] { typeof(bool) })] + bool? AgentUpgradeEnableAutomaticUpgrade { get; set; } + /// Specifies the version of the last attempt + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the version of the last attempt", + SerializedName = @"lastAttemptDesiredVersion", + PossibleTypes = new [] { typeof(string) })] + string AgentUpgradeLastAttemptDesiredVersion { get; } + /// Failure message of last upgrade attempt if any. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Failure message of last upgrade attempt if any.", + SerializedName = @"lastAttemptMessage", + PossibleTypes = new [] { typeof(string) })] + string AgentUpgradeLastAttemptMessage { get; } + /// Specifies the status of Agent Upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the status of Agent Upgrade.", + SerializedName = @"lastAttemptStatus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum? AgentUpgradeLastAttemptStatus { get; } + /// Timestamp of last upgrade attempt + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Timestamp of last upgrade attempt", + SerializedName = @"lastAttemptTimestamp", + PossibleTypes = new [] { typeof(string) })] + string AgentUpgradeLastAttemptTimestamp { get; } + /// The hybrid machine agent full version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The hybrid machine agent full version.", + SerializedName = @"agentVersion", + PossibleTypes = new [] { typeof(string) })] + string AgentVersion { get; } + /// + /// Public Key that the client provides to be used during initial resource onboarding + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Public Key that the client provides to be used during initial resource onboarding", + SerializedName = @"clientPublicKey", + PossibleTypes = new [] { typeof(string) })] + string ClientPublicKey { get; set; } + /// Specifies the cloud provider (Azure/AWS/GCP...). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the cloud provider (Azure/AWS/GCP...).", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string CloudMetadataProvider { get; } + /// Detected properties from the machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Detected properties from the machine.", + SerializedName = @"detectedProperties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties DetectedProperty { get; } + /// Specifies the hybrid machine display name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the hybrid machine display name.", + SerializedName = @"displayName", + PossibleTypes = new [] { typeof(string) })] + string DisplayName { get; } + /// Specifies the DNS fully qualified display name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the DNS fully qualified display name.", + SerializedName = @"dnsFqdn", + PossibleTypes = new [] { typeof(string) })] + string DnsFqdn { get; } + /// Specifies the Windows domain name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the Windows domain name.", + SerializedName = @"domainName", + PossibleTypes = new [] { typeof(string) })] + string DomainName { get; } + /// Details about the error state. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Details about the error state.", + SerializedName = @"errorDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] ErrorDetail { get; } + /// Machine Extensions information (deprecated field) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Machine Extensions information (deprecated field)", + SerializedName = @"extensions", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView[] Extension { get; set; } + /// The behavior of the service when the Arc-enabled machine starts up. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The behavior of the service when the Arc-enabled machine starts up.", + SerializedName = @"startupType", + PossibleTypes = new [] { typeof(string) })] + string ExtensionServiceStartupType { get; set; } + /// The current status of the service. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The current status of the service.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + string ExtensionServiceStatus { get; set; } + /// The behavior of the service when the Arc-enabled machine starts up. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The behavior of the service when the Arc-enabled machine starts up.", + SerializedName = @"startupType", + PossibleTypes = new [] { typeof(string) })] + string GuestConfigurationServiceStartupType { get; set; } + /// The current status of the service. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The current status of the service.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + string GuestConfigurationServiceStatus { get; set; } + /// The time of the last status change. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The time of the last status change.", + SerializedName = @"lastStatusChange", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastStatusChange { get; } + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the assessment mode.", + SerializedName = @"assessmentMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? LinuxConfigurationPatchSettingsAssessmentMode { get; set; } + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the patch mode.", + SerializedName = @"patchMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? LinuxConfigurationPatchSettingsPatchMode { get; set; } + /// The city or locality where the resource is located. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The city or locality where the resource is located.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string LocationDataCity { get; set; } + /// The country or region where the resource is located + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The country or region where the resource is located", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + string LocationDataCountryOrRegion { get; set; } + /// The district, state, or province where the resource is located. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The district, state, or province where the resource is located.", + SerializedName = @"district", + PossibleTypes = new [] { typeof(string) })] + string LocationDataDistrict { get; set; } + /// A canonical name for the geographic or physical location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A canonical name for the geographic or physical location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string LocationDataName { get; set; } + /// Specifies the hybrid machine FQDN. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the hybrid machine FQDN.", + SerializedName = @"machineFqdn", + PossibleTypes = new [] { typeof(string) })] + string MachineFqdn { get; } + /// Specifies whether any MS SQL instance is discovered on the machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies whether any MS SQL instance is discovered on the machine.", + SerializedName = @"mssqlDiscovered", + PossibleTypes = new [] { typeof(string) })] + string MssqlDiscovered { get; set; } + /// The list of network interfaces. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of network interfaces.", + SerializedName = @"networkInterfaces", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface[] NetworkProfileNetworkInterface { get; set; } + /// The Operating System running on the hybrid machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Operating System running on the hybrid machine.", + SerializedName = @"osName", + PossibleTypes = new [] { typeof(string) })] + string OSName { get; } + /// Specifies the host OS name of the hybrid machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the host OS name of the hybrid machine.", + SerializedName = @"computerName", + PossibleTypes = new [] { typeof(string) })] + string OSProfileComputerName { get; } + /// Specifies the Operating System product SKU. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the Operating System product SKU.", + SerializedName = @"osSku", + PossibleTypes = new [] { typeof(string) })] + string OSSku { get; } + /// The type of Operating System (windows/linux). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of Operating System (windows/linux).", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; set; } + /// The version of Operating System running on the hybrid machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The version of Operating System running on the hybrid machine.", + SerializedName = @"osVersion", + PossibleTypes = new [] { typeof(string) })] + string OSVersion { get; } + /// + /// The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any.", + SerializedName = @"parentClusterResourceId", + PossibleTypes = new [] { typeof(string) })] + string ParentClusterResourceId { get; set; } + /// The resource id of the private link scope this machine is assigned to, if any. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource id of the private link scope this machine is assigned to, if any.", + SerializedName = @"privateLinkScopeResourceId", + PossibleTypes = new [] { typeof(string) })] + string PrivateLinkScopeResourceId { get; set; } + /// The provisioning state, which only appears in the response. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The provisioning state, which only appears in the response.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningState { get; } + /// The status of the hybrid machine agent. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The status of the hybrid machine agent.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes? Status { get; } + /// Specifies the hybrid machine unique ID. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the hybrid machine unique ID.", + SerializedName = @"vmId", + PossibleTypes = new [] { typeof(string) })] + string VMId { get; set; } + /// Specifies the Arc Machine's unique SMBIOS ID + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the Arc Machine's unique SMBIOS ID", + SerializedName = @"vmUuid", + PossibleTypes = new [] { typeof(string) })] + string VMUuid { get; } + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the assessment mode.", + SerializedName = @"assessmentMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? WindowsConfigurationPatchSettingsAssessmentMode { get; set; } + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the patch mode.", + SerializedName = @"patchMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? WindowsConfigurationPatchSettingsPatchMode { get; set; } + + } + /// Describes the properties of a hybrid machine. + internal partial interface IMachinePropertiesInternal + + { + /// Specifies the AD fully qualified display name. + string AdFqdn { get; set; } + /// + /// Configurable properties that the user can set locally via the azcmagent config command, or remotely via ARM. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentConfiguration AgentConfiguration { get; set; } + /// + /// Name of configuration mode to use. Modes are pre-defined configurations of security controls, extension allowlists and + /// guest configuration, maintained by Microsoft. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode? AgentConfigurationConfigMode { get; set; } + /// Array of extensions that are allowed to be installed or updated. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] AgentConfigurationExtensionsAllowList { get; set; } + /// Array of extensions that are blocked (cannot be installed or updated) + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IConfigurationExtension[] AgentConfigurationExtensionsBlockList { get; set; } + /// Specifies whether the extension service is enabled or disabled. + string AgentConfigurationExtensionsEnabled { get; set; } + /// Specified whether the guest configuration service is enabled or disabled. + string AgentConfigurationGuestConfigurationEnabled { get; set; } + /// Specifies the list of ports that the agent will be able to listen on. + string[] AgentConfigurationIncomingConnectionsPort { get; set; } + /// List of service names which should not use the specified proxy server. + string[] AgentConfigurationProxyBypass { get; set; } + /// Specifies the URL of the proxy to be used. + string AgentConfigurationProxyUrl { get; set; } + /// The info of the machine w.r.t Agent Upgrade + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade AgentUpgrade { get; set; } + /// The correlation ID passed in from RSM per upgrade. + string AgentUpgradeCorrelationId { get; set; } + /// Specifies the version info w.r.t AgentUpgrade for the machine. + string AgentUpgradeDesiredVersion { get; set; } + /// Specifies if RSM should try to upgrade this machine + bool? AgentUpgradeEnableAutomaticUpgrade { get; set; } + /// Specifies the version of the last attempt + string AgentUpgradeLastAttemptDesiredVersion { get; set; } + /// Failure message of last upgrade attempt if any. + string AgentUpgradeLastAttemptMessage { get; set; } + /// Specifies the status of Agent Upgrade. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum? AgentUpgradeLastAttemptStatus { get; set; } + /// Timestamp of last upgrade attempt + string AgentUpgradeLastAttemptTimestamp { get; set; } + /// The hybrid machine agent full version. + string AgentVersion { get; set; } + /// + /// Public Key that the client provides to be used during initial resource onboarding + /// + string ClientPublicKey { get; set; } + /// The metadata of the cloud environment (Azure/GCP/AWS/OCI...). + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata CloudMetadata { get; set; } + /// Specifies the cloud provider (Azure/AWS/GCP...). + string CloudMetadataProvider { get; set; } + /// Detected properties from the machine. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IDetectedProperties DetectedProperty { get; set; } + /// Specifies the hybrid machine display name. + string DisplayName { get; set; } + /// Specifies the DNS fully qualified display name. + string DnsFqdn { get; set; } + /// Specifies the Windows domain name. + string DomainName { get; set; } + /// Details about the error state. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] ErrorDetail { get; set; } + /// Machine Extensions information (deprecated field) + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView[] Extension { get; set; } + /// The behavior of the service when the Arc-enabled machine starts up. + string ExtensionServiceStartupType { get; set; } + /// The current status of the service. + string ExtensionServiceStatus { get; set; } + /// The behavior of the service when the Arc-enabled machine starts up. + string GuestConfigurationServiceStartupType { get; set; } + /// The current status of the service. + string GuestConfigurationServiceStatus { get; set; } + /// The time of the last status change. + global::System.DateTime? LastStatusChange { get; set; } + /// Specifies the patch settings. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings LinuxConfigurationPatchSetting { get; set; } + /// Specifies the assessment mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? LinuxConfigurationPatchSettingsAssessmentMode { get; set; } + /// Specifies the patch mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? LinuxConfigurationPatchSettingsPatchMode { get; set; } + /// Metadata pertaining to the geographic location of the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData LocationData { get; set; } + /// The city or locality where the resource is located. + string LocationDataCity { get; set; } + /// The country or region where the resource is located + string LocationDataCountryOrRegion { get; set; } + /// The district, state, or province where the resource is located. + string LocationDataDistrict { get; set; } + /// A canonical name for the geographic or physical location. + string LocationDataName { get; set; } + /// Specifies the hybrid machine FQDN. + string MachineFqdn { get; set; } + /// Specifies whether any MS SQL instance is discovered on the machine. + string MssqlDiscovered { get; set; } + /// Information about the network the machine is on. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfile NetworkProfile { get; set; } + /// The list of network interfaces. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface[] NetworkProfileNetworkInterface { get; set; } + /// The Operating System running on the hybrid machine. + string OSName { get; set; } + /// Specifies the operating system settings for the hybrid machine. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile OSProfile { get; set; } + /// Specifies the host OS name of the hybrid machine. + string OSProfileComputerName { get; set; } + /// Specifies the linux configuration for update management. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration OSProfileLinuxConfiguration { get; set; } + /// Specifies the windows configuration for update management. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration OSProfileWindowsConfiguration { get; set; } + /// Specifies the Operating System product SKU. + string OSSku { get; set; } + /// The type of Operating System (windows/linux). + string OSType { get; set; } + /// The version of Operating System running on the hybrid machine. + string OSVersion { get; set; } + /// + /// The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + /// + string ParentClusterResourceId { get; set; } + /// The resource id of the private link scope this machine is assigned to, if any. + string PrivateLinkScopeResourceId { get; set; } + /// The provisioning state, which only appears in the response. + string ProvisioningState { get; set; } + /// Statuses of dependent services that are reported back to ARM. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatuses ServiceStatuses { get; set; } + /// The state of the extension service on the Arc-enabled machine. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus ServiceStatusesExtensionService { get; set; } + /// The state of the guest configuration service on the Arc-enabled machine. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus ServiceStatusesGuestConfigurationService { get; set; } + /// The status of the hybrid machine agent. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes? Status { get; set; } + /// Specifies the hybrid machine unique ID. + string VMId { get; set; } + /// Specifies the Arc Machine's unique SMBIOS ID + string VMUuid { get; set; } + /// Specifies the patch settings. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings WindowConfigurationPatchSetting { get; set; } + /// Specifies the assessment mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? WindowsConfigurationPatchSettingsAssessmentMode { get; set; } + /// Specifies the patch mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? WindowsConfigurationPatchSettingsPatchMode { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineProperties.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineProperties.json.cs new file mode 100644 index 000000000000..0f6e4a4fe3f8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineProperties.json.cs @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the properties of a hybrid machine. + public partial class MachineProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MachineProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal MachineProperties(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_locationData = If( json?.PropertyT("locationData"), out var __jsonLocationData) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.LocationData.FromJson(__jsonLocationData) : LocationData;} + {_agentConfiguration = If( json?.PropertyT("agentConfiguration"), out var __jsonAgentConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentConfiguration.FromJson(__jsonAgentConfiguration) : AgentConfiguration;} + {_serviceStatuses = If( json?.PropertyT("serviceStatuses"), out var __jsonServiceStatuses) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatuses.FromJson(__jsonServiceStatuses) : ServiceStatuses;} + {_cloudMetadata = If( json?.PropertyT("cloudMetadata"), out var __jsonCloudMetadata) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.CloudMetadata.FromJson(__jsonCloudMetadata) : CloudMetadata;} + {_agentUpgrade = If( json?.PropertyT("agentUpgrade"), out var __jsonAgentUpgrade) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentUpgrade.FromJson(__jsonAgentUpgrade) : AgentUpgrade;} + {_oSProfile = If( json?.PropertyT("osProfile"), out var __jsonOSProfile) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfile.FromJson(__jsonOSProfile) : OSProfile;} + {_networkProfile = If( json?.PropertyT("networkProfile"), out var __jsonNetworkProfile) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.NetworkProfile.FromJson(__jsonNetworkProfile) : NetworkProfile;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)Status;} + {_lastStatusChange = If( json?.PropertyT("lastStatusChange"), out var __jsonLastStatusChange) ? global::System.DateTime.TryParse((string)__jsonLastStatusChange, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastStatusChangeValue) ? __jsonLastStatusChangeValue : LastStatusChange : LastStatusChange;} + {_errorDetail = If( json?.PropertyT("errorDetails"), out var __jsonErrorDetails) ? If( __jsonErrorDetails as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetail.FromJson(__u) )) ))() : null : ErrorDetail;} + {_agentVersion = If( json?.PropertyT("agentVersion"), out var __jsonAgentVersion) ? (string)__jsonAgentVersion : (string)AgentVersion;} + {_vMId = If( json?.PropertyT("vmId"), out var __jsonVMId) ? (string)__jsonVMId : (string)VMId;} + {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)DisplayName;} + {_machineFqdn = If( json?.PropertyT("machineFqdn"), out var __jsonMachineFqdn) ? (string)__jsonMachineFqdn : (string)MachineFqdn;} + {_clientPublicKey = If( json?.PropertyT("clientPublicKey"), out var __jsonClientPublicKey) ? (string)__jsonClientPublicKey : (string)ClientPublicKey;} + {_oSName = If( json?.PropertyT("osName"), out var __jsonOSName) ? (string)__jsonOSName : (string)OSName;} + {_oSVersion = If( json?.PropertyT("osVersion"), out var __jsonOSVersion) ? (string)__jsonOSVersion : (string)OSVersion;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + {_vMUuid = If( json?.PropertyT("vmUuid"), out var __jsonVMUuid) ? (string)__jsonVMUuid : (string)VMUuid;} + {_extension = If( json?.PropertyT("extensions"), out var __jsonExtensions) ? If( __jsonExtensions as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionInstanceView.FromJson(__p) )) ))() : null : Extension;} + {_oSSku = If( json?.PropertyT("osSku"), out var __jsonOSSku) ? (string)__jsonOSSku : (string)OSSku;} + {_domainName = If( json?.PropertyT("domainName"), out var __jsonDomainName) ? (string)__jsonDomainName : (string)DomainName;} + {_adFqdn = If( json?.PropertyT("adFqdn"), out var __jsonAdFqdn) ? (string)__jsonAdFqdn : (string)AdFqdn;} + {_dnsFqdn = If( json?.PropertyT("dnsFqdn"), out var __jsonDnsFqdn) ? (string)__jsonDnsFqdn : (string)DnsFqdn;} + {_privateLinkScopeResourceId = If( json?.PropertyT("privateLinkScopeResourceId"), out var __jsonPrivateLinkScopeResourceId) ? (string)__jsonPrivateLinkScopeResourceId : (string)PrivateLinkScopeResourceId;} + {_parentClusterResourceId = If( json?.PropertyT("parentClusterResourceId"), out var __jsonParentClusterResourceId) ? (string)__jsonParentClusterResourceId : (string)ParentClusterResourceId;} + {_mssqlDiscovered = If( json?.PropertyT("mssqlDiscovered"), out var __jsonMssqlDiscovered) ? (string)__jsonMssqlDiscovered : (string)MssqlDiscovered;} + {_detectedProperty = If( json?.PropertyT("detectedProperties"), out var __jsonDetectedProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.DetectedProperties.FromJson(__jsonDetectedProperties) : DetectedProperty;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._locationData ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._locationData.ToJson(null,serializationMode) : null, "locationData" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._agentConfiguration ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._agentConfiguration.ToJson(null,serializationMode) : null, "agentConfiguration" ,container.Add ); + } + AddIf( null != this._serviceStatuses ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._serviceStatuses.ToJson(null,serializationMode) : null, "serviceStatuses" ,container.Add ); + AddIf( null != this._cloudMetadata ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._cloudMetadata.ToJson(null,serializationMode) : null, "cloudMetadata" ,container.Add ); + AddIf( null != this._agentUpgrade ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._agentUpgrade.ToJson(null,serializationMode) : null, "agentUpgrade" ,container.Add ); + AddIf( null != this._oSProfile ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._oSProfile.ToJson(null,serializationMode) : null, "osProfile" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._networkProfile ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._networkProfile.ToJson(null,serializationMode) : null, "networkProfile" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastStatusChange ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._lastStatusChange?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastStatusChange" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._errorDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._errorDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("errorDetails",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._agentVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._agentVersion.ToString()) : null, "agentVersion" ,container.Add ); + } + AddIf( null != (((object)this._vMId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._vMId.ToString()) : null, "vmId" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._displayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._displayName.ToString()) : null, "displayName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._machineFqdn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._machineFqdn.ToString()) : null, "machineFqdn" ,container.Add ); + } + AddIf( null != (((object)this._clientPublicKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._clientPublicKey.ToString()) : null, "clientPublicKey" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._oSName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._oSName.ToString()) : null, "osName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._oSVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._oSVersion.ToString()) : null, "osVersion" ,container.Add ); + } + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._vMUuid)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._vMUuid.ToString()) : null, "vmUuid" ,container.Add ); + } + if (null != this._extension) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __s in this._extension ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("extensions",__r); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._oSSku)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._oSSku.ToString()) : null, "osSku" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._domainName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._domainName.ToString()) : null, "domainName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._adFqdn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._adFqdn.ToString()) : null, "adFqdn" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._dnsFqdn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._dnsFqdn.ToString()) : null, "dnsFqdn" ,container.Add ); + } + AddIf( null != (((object)this._privateLinkScopeResourceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._privateLinkScopeResourceId.ToString()) : null, "privateLinkScopeResourceId" ,container.Add ); + AddIf( null != (((object)this._parentClusterResourceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._parentClusterResourceId.ToString()) : null, "parentClusterResourceId" ,container.Add ); + AddIf( null != (((object)this._mssqlDiscovered)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._mssqlDiscovered.ToString()) : null, "mssqlDiscovered" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._detectedProperty ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._detectedProperty.ToJson(null,serializationMode) : null, "detectedProperties" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdate.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdate.PowerShell.cs new file mode 100644 index 000000000000..69d3c17f5503 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdate.PowerShell.cs @@ -0,0 +1,408 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes a hybrid machine Update. + [System.ComponentModel.TypeConverter(typeof(MachineUpdateTypeConverter))] + public partial class MachineUpdate + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MachineUpdate(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MachineUpdate(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MachineUpdate(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Identity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IdentityTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineUpdatePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Kind")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).Kind = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind?) content.GetValueForProperty("Kind",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).Kind, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind.CreateFrom); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ResourceUpdateTagsTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityPrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).IdentityPrincipalId = (string) content.GetValueForProperty("IdentityPrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).IdentityPrincipalId, global::System.Convert.ToString); + } + if (content.Contains("IdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).IdentityTenantId = (string) content.GetValueForProperty("IdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).IdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("LocationData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LocationData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData) content.GetValueForProperty("LocationData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LocationData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.LocationDataTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).OSProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile) content.GetValueForProperty("OSProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).OSProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileTypeConverter.ConvertFrom); + } + if (content.Contains("CloudMetadata")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).CloudMetadata = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata) content.GetValueForProperty("CloudMetadata",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).CloudMetadata, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.CloudMetadataTypeConverter.ConvertFrom); + } + if (content.Contains("AgentUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgrade = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade) content.GetValueForProperty("AgentUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgrade, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentUpgradeTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).IdentityType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType?) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).IdentityType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType.CreateFrom); + } + if (content.Contains("ParentClusterResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).ParentClusterResourceId = (string) content.GetValueForProperty("ParentClusterResourceId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).ParentClusterResourceId, global::System.Convert.ToString); + } + if (content.Contains("PrivateLinkScopeResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).PrivateLinkScopeResourceId = (string) content.GetValueForProperty("PrivateLinkScopeResourceId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).PrivateLinkScopeResourceId, global::System.Convert.ToString); + } + if (content.Contains("LocationDataName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LocationDataName = (string) content.GetValueForProperty("LocationDataName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LocationDataName, global::System.Convert.ToString); + } + if (content.Contains("LocationDataCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LocationDataCity = (string) content.GetValueForProperty("LocationDataCity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LocationDataCity, global::System.Convert.ToString); + } + if (content.Contains("LocationDataDistrict")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LocationDataDistrict = (string) content.GetValueForProperty("LocationDataDistrict",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LocationDataDistrict, global::System.Convert.ToString); + } + if (content.Contains("CloudMetadataProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).CloudMetadataProvider = (string) content.GetValueForProperty("CloudMetadataProvider",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).CloudMetadataProvider, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeDesiredVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeDesiredVersion = (string) content.GetValueForProperty("AgentUpgradeDesiredVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeDesiredVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeCorrelationId = (string) content.GetValueForProperty("AgentUpgradeCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeCorrelationId, global::System.Convert.ToString); + } + if (content.Contains("LocationDataCountryOrRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LocationDataCountryOrRegion = (string) content.GetValueForProperty("LocationDataCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LocationDataCountryOrRegion, global::System.Convert.ToString); + } + if (content.Contains("OSProfileWindowsConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).OSProfileWindowsConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration) content.GetValueForProperty("OSProfileWindowsConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).OSProfileWindowsConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileWindowsConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileLinuxConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).OSProfileLinuxConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration) content.GetValueForProperty("OSProfileLinuxConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).OSProfileLinuxConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileLinuxConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileComputerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).OSProfileComputerName = (string) content.GetValueForProperty("OSProfileComputerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).OSProfileComputerName, global::System.Convert.ToString); + } + if (content.Contains("WindowConfigurationPatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).WindowConfigurationPatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("WindowConfigurationPatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).WindowConfigurationPatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("LinuxConfigurationPatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LinuxConfigurationPatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("LinuxConfigurationPatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LinuxConfigurationPatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("AgentUpgradeEnableAutomaticUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeEnableAutomaticUpgrade = (bool?) content.GetValueForProperty("AgentUpgradeEnableAutomaticUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeEnableAutomaticUpgrade, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AgentUpgradeLastAttemptDesiredVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeLastAttemptDesiredVersion = (string) content.GetValueForProperty("AgentUpgradeLastAttemptDesiredVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeLastAttemptDesiredVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeLastAttemptTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeLastAttemptTimestamp = (string) content.GetValueForProperty("AgentUpgradeLastAttemptTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeLastAttemptTimestamp, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeLastAttemptStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeLastAttemptStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum?) content.GetValueForProperty("AgentUpgradeLastAttemptStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeLastAttemptStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum.CreateFrom); + } + if (content.Contains("AgentUpgradeLastAttemptMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeLastAttemptMessage = (string) content.GetValueForProperty("AgentUpgradeLastAttemptMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeLastAttemptMessage, global::System.Convert.ToString); + } + if (content.Contains("WindowsConfigurationPatchSettingsAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).WindowsConfigurationPatchSettingsAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("WindowsConfigurationPatchSettingsAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).WindowsConfigurationPatchSettingsAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("WindowsConfigurationPatchSettingsPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).WindowsConfigurationPatchSettingsPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("WindowsConfigurationPatchSettingsPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).WindowsConfigurationPatchSettingsPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + if (content.Contains("LinuxConfigurationPatchSettingsAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LinuxConfigurationPatchSettingsAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("LinuxConfigurationPatchSettingsAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LinuxConfigurationPatchSettingsAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("LinuxConfigurationPatchSettingsPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LinuxConfigurationPatchSettingsPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("LinuxConfigurationPatchSettingsPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LinuxConfigurationPatchSettingsPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MachineUpdate(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Identity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IdentityTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineUpdatePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Kind")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).Kind = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind?) content.GetValueForProperty("Kind",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).Kind, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind.CreateFrom); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ResourceUpdateTagsTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityPrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).IdentityPrincipalId = (string) content.GetValueForProperty("IdentityPrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).IdentityPrincipalId, global::System.Convert.ToString); + } + if (content.Contains("IdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).IdentityTenantId = (string) content.GetValueForProperty("IdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).IdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("LocationData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LocationData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData) content.GetValueForProperty("LocationData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LocationData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.LocationDataTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).OSProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile) content.GetValueForProperty("OSProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).OSProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileTypeConverter.ConvertFrom); + } + if (content.Contains("CloudMetadata")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).CloudMetadata = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata) content.GetValueForProperty("CloudMetadata",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).CloudMetadata, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.CloudMetadataTypeConverter.ConvertFrom); + } + if (content.Contains("AgentUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgrade = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade) content.GetValueForProperty("AgentUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgrade, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentUpgradeTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).IdentityType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType?) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).IdentityType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType.CreateFrom); + } + if (content.Contains("ParentClusterResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).ParentClusterResourceId = (string) content.GetValueForProperty("ParentClusterResourceId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).ParentClusterResourceId, global::System.Convert.ToString); + } + if (content.Contains("PrivateLinkScopeResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).PrivateLinkScopeResourceId = (string) content.GetValueForProperty("PrivateLinkScopeResourceId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).PrivateLinkScopeResourceId, global::System.Convert.ToString); + } + if (content.Contains("LocationDataName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LocationDataName = (string) content.GetValueForProperty("LocationDataName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LocationDataName, global::System.Convert.ToString); + } + if (content.Contains("LocationDataCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LocationDataCity = (string) content.GetValueForProperty("LocationDataCity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LocationDataCity, global::System.Convert.ToString); + } + if (content.Contains("LocationDataDistrict")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LocationDataDistrict = (string) content.GetValueForProperty("LocationDataDistrict",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LocationDataDistrict, global::System.Convert.ToString); + } + if (content.Contains("CloudMetadataProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).CloudMetadataProvider = (string) content.GetValueForProperty("CloudMetadataProvider",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).CloudMetadataProvider, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeDesiredVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeDesiredVersion = (string) content.GetValueForProperty("AgentUpgradeDesiredVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeDesiredVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeCorrelationId = (string) content.GetValueForProperty("AgentUpgradeCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeCorrelationId, global::System.Convert.ToString); + } + if (content.Contains("LocationDataCountryOrRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LocationDataCountryOrRegion = (string) content.GetValueForProperty("LocationDataCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LocationDataCountryOrRegion, global::System.Convert.ToString); + } + if (content.Contains("OSProfileWindowsConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).OSProfileWindowsConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration) content.GetValueForProperty("OSProfileWindowsConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).OSProfileWindowsConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileWindowsConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileLinuxConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).OSProfileLinuxConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration) content.GetValueForProperty("OSProfileLinuxConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).OSProfileLinuxConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileLinuxConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileComputerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).OSProfileComputerName = (string) content.GetValueForProperty("OSProfileComputerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).OSProfileComputerName, global::System.Convert.ToString); + } + if (content.Contains("WindowConfigurationPatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).WindowConfigurationPatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("WindowConfigurationPatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).WindowConfigurationPatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("LinuxConfigurationPatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LinuxConfigurationPatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("LinuxConfigurationPatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LinuxConfigurationPatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("AgentUpgradeEnableAutomaticUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeEnableAutomaticUpgrade = (bool?) content.GetValueForProperty("AgentUpgradeEnableAutomaticUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeEnableAutomaticUpgrade, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AgentUpgradeLastAttemptDesiredVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeLastAttemptDesiredVersion = (string) content.GetValueForProperty("AgentUpgradeLastAttemptDesiredVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeLastAttemptDesiredVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeLastAttemptTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeLastAttemptTimestamp = (string) content.GetValueForProperty("AgentUpgradeLastAttemptTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeLastAttemptTimestamp, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeLastAttemptStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeLastAttemptStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum?) content.GetValueForProperty("AgentUpgradeLastAttemptStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeLastAttemptStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum.CreateFrom); + } + if (content.Contains("AgentUpgradeLastAttemptMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeLastAttemptMessage = (string) content.GetValueForProperty("AgentUpgradeLastAttemptMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).AgentUpgradeLastAttemptMessage, global::System.Convert.ToString); + } + if (content.Contains("WindowsConfigurationPatchSettingsAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).WindowsConfigurationPatchSettingsAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("WindowsConfigurationPatchSettingsAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).WindowsConfigurationPatchSettingsAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("WindowsConfigurationPatchSettingsPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).WindowsConfigurationPatchSettingsPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("WindowsConfigurationPatchSettingsPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).WindowsConfigurationPatchSettingsPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + if (content.Contains("LinuxConfigurationPatchSettingsAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LinuxConfigurationPatchSettingsAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("LinuxConfigurationPatchSettingsAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LinuxConfigurationPatchSettingsAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("LinuxConfigurationPatchSettingsPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LinuxConfigurationPatchSettingsPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("LinuxConfigurationPatchSettingsPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal)this).LinuxConfigurationPatchSettingsPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes a hybrid machine Update. + [System.ComponentModel.TypeConverter(typeof(MachineUpdateTypeConverter))] + public partial interface IMachineUpdate + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdate.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdate.TypeConverter.cs new file mode 100644 index 000000000000..e95030406a39 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdate.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MachineUpdateTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdate ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdate).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MachineUpdate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MachineUpdate.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MachineUpdate.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdate.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdate.cs new file mode 100644 index 000000000000..dcf40ca43036 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdate.cs @@ -0,0 +1,482 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes a hybrid machine Update. + public partial class MachineUpdate : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdate, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdate __resourceUpdate = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ResourceUpdate(); + + /// The correlation ID passed in from RSM per upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentUpgradeCorrelationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).AgentUpgradeCorrelationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).AgentUpgradeCorrelationId = value ?? null; } + + /// Specifies the version info w.r.t AgentUpgrade for the machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentUpgradeDesiredVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).AgentUpgradeDesiredVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).AgentUpgradeDesiredVersion = value ?? null; } + + /// Specifies if RSM should try to upgrade this machine + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? AgentUpgradeEnableAutomaticUpgrade { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).AgentUpgradeEnableAutomaticUpgrade; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).AgentUpgradeEnableAutomaticUpgrade = value ?? default(bool); } + + /// Specifies the version of the last attempt + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentUpgradeLastAttemptDesiredVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).AgentUpgradeLastAttemptDesiredVersion; } + + /// Failure message of last upgrade attempt if any. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentUpgradeLastAttemptMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).AgentUpgradeLastAttemptMessage; } + + /// Specifies the status of Agent Upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum? AgentUpgradeLastAttemptStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).AgentUpgradeLastAttemptStatus; } + + /// Timestamp of last upgrade attempt + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentUpgradeLastAttemptTimestamp { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).AgentUpgradeLastAttemptTimestamp; } + + /// Specifies the cloud provider (Azure/AWS/GCP...). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string CloudMetadataProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).CloudMetadataProvider; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity _identity; + + /// Identity for the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity Identity { get => (this._identity = this._identity ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Identity()); set => this._identity = value; } + + /// The principal ID of resource identity. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentityPrincipalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).PrincipalId; } + + /// The tenant ID of resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).TenantId; } + + /// The identity type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).Type = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType)""); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind? _kind; + + /// + /// Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind? Kind { get => this._kind; set => this._kind = value; } + + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? LinuxConfigurationPatchSettingsAssessmentMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).LinuxConfigurationPatchSettingsAssessmentMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).LinuxConfigurationPatchSettingsAssessmentMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes)""); } + + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? LinuxConfigurationPatchSettingsPatchMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).LinuxConfigurationPatchSettingsPatchMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).LinuxConfigurationPatchSettingsPatchMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes)""); } + + /// The city or locality where the resource is located. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string LocationDataCity { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).LocationDataCity; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).LocationDataCity = value ?? null; } + + /// The country or region where the resource is located + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string LocationDataCountryOrRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).LocationDataCountryOrRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).LocationDataCountryOrRegion = value ?? null; } + + /// The district, state, or province where the resource is located. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string LocationDataDistrict { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).LocationDataDistrict; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).LocationDataDistrict = value ?? null; } + + /// A canonical name for the geographic or physical location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string LocationDataName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).LocationDataName; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).LocationDataName = value ?? null; } + + /// Internal Acessors for AgentUpgrade + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal.AgentUpgrade { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).AgentUpgrade; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).AgentUpgrade = value; } + + /// Internal Acessors for AgentUpgradeLastAttemptDesiredVersion + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal.AgentUpgradeLastAttemptDesiredVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).AgentUpgradeLastAttemptDesiredVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).AgentUpgradeLastAttemptDesiredVersion = value; } + + /// Internal Acessors for AgentUpgradeLastAttemptMessage + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal.AgentUpgradeLastAttemptMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).AgentUpgradeLastAttemptMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).AgentUpgradeLastAttemptMessage = value; } + + /// Internal Acessors for AgentUpgradeLastAttemptStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal.AgentUpgradeLastAttemptStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).AgentUpgradeLastAttemptStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).AgentUpgradeLastAttemptStatus = value; } + + /// Internal Acessors for AgentUpgradeLastAttemptTimestamp + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal.AgentUpgradeLastAttemptTimestamp { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).AgentUpgradeLastAttemptTimestamp; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).AgentUpgradeLastAttemptTimestamp = value; } + + /// Internal Acessors for CloudMetadata + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal.CloudMetadata { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).CloudMetadata; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).CloudMetadata = value; } + + /// Internal Acessors for CloudMetadataProvider + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal.CloudMetadataProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).CloudMetadataProvider; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).CloudMetadataProvider = value; } + + /// Internal Acessors for Identity + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal.Identity { get => (this._identity = this._identity ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Identity()); set { {_identity = value;} } } + + /// Internal Acessors for IdentityPrincipalId + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal.IdentityPrincipalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).PrincipalId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).PrincipalId = value; } + + /// Internal Acessors for IdentityTenantId + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal.IdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).TenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).TenantId = value; } + + /// Internal Acessors for LinuxConfigurationPatchSetting + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal.LinuxConfigurationPatchSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).LinuxConfigurationPatchSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).LinuxConfigurationPatchSetting = value; } + + /// Internal Acessors for LocationData + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal.LocationData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).LocationData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).LocationData = value; } + + /// Internal Acessors for OSProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal.OSProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).OSProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).OSProfile = value; } + + /// Internal Acessors for OSProfileComputerName + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal.OSProfileComputerName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).OSProfileComputerName; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).OSProfileComputerName = value; } + + /// Internal Acessors for OSProfileLinuxConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal.OSProfileLinuxConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).OSProfileLinuxConfiguration; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).OSProfileLinuxConfiguration = value; } + + /// Internal Acessors for OSProfileWindowsConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal.OSProfileWindowsConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).OSProfileWindowsConfiguration; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).OSProfileWindowsConfiguration = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineUpdateProperties()); set { {_property = value;} } } + + /// Internal Acessors for WindowConfigurationPatchSetting + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateInternal.WindowConfigurationPatchSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).WindowConfigurationPatchSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).WindowConfigurationPatchSetting = value; } + + /// Specifies the host OS name of the hybrid machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string OSProfileComputerName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).OSProfileComputerName; } + + /// + /// The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ParentClusterResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).ParentClusterResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).ParentClusterResourceId = value ?? null; } + + /// The resource id of the private link scope this machine is assigned to, if any. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string PrivateLinkScopeResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).PrivateLinkScopeResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).PrivateLinkScopeResourceId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateProperties _property; + + /// Hybrid Compute Machine properties + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineUpdateProperties()); set => this._property = value; } + + /// Resource tags + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateInternal)__resourceUpdate).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateInternal)__resourceUpdate).Tag = value ?? null /* model class */; } + + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? WindowsConfigurationPatchSettingsAssessmentMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).WindowsConfigurationPatchSettingsAssessmentMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).WindowsConfigurationPatchSettingsAssessmentMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes)""); } + + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? WindowsConfigurationPatchSettingsPatchMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).WindowsConfigurationPatchSettingsPatchMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)Property).WindowsConfigurationPatchSettingsPatchMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes)""); } + + /// Creates an new instance. + public MachineUpdate() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resourceUpdate), __resourceUpdate); + await eventListener.AssertObjectIsValid(nameof(__resourceUpdate), __resourceUpdate); + } + } + /// Describes a hybrid machine Update. + public partial interface IMachineUpdate : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdate + { + /// The correlation ID passed in from RSM per upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The correlation ID passed in from RSM per upgrade.", + SerializedName = @"correlationId", + PossibleTypes = new [] { typeof(string) })] + string AgentUpgradeCorrelationId { get; set; } + /// Specifies the version info w.r.t AgentUpgrade for the machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the version info w.r.t AgentUpgrade for the machine.", + SerializedName = @"desiredVersion", + PossibleTypes = new [] { typeof(string) })] + string AgentUpgradeDesiredVersion { get; set; } + /// Specifies if RSM should try to upgrade this machine + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies if RSM should try to upgrade this machine", + SerializedName = @"enableAutomaticUpgrade", + PossibleTypes = new [] { typeof(bool) })] + bool? AgentUpgradeEnableAutomaticUpgrade { get; set; } + /// Specifies the version of the last attempt + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the version of the last attempt", + SerializedName = @"lastAttemptDesiredVersion", + PossibleTypes = new [] { typeof(string) })] + string AgentUpgradeLastAttemptDesiredVersion { get; } + /// Failure message of last upgrade attempt if any. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Failure message of last upgrade attempt if any.", + SerializedName = @"lastAttemptMessage", + PossibleTypes = new [] { typeof(string) })] + string AgentUpgradeLastAttemptMessage { get; } + /// Specifies the status of Agent Upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the status of Agent Upgrade.", + SerializedName = @"lastAttemptStatus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum? AgentUpgradeLastAttemptStatus { get; } + /// Timestamp of last upgrade attempt + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Timestamp of last upgrade attempt", + SerializedName = @"lastAttemptTimestamp", + PossibleTypes = new [] { typeof(string) })] + string AgentUpgradeLastAttemptTimestamp { get; } + /// Specifies the cloud provider (Azure/AWS/GCP...). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the cloud provider (Azure/AWS/GCP...).", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string CloudMetadataProvider { get; } + /// The principal ID of resource identity. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The principal ID of resource identity.", + SerializedName = @"principalId", + PossibleTypes = new [] { typeof(string) })] + string IdentityPrincipalId { get; } + /// The tenant ID of resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The tenant ID of resource.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string IdentityTenantId { get; } + /// The identity type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identity type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get; set; } + /// + /// Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc.", + SerializedName = @"kind", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind? Kind { get; set; } + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the assessment mode.", + SerializedName = @"assessmentMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? LinuxConfigurationPatchSettingsAssessmentMode { get; set; } + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the patch mode.", + SerializedName = @"patchMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? LinuxConfigurationPatchSettingsPatchMode { get; set; } + /// The city or locality where the resource is located. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The city or locality where the resource is located.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string LocationDataCity { get; set; } + /// The country or region where the resource is located + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The country or region where the resource is located", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + string LocationDataCountryOrRegion { get; set; } + /// The district, state, or province where the resource is located. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The district, state, or province where the resource is located.", + SerializedName = @"district", + PossibleTypes = new [] { typeof(string) })] + string LocationDataDistrict { get; set; } + /// A canonical name for the geographic or physical location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A canonical name for the geographic or physical location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string LocationDataName { get; set; } + /// Specifies the host OS name of the hybrid machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the host OS name of the hybrid machine.", + SerializedName = @"computerName", + PossibleTypes = new [] { typeof(string) })] + string OSProfileComputerName { get; } + /// + /// The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any.", + SerializedName = @"parentClusterResourceId", + PossibleTypes = new [] { typeof(string) })] + string ParentClusterResourceId { get; set; } + /// The resource id of the private link scope this machine is assigned to, if any. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource id of the private link scope this machine is assigned to, if any.", + SerializedName = @"privateLinkScopeResourceId", + PossibleTypes = new [] { typeof(string) })] + string PrivateLinkScopeResourceId { get; set; } + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the assessment mode.", + SerializedName = @"assessmentMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? WindowsConfigurationPatchSettingsAssessmentMode { get; set; } + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the patch mode.", + SerializedName = @"patchMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? WindowsConfigurationPatchSettingsPatchMode { get; set; } + + } + /// Describes a hybrid machine Update. + internal partial interface IMachineUpdateInternal : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateInternal + { + /// The info of the machine w.r.t Agent Upgrade + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade AgentUpgrade { get; set; } + /// The correlation ID passed in from RSM per upgrade. + string AgentUpgradeCorrelationId { get; set; } + /// Specifies the version info w.r.t AgentUpgrade for the machine. + string AgentUpgradeDesiredVersion { get; set; } + /// Specifies if RSM should try to upgrade this machine + bool? AgentUpgradeEnableAutomaticUpgrade { get; set; } + /// Specifies the version of the last attempt + string AgentUpgradeLastAttemptDesiredVersion { get; set; } + /// Failure message of last upgrade attempt if any. + string AgentUpgradeLastAttemptMessage { get; set; } + /// Specifies the status of Agent Upgrade. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum? AgentUpgradeLastAttemptStatus { get; set; } + /// Timestamp of last upgrade attempt + string AgentUpgradeLastAttemptTimestamp { get; set; } + /// The metadata of the cloud environment (Azure/GCP/AWS/OCI...). + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata CloudMetadata { get; set; } + /// Specifies the cloud provider (Azure/AWS/GCP...). + string CloudMetadataProvider { get; set; } + /// Identity for the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity Identity { get; set; } + /// The principal ID of resource identity. + string IdentityPrincipalId { get; set; } + /// The tenant ID of resource. + string IdentityTenantId { get; set; } + /// The identity type. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get; set; } + /// + /// Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind? Kind { get; set; } + /// Specifies the patch settings. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings LinuxConfigurationPatchSetting { get; set; } + /// Specifies the assessment mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? LinuxConfigurationPatchSettingsAssessmentMode { get; set; } + /// Specifies the patch mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? LinuxConfigurationPatchSettingsPatchMode { get; set; } + /// Metadata pertaining to the geographic location of the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData LocationData { get; set; } + /// The city or locality where the resource is located. + string LocationDataCity { get; set; } + /// The country or region where the resource is located + string LocationDataCountryOrRegion { get; set; } + /// The district, state, or province where the resource is located. + string LocationDataDistrict { get; set; } + /// A canonical name for the geographic or physical location. + string LocationDataName { get; set; } + /// Specifies the operating system settings for the hybrid machine. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile OSProfile { get; set; } + /// Specifies the host OS name of the hybrid machine. + string OSProfileComputerName { get; set; } + /// Specifies the linux configuration for update management. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration OSProfileLinuxConfiguration { get; set; } + /// Specifies the windows configuration for update management. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration OSProfileWindowsConfiguration { get; set; } + /// + /// The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + /// + string ParentClusterResourceId { get; set; } + /// The resource id of the private link scope this machine is assigned to, if any. + string PrivateLinkScopeResourceId { get; set; } + /// Hybrid Compute Machine properties + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateProperties Property { get; set; } + /// Specifies the patch settings. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings WindowConfigurationPatchSetting { get; set; } + /// Specifies the assessment mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? WindowsConfigurationPatchSettingsAssessmentMode { get; set; } + /// Specifies the patch mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? WindowsConfigurationPatchSettingsPatchMode { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdate.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdate.json.cs new file mode 100644 index 000000000000..1bc349c4ea16 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdate.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes a hybrid machine Update. + public partial class MachineUpdate + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdate. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdate. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MachineUpdate(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal MachineUpdate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resourceUpdate = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ResourceUpdate(json); + {_identity = If( json?.PropertyT("identity"), out var __jsonIdentity) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Identity.FromJson(__jsonIdentity) : Identity;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineUpdateProperties.FromJson(__jsonProperties) : Property;} + {_kind = If( json?.PropertyT("kind"), out var __jsonKind) ? (string)__jsonKind : (string)Kind;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resourceUpdate?.ToJson(container, serializationMode); + AddIf( null != this._identity ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._identity.ToJson(null,serializationMode) : null, "identity" ,container.Add ); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != (((object)this._kind)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._kind.ToString()) : null, "kind" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdateProperties.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdateProperties.PowerShell.cs new file mode 100644 index 000000000000..9377338a5c87 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdateProperties.PowerShell.cs @@ -0,0 +1,354 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes the ARM updatable properties of a hybrid machine. + [System.ComponentModel.TypeConverter(typeof(MachineUpdatePropertiesTypeConverter))] + public partial class MachineUpdateProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MachineUpdateProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MachineUpdateProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MachineUpdateProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("LocationData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LocationData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData) content.GetValueForProperty("LocationData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LocationData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.LocationDataTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).OSProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile) content.GetValueForProperty("OSProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).OSProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileTypeConverter.ConvertFrom); + } + if (content.Contains("CloudMetadata")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).CloudMetadata = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata) content.GetValueForProperty("CloudMetadata",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).CloudMetadata, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.CloudMetadataTypeConverter.ConvertFrom); + } + if (content.Contains("AgentUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgrade = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade) content.GetValueForProperty("AgentUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgrade, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentUpgradeTypeConverter.ConvertFrom); + } + if (content.Contains("ParentClusterResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).ParentClusterResourceId = (string) content.GetValueForProperty("ParentClusterResourceId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).ParentClusterResourceId, global::System.Convert.ToString); + } + if (content.Contains("PrivateLinkScopeResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).PrivateLinkScopeResourceId = (string) content.GetValueForProperty("PrivateLinkScopeResourceId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).PrivateLinkScopeResourceId, global::System.Convert.ToString); + } + if (content.Contains("LocationDataName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LocationDataName = (string) content.GetValueForProperty("LocationDataName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LocationDataName, global::System.Convert.ToString); + } + if (content.Contains("LocationDataCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LocationDataCity = (string) content.GetValueForProperty("LocationDataCity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LocationDataCity, global::System.Convert.ToString); + } + if (content.Contains("LocationDataDistrict")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LocationDataDistrict = (string) content.GetValueForProperty("LocationDataDistrict",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LocationDataDistrict, global::System.Convert.ToString); + } + if (content.Contains("CloudMetadataProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).CloudMetadataProvider = (string) content.GetValueForProperty("CloudMetadataProvider",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).CloudMetadataProvider, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeDesiredVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeDesiredVersion = (string) content.GetValueForProperty("AgentUpgradeDesiredVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeDesiredVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeCorrelationId = (string) content.GetValueForProperty("AgentUpgradeCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeCorrelationId, global::System.Convert.ToString); + } + if (content.Contains("LocationDataCountryOrRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LocationDataCountryOrRegion = (string) content.GetValueForProperty("LocationDataCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LocationDataCountryOrRegion, global::System.Convert.ToString); + } + if (content.Contains("OSProfileWindowsConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).OSProfileWindowsConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration) content.GetValueForProperty("OSProfileWindowsConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).OSProfileWindowsConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileWindowsConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileLinuxConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).OSProfileLinuxConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration) content.GetValueForProperty("OSProfileLinuxConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).OSProfileLinuxConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileLinuxConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileComputerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).OSProfileComputerName = (string) content.GetValueForProperty("OSProfileComputerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).OSProfileComputerName, global::System.Convert.ToString); + } + if (content.Contains("WindowConfigurationPatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).WindowConfigurationPatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("WindowConfigurationPatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).WindowConfigurationPatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("LinuxConfigurationPatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LinuxConfigurationPatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("LinuxConfigurationPatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LinuxConfigurationPatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("AgentUpgradeEnableAutomaticUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeEnableAutomaticUpgrade = (bool?) content.GetValueForProperty("AgentUpgradeEnableAutomaticUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeEnableAutomaticUpgrade, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AgentUpgradeLastAttemptDesiredVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeLastAttemptDesiredVersion = (string) content.GetValueForProperty("AgentUpgradeLastAttemptDesiredVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeLastAttemptDesiredVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeLastAttemptTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeLastAttemptTimestamp = (string) content.GetValueForProperty("AgentUpgradeLastAttemptTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeLastAttemptTimestamp, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeLastAttemptStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeLastAttemptStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum?) content.GetValueForProperty("AgentUpgradeLastAttemptStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeLastAttemptStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum.CreateFrom); + } + if (content.Contains("AgentUpgradeLastAttemptMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeLastAttemptMessage = (string) content.GetValueForProperty("AgentUpgradeLastAttemptMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeLastAttemptMessage, global::System.Convert.ToString); + } + if (content.Contains("WindowsConfigurationPatchSettingsAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).WindowsConfigurationPatchSettingsAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("WindowsConfigurationPatchSettingsAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).WindowsConfigurationPatchSettingsAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("WindowsConfigurationPatchSettingsPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).WindowsConfigurationPatchSettingsPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("WindowsConfigurationPatchSettingsPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).WindowsConfigurationPatchSettingsPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + if (content.Contains("LinuxConfigurationPatchSettingsAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LinuxConfigurationPatchSettingsAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("LinuxConfigurationPatchSettingsAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LinuxConfigurationPatchSettingsAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("LinuxConfigurationPatchSettingsPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LinuxConfigurationPatchSettingsPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("LinuxConfigurationPatchSettingsPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LinuxConfigurationPatchSettingsPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MachineUpdateProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("LocationData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LocationData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData) content.GetValueForProperty("LocationData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LocationData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.LocationDataTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).OSProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile) content.GetValueForProperty("OSProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).OSProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileTypeConverter.ConvertFrom); + } + if (content.Contains("CloudMetadata")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).CloudMetadata = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata) content.GetValueForProperty("CloudMetadata",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).CloudMetadata, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.CloudMetadataTypeConverter.ConvertFrom); + } + if (content.Contains("AgentUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgrade = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade) content.GetValueForProperty("AgentUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgrade, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentUpgradeTypeConverter.ConvertFrom); + } + if (content.Contains("ParentClusterResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).ParentClusterResourceId = (string) content.GetValueForProperty("ParentClusterResourceId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).ParentClusterResourceId, global::System.Convert.ToString); + } + if (content.Contains("PrivateLinkScopeResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).PrivateLinkScopeResourceId = (string) content.GetValueForProperty("PrivateLinkScopeResourceId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).PrivateLinkScopeResourceId, global::System.Convert.ToString); + } + if (content.Contains("LocationDataName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LocationDataName = (string) content.GetValueForProperty("LocationDataName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LocationDataName, global::System.Convert.ToString); + } + if (content.Contains("LocationDataCity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LocationDataCity = (string) content.GetValueForProperty("LocationDataCity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LocationDataCity, global::System.Convert.ToString); + } + if (content.Contains("LocationDataDistrict")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LocationDataDistrict = (string) content.GetValueForProperty("LocationDataDistrict",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LocationDataDistrict, global::System.Convert.ToString); + } + if (content.Contains("CloudMetadataProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).CloudMetadataProvider = (string) content.GetValueForProperty("CloudMetadataProvider",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).CloudMetadataProvider, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeDesiredVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeDesiredVersion = (string) content.GetValueForProperty("AgentUpgradeDesiredVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeDesiredVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeCorrelationId = (string) content.GetValueForProperty("AgentUpgradeCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeCorrelationId, global::System.Convert.ToString); + } + if (content.Contains("LocationDataCountryOrRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LocationDataCountryOrRegion = (string) content.GetValueForProperty("LocationDataCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LocationDataCountryOrRegion, global::System.Convert.ToString); + } + if (content.Contains("OSProfileWindowsConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).OSProfileWindowsConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration) content.GetValueForProperty("OSProfileWindowsConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).OSProfileWindowsConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileWindowsConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileLinuxConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).OSProfileLinuxConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration) content.GetValueForProperty("OSProfileLinuxConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).OSProfileLinuxConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileLinuxConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileComputerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).OSProfileComputerName = (string) content.GetValueForProperty("OSProfileComputerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).OSProfileComputerName, global::System.Convert.ToString); + } + if (content.Contains("WindowConfigurationPatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).WindowConfigurationPatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("WindowConfigurationPatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).WindowConfigurationPatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("LinuxConfigurationPatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LinuxConfigurationPatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("LinuxConfigurationPatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LinuxConfigurationPatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("AgentUpgradeEnableAutomaticUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeEnableAutomaticUpgrade = (bool?) content.GetValueForProperty("AgentUpgradeEnableAutomaticUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeEnableAutomaticUpgrade, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AgentUpgradeLastAttemptDesiredVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeLastAttemptDesiredVersion = (string) content.GetValueForProperty("AgentUpgradeLastAttemptDesiredVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeLastAttemptDesiredVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeLastAttemptTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeLastAttemptTimestamp = (string) content.GetValueForProperty("AgentUpgradeLastAttemptTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeLastAttemptTimestamp, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeLastAttemptStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeLastAttemptStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum?) content.GetValueForProperty("AgentUpgradeLastAttemptStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeLastAttemptStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum.CreateFrom); + } + if (content.Contains("AgentUpgradeLastAttemptMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeLastAttemptMessage = (string) content.GetValueForProperty("AgentUpgradeLastAttemptMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).AgentUpgradeLastAttemptMessage, global::System.Convert.ToString); + } + if (content.Contains("WindowsConfigurationPatchSettingsAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).WindowsConfigurationPatchSettingsAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("WindowsConfigurationPatchSettingsAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).WindowsConfigurationPatchSettingsAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("WindowsConfigurationPatchSettingsPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).WindowsConfigurationPatchSettingsPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("WindowsConfigurationPatchSettingsPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).WindowsConfigurationPatchSettingsPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + if (content.Contains("LinuxConfigurationPatchSettingsAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LinuxConfigurationPatchSettingsAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("LinuxConfigurationPatchSettingsAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LinuxConfigurationPatchSettingsAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("LinuxConfigurationPatchSettingsPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LinuxConfigurationPatchSettingsPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("LinuxConfigurationPatchSettingsPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal)this).LinuxConfigurationPatchSettingsPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes the ARM updatable properties of a hybrid machine. + [System.ComponentModel.TypeConverter(typeof(MachineUpdatePropertiesTypeConverter))] + public partial interface IMachineUpdateProperties + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdateProperties.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdateProperties.TypeConverter.cs new file mode 100644 index 000000000000..e85c33a93aba --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdateProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MachineUpdatePropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MachineUpdateProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MachineUpdateProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MachineUpdateProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdateProperties.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdateProperties.cs new file mode 100644 index 000000000000..f2e72a4cd518 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdateProperties.cs @@ -0,0 +1,398 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the ARM updatable properties of a hybrid machine. + public partial class MachineUpdateProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateProperties, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade _agentUpgrade; + + /// The info of the machine w.r.t Agent Upgrade + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade AgentUpgrade { get => (this._agentUpgrade = this._agentUpgrade ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentUpgrade()); set => this._agentUpgrade = value; } + + /// The correlation ID passed in from RSM per upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentUpgradeCorrelationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).CorrelationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).CorrelationId = value ?? null; } + + /// Specifies the version info w.r.t AgentUpgrade for the machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentUpgradeDesiredVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).DesiredVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).DesiredVersion = value ?? null; } + + /// Specifies if RSM should try to upgrade this machine + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? AgentUpgradeEnableAutomaticUpgrade { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).EnableAutomaticUpgrade; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).EnableAutomaticUpgrade = value ?? default(bool); } + + /// Specifies the version of the last attempt + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentUpgradeLastAttemptDesiredVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptDesiredVersion; } + + /// Failure message of last upgrade attempt if any. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentUpgradeLastAttemptMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptMessage; } + + /// Specifies the status of Agent Upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum? AgentUpgradeLastAttemptStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptStatus; } + + /// Timestamp of last upgrade attempt + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AgentUpgradeLastAttemptTimestamp { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptTimestamp; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata _cloudMetadata; + + /// The metadata of the cloud environment (Azure/GCP/AWS/OCI...). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata CloudMetadata { get => (this._cloudMetadata = this._cloudMetadata ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.CloudMetadata()); set => this._cloudMetadata = value; } + + /// Specifies the cloud provider (Azure/AWS/GCP...). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string CloudMetadataProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadataInternal)CloudMetadata).Provider; } + + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? LinuxConfigurationPatchSettingsAssessmentMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).LinuxConfigurationPatchSettingsAssessmentMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).LinuxConfigurationPatchSettingsAssessmentMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes)""); } + + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? LinuxConfigurationPatchSettingsPatchMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).LinuxConfigurationPatchSettingsPatchMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).LinuxConfigurationPatchSettingsPatchMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes)""); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData _locationData; + + /// Metadata pertaining to the geographic location of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData LocationData { get => (this._locationData = this._locationData ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.LocationData()); set => this._locationData = value; } + + /// The city or locality where the resource is located. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string LocationDataCity { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)LocationData).City; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)LocationData).City = value ?? null; } + + /// The country or region where the resource is located + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string LocationDataCountryOrRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)LocationData).CountryOrRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)LocationData).CountryOrRegion = value ?? null; } + + /// The district, state, or province where the resource is located. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string LocationDataDistrict { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)LocationData).District; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)LocationData).District = value ?? null; } + + /// A canonical name for the geographic or physical location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string LocationDataName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)LocationData).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)LocationData).Name = value ?? null; } + + /// Internal Acessors for AgentUpgrade + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal.AgentUpgrade { get => (this._agentUpgrade = this._agentUpgrade ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentUpgrade()); set { {_agentUpgrade = value;} } } + + /// Internal Acessors for AgentUpgradeLastAttemptDesiredVersion + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal.AgentUpgradeLastAttemptDesiredVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptDesiredVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptDesiredVersion = value; } + + /// Internal Acessors for AgentUpgradeLastAttemptMessage + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal.AgentUpgradeLastAttemptMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptMessage = value; } + + /// Internal Acessors for AgentUpgradeLastAttemptStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal.AgentUpgradeLastAttemptStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptStatus = value; } + + /// Internal Acessors for AgentUpgradeLastAttemptTimestamp + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal.AgentUpgradeLastAttemptTimestamp { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptTimestamp; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgradeInternal)AgentUpgrade).LastAttemptTimestamp = value; } + + /// Internal Acessors for CloudMetadata + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal.CloudMetadata { get => (this._cloudMetadata = this._cloudMetadata ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.CloudMetadata()); set { {_cloudMetadata = value;} } } + + /// Internal Acessors for CloudMetadataProvider + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal.CloudMetadataProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadataInternal)CloudMetadata).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadataInternal)CloudMetadata).Provider = value; } + + /// Internal Acessors for LinuxConfigurationPatchSetting + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal.LinuxConfigurationPatchSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).LinuxConfigurationPatchSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).LinuxConfigurationPatchSetting = value; } + + /// Internal Acessors for LocationData + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal.LocationData { get => (this._locationData = this._locationData ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.LocationData()); set { {_locationData = value;} } } + + /// Internal Acessors for OSProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal.OSProfile { get => (this._oSProfile = this._oSProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfile()); set { {_oSProfile = value;} } } + + /// Internal Acessors for OSProfileComputerName + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal.OSProfileComputerName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).ComputerName; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).ComputerName = value; } + + /// Internal Acessors for OSProfileLinuxConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal.OSProfileLinuxConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).LinuxConfiguration; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).LinuxConfiguration = value; } + + /// Internal Acessors for OSProfileWindowsConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal.OSProfileWindowsConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).WindowsConfiguration; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).WindowsConfiguration = value; } + + /// Internal Acessors for WindowConfigurationPatchSetting + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdatePropertiesInternal.WindowConfigurationPatchSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).WindowConfigurationPatchSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).WindowConfigurationPatchSetting = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile _oSProfile; + + /// Specifies the operating system settings for the hybrid machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile OSProfile { get => (this._oSProfile = this._oSProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfile()); set => this._oSProfile = value; } + + /// Specifies the host OS name of the hybrid machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string OSProfileComputerName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).ComputerName; } + + /// Backing field for property. + private string _parentClusterResourceId; + + /// + /// The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ParentClusterResourceId { get => this._parentClusterResourceId; set => this._parentClusterResourceId = value; } + + /// Backing field for property. + private string _privateLinkScopeResourceId; + + /// The resource id of the private link scope this machine is assigned to, if any. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string PrivateLinkScopeResourceId { get => this._privateLinkScopeResourceId; set => this._privateLinkScopeResourceId = value; } + + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? WindowsConfigurationPatchSettingsAssessmentMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).WindowsConfigurationPatchSettingsAssessmentMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).WindowsConfigurationPatchSettingsAssessmentMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes)""); } + + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? WindowsConfigurationPatchSettingsPatchMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).WindowsConfigurationPatchSettingsPatchMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)OSProfile).WindowsConfigurationPatchSettingsPatchMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes)""); } + + /// Creates an new instance. + public MachineUpdateProperties() + { + + } + } + /// Describes the ARM updatable properties of a hybrid machine. + public partial interface IMachineUpdateProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The correlation ID passed in from RSM per upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The correlation ID passed in from RSM per upgrade.", + SerializedName = @"correlationId", + PossibleTypes = new [] { typeof(string) })] + string AgentUpgradeCorrelationId { get; set; } + /// Specifies the version info w.r.t AgentUpgrade for the machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the version info w.r.t AgentUpgrade for the machine.", + SerializedName = @"desiredVersion", + PossibleTypes = new [] { typeof(string) })] + string AgentUpgradeDesiredVersion { get; set; } + /// Specifies if RSM should try to upgrade this machine + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies if RSM should try to upgrade this machine", + SerializedName = @"enableAutomaticUpgrade", + PossibleTypes = new [] { typeof(bool) })] + bool? AgentUpgradeEnableAutomaticUpgrade { get; set; } + /// Specifies the version of the last attempt + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the version of the last attempt", + SerializedName = @"lastAttemptDesiredVersion", + PossibleTypes = new [] { typeof(string) })] + string AgentUpgradeLastAttemptDesiredVersion { get; } + /// Failure message of last upgrade attempt if any. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Failure message of last upgrade attempt if any.", + SerializedName = @"lastAttemptMessage", + PossibleTypes = new [] { typeof(string) })] + string AgentUpgradeLastAttemptMessage { get; } + /// Specifies the status of Agent Upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the status of Agent Upgrade.", + SerializedName = @"lastAttemptStatus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum? AgentUpgradeLastAttemptStatus { get; } + /// Timestamp of last upgrade attempt + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Timestamp of last upgrade attempt", + SerializedName = @"lastAttemptTimestamp", + PossibleTypes = new [] { typeof(string) })] + string AgentUpgradeLastAttemptTimestamp { get; } + /// Specifies the cloud provider (Azure/AWS/GCP...). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the cloud provider (Azure/AWS/GCP...).", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string CloudMetadataProvider { get; } + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the assessment mode.", + SerializedName = @"assessmentMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? LinuxConfigurationPatchSettingsAssessmentMode { get; set; } + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the patch mode.", + SerializedName = @"patchMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? LinuxConfigurationPatchSettingsPatchMode { get; set; } + /// The city or locality where the resource is located. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The city or locality where the resource is located.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string LocationDataCity { get; set; } + /// The country or region where the resource is located + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The country or region where the resource is located", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + string LocationDataCountryOrRegion { get; set; } + /// The district, state, or province where the resource is located. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The district, state, or province where the resource is located.", + SerializedName = @"district", + PossibleTypes = new [] { typeof(string) })] + string LocationDataDistrict { get; set; } + /// A canonical name for the geographic or physical location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A canonical name for the geographic or physical location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string LocationDataName { get; set; } + /// Specifies the host OS name of the hybrid machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the host OS name of the hybrid machine.", + SerializedName = @"computerName", + PossibleTypes = new [] { typeof(string) })] + string OSProfileComputerName { get; } + /// + /// The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any.", + SerializedName = @"parentClusterResourceId", + PossibleTypes = new [] { typeof(string) })] + string ParentClusterResourceId { get; set; } + /// The resource id of the private link scope this machine is assigned to, if any. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource id of the private link scope this machine is assigned to, if any.", + SerializedName = @"privateLinkScopeResourceId", + PossibleTypes = new [] { typeof(string) })] + string PrivateLinkScopeResourceId { get; set; } + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the assessment mode.", + SerializedName = @"assessmentMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? WindowsConfigurationPatchSettingsAssessmentMode { get; set; } + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the patch mode.", + SerializedName = @"patchMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? WindowsConfigurationPatchSettingsPatchMode { get; set; } + + } + /// Describes the ARM updatable properties of a hybrid machine. + internal partial interface IMachineUpdatePropertiesInternal + + { + /// The info of the machine w.r.t Agent Upgrade + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentUpgrade AgentUpgrade { get; set; } + /// The correlation ID passed in from RSM per upgrade. + string AgentUpgradeCorrelationId { get; set; } + /// Specifies the version info w.r.t AgentUpgrade for the machine. + string AgentUpgradeDesiredVersion { get; set; } + /// Specifies if RSM should try to upgrade this machine + bool? AgentUpgradeEnableAutomaticUpgrade { get; set; } + /// Specifies the version of the last attempt + string AgentUpgradeLastAttemptDesiredVersion { get; set; } + /// Failure message of last upgrade attempt if any. + string AgentUpgradeLastAttemptMessage { get; set; } + /// Specifies the status of Agent Upgrade. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum? AgentUpgradeLastAttemptStatus { get; set; } + /// Timestamp of last upgrade attempt + string AgentUpgradeLastAttemptTimestamp { get; set; } + /// The metadata of the cloud environment (Azure/GCP/AWS/OCI...). + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ICloudMetadata CloudMetadata { get; set; } + /// Specifies the cloud provider (Azure/AWS/GCP...). + string CloudMetadataProvider { get; set; } + /// Specifies the patch settings. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings LinuxConfigurationPatchSetting { get; set; } + /// Specifies the assessment mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? LinuxConfigurationPatchSettingsAssessmentMode { get; set; } + /// Specifies the patch mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? LinuxConfigurationPatchSettingsPatchMode { get; set; } + /// Metadata pertaining to the geographic location of the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData LocationData { get; set; } + /// The city or locality where the resource is located. + string LocationDataCity { get; set; } + /// The country or region where the resource is located + string LocationDataCountryOrRegion { get; set; } + /// The district, state, or province where the resource is located. + string LocationDataDistrict { get; set; } + /// A canonical name for the geographic or physical location. + string LocationDataName { get; set; } + /// Specifies the operating system settings for the hybrid machine. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile OSProfile { get; set; } + /// Specifies the host OS name of the hybrid machine. + string OSProfileComputerName { get; set; } + /// Specifies the linux configuration for update management. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration OSProfileLinuxConfiguration { get; set; } + /// Specifies the windows configuration for update management. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration OSProfileWindowsConfiguration { get; set; } + /// + /// The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + /// + string ParentClusterResourceId { get; set; } + /// The resource id of the private link scope this machine is assigned to, if any. + string PrivateLinkScopeResourceId { get; set; } + /// Specifies the patch settings. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings WindowConfigurationPatchSetting { get; set; } + /// Specifies the assessment mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? WindowsConfigurationPatchSettingsAssessmentMode { get; set; } + /// Specifies the patch mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? WindowsConfigurationPatchSettingsPatchMode { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdateProperties.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdateProperties.json.cs new file mode 100644 index 000000000000..ee7d71b0c7de --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/MachineUpdateProperties.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the ARM updatable properties of a hybrid machine. + public partial class MachineUpdateProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdateProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MachineUpdateProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal MachineUpdateProperties(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_locationData = If( json?.PropertyT("locationData"), out var __jsonLocationData) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.LocationData.FromJson(__jsonLocationData) : LocationData;} + {_oSProfile = If( json?.PropertyT("osProfile"), out var __jsonOSProfile) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfile.FromJson(__jsonOSProfile) : OSProfile;} + {_cloudMetadata = If( json?.PropertyT("cloudMetadata"), out var __jsonCloudMetadata) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.CloudMetadata.FromJson(__jsonCloudMetadata) : CloudMetadata;} + {_agentUpgrade = If( json?.PropertyT("agentUpgrade"), out var __jsonAgentUpgrade) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentUpgrade.FromJson(__jsonAgentUpgrade) : AgentUpgrade;} + {_parentClusterResourceId = If( json?.PropertyT("parentClusterResourceId"), out var __jsonParentClusterResourceId) ? (string)__jsonParentClusterResourceId : (string)ParentClusterResourceId;} + {_privateLinkScopeResourceId = If( json?.PropertyT("privateLinkScopeResourceId"), out var __jsonPrivateLinkScopeResourceId) ? (string)__jsonPrivateLinkScopeResourceId : (string)PrivateLinkScopeResourceId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._locationData ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._locationData.ToJson(null,serializationMode) : null, "locationData" ,container.Add ); + AddIf( null != this._oSProfile ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._oSProfile.ToJson(null,serializationMode) : null, "osProfile" ,container.Add ); + AddIf( null != this._cloudMetadata ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._cloudMetadata.ToJson(null,serializationMode) : null, "cloudMetadata" ,container.Add ); + AddIf( null != this._agentUpgrade ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._agentUpgrade.ToJson(null,serializationMode) : null, "agentUpgrade" ,container.Add ); + AddIf( null != (((object)this._parentClusterResourceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._parentClusterResourceId.ToString()) : null, "parentClusterResourceId" ,container.Add ); + AddIf( null != (((object)this._privateLinkScopeResourceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._privateLinkScopeResourceId.ToString()) : null, "privateLinkScopeResourceId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkInterface.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkInterface.PowerShell.cs new file mode 100644 index 000000000000..f22e1261da6c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkInterface.PowerShell.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes a network interface. + [System.ComponentModel.TypeConverter(typeof(NetworkInterfaceTypeConverter))] + public partial class NetworkInterface + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NetworkInterface(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NetworkInterface(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NetworkInterface(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterfaceInternal)this).IPAddress = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddress[]) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterfaceInternal)this).IPAddress, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPAddressTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NetworkInterface(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterfaceInternal)this).IPAddress = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddress[]) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterfaceInternal)this).IPAddress, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPAddressTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes a network interface. + [System.ComponentModel.TypeConverter(typeof(NetworkInterfaceTypeConverter))] + public partial interface INetworkInterface + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkInterface.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkInterface.TypeConverter.cs new file mode 100644 index 000000000000..f647fcccd2af --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkInterface.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NetworkInterfaceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NetworkInterface.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NetworkInterface.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NetworkInterface.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkInterface.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkInterface.cs new file mode 100644 index 000000000000..2e671040ebeb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkInterface.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes a network interface. + public partial class NetworkInterface : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterfaceInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddress[] _iPAddress; + + /// The list of IP addresses in this interface. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddress[] IPAddress { get => this._iPAddress; set => this._iPAddress = value; } + + /// Creates an new instance. + public NetworkInterface() + { + + } + } + /// Describes a network interface. + public partial interface INetworkInterface : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The list of IP addresses in this interface. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of IP addresses in this interface.", + SerializedName = @"ipAddresses", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddress) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddress[] IPAddress { get; set; } + + } + /// Describes a network interface. + internal partial interface INetworkInterfaceInternal + + { + /// The list of IP addresses in this interface. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddress[] IPAddress { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkInterface.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkInterface.json.cs new file mode 100644 index 000000000000..6e98ad03c580 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkInterface.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes a network interface. + public partial class NetworkInterface + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new NetworkInterface(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal NetworkInterface(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_iPAddress = If( json?.PropertyT("ipAddresses"), out var __jsonIPAddresses) ? If( __jsonIPAddresses as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IIPAddress) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPAddress.FromJson(__u) )) ))() : null : IPAddress;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._iPAddress) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._iPAddress ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("ipAddresses",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkProfile.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkProfile.PowerShell.cs new file mode 100644 index 000000000000..fa97a3a41d7a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkProfile.PowerShell.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes the network information on this machine. + [System.ComponentModel.TypeConverter(typeof(NetworkProfileTypeConverter))] + public partial class NetworkProfile + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfile DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NetworkProfile(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfile DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NetworkProfile(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfile FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NetworkProfile(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfileInternal)this).NetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface[]) content.GetValueForProperty("NetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfileInternal)this).NetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.NetworkInterfaceTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NetworkProfile(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfileInternal)this).NetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface[]) content.GetValueForProperty("NetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfileInternal)this).NetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.NetworkInterfaceTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes the network information on this machine. + [System.ComponentModel.TypeConverter(typeof(NetworkProfileTypeConverter))] + public partial interface INetworkProfile + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkProfile.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkProfile.TypeConverter.cs new file mode 100644 index 000000000000..312c4cb05459 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkProfile.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NetworkProfileTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfile ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfile).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NetworkProfile.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NetworkProfile.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NetworkProfile.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkProfile.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkProfile.cs new file mode 100644 index 000000000000..f4c95b360064 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkProfile.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the network information on this machine. + public partial class NetworkProfile : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfile, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfileInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface[] _networkInterface; + + /// The list of network interfaces. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface[] NetworkInterface { get => this._networkInterface; set => this._networkInterface = value; } + + /// Creates an new instance. + public NetworkProfile() + { + + } + } + /// Describes the network information on this machine. + public partial interface INetworkProfile : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The list of network interfaces. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of network interfaces.", + SerializedName = @"networkInterfaces", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface[] NetworkInterface { get; set; } + + } + /// Describes the network information on this machine. + internal partial interface INetworkProfileInternal + + { + /// The list of network interfaces. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface[] NetworkInterface { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkProfile.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkProfile.json.cs new file mode 100644 index 000000000000..44d218c13402 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/NetworkProfile.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the network information on this machine. + public partial class NetworkProfile + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfile. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfile. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfile FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new NetworkProfile(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal NetworkProfile(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_networkInterface = If( json?.PropertyT("networkInterfaces"), out var __jsonNetworkInterfaces) ? If( __jsonNetworkInterfaces as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.NetworkInterface.FromJson(__u) )) ))() : null : NetworkInterface;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._networkInterface) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._networkInterface ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("networkInterfaces",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfile.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfile.PowerShell.cs new file mode 100644 index 000000000000..ec80c0359632 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfile.PowerShell.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Specifies the operating system settings for the hybrid machine. + [System.ComponentModel.TypeConverter(typeof(OSProfileTypeConverter))] + public partial class OSProfile + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OSProfile(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OSProfile(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OSProfile(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("WindowsConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).WindowsConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration) content.GetValueForProperty("WindowsConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).WindowsConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileWindowsConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("LinuxConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).LinuxConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration) content.GetValueForProperty("LinuxConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).LinuxConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileLinuxConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("ComputerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).ComputerName = (string) content.GetValueForProperty("ComputerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).ComputerName, global::System.Convert.ToString); + } + if (content.Contains("WindowConfigurationPatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).WindowConfigurationPatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("WindowConfigurationPatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).WindowConfigurationPatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("LinuxConfigurationPatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).LinuxConfigurationPatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("LinuxConfigurationPatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).LinuxConfigurationPatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("WindowsConfigurationPatchSettingsAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).WindowsConfigurationPatchSettingsAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("WindowsConfigurationPatchSettingsAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).WindowsConfigurationPatchSettingsAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("WindowsConfigurationPatchSettingsPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).WindowsConfigurationPatchSettingsPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("WindowsConfigurationPatchSettingsPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).WindowsConfigurationPatchSettingsPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + if (content.Contains("LinuxConfigurationPatchSettingsAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).LinuxConfigurationPatchSettingsAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("LinuxConfigurationPatchSettingsAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).LinuxConfigurationPatchSettingsAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("LinuxConfigurationPatchSettingsPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).LinuxConfigurationPatchSettingsPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("LinuxConfigurationPatchSettingsPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).LinuxConfigurationPatchSettingsPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OSProfile(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("WindowsConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).WindowsConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration) content.GetValueForProperty("WindowsConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).WindowsConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileWindowsConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("LinuxConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).LinuxConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration) content.GetValueForProperty("LinuxConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).LinuxConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileLinuxConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("ComputerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).ComputerName = (string) content.GetValueForProperty("ComputerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).ComputerName, global::System.Convert.ToString); + } + if (content.Contains("WindowConfigurationPatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).WindowConfigurationPatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("WindowConfigurationPatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).WindowConfigurationPatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("LinuxConfigurationPatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).LinuxConfigurationPatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("LinuxConfigurationPatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).LinuxConfigurationPatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("WindowsConfigurationPatchSettingsAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).WindowsConfigurationPatchSettingsAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("WindowsConfigurationPatchSettingsAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).WindowsConfigurationPatchSettingsAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("WindowsConfigurationPatchSettingsPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).WindowsConfigurationPatchSettingsPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("WindowsConfigurationPatchSettingsPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).WindowsConfigurationPatchSettingsPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + if (content.Contains("LinuxConfigurationPatchSettingsAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).LinuxConfigurationPatchSettingsAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("LinuxConfigurationPatchSettingsAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).LinuxConfigurationPatchSettingsAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("LinuxConfigurationPatchSettingsPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).LinuxConfigurationPatchSettingsPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("LinuxConfigurationPatchSettingsPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal)this).LinuxConfigurationPatchSettingsPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Specifies the operating system settings for the hybrid machine. + [System.ComponentModel.TypeConverter(typeof(OSProfileTypeConverter))] + public partial interface IOSProfile + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfile.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfile.TypeConverter.cs new file mode 100644 index 000000000000..718bad0b9b58 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfile.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OSProfileTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OSProfile.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OSProfile.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OSProfile.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfile.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfile.cs new file mode 100644 index 000000000000..9dc1a90e020b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfile.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Specifies the operating system settings for the hybrid machine. + public partial class OSProfile : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal + { + + /// Backing field for property. + private string _computerName; + + /// Specifies the host OS name of the hybrid machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ComputerName { get => this._computerName; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration _linuxConfiguration; + + /// Specifies the linux configuration for update management. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration LinuxConfiguration { get => (this._linuxConfiguration = this._linuxConfiguration ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileLinuxConfiguration()); set => this._linuxConfiguration = value; } + + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? LinuxConfigurationPatchSettingsAssessmentMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfigurationInternal)LinuxConfiguration).PatchSettingAssessmentMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfigurationInternal)LinuxConfiguration).PatchSettingAssessmentMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes)""); } + + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? LinuxConfigurationPatchSettingsPatchMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfigurationInternal)LinuxConfiguration).PatchSettingPatchMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfigurationInternal)LinuxConfiguration).PatchSettingPatchMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes)""); } + + /// Internal Acessors for ComputerName + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal.ComputerName { get => this._computerName; set { {_computerName = value;} } } + + /// Internal Acessors for LinuxConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal.LinuxConfiguration { get => (this._linuxConfiguration = this._linuxConfiguration ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileLinuxConfiguration()); set { {_linuxConfiguration = value;} } } + + /// Internal Acessors for LinuxConfigurationPatchSetting + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal.LinuxConfigurationPatchSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfigurationInternal)LinuxConfiguration).PatchSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfigurationInternal)LinuxConfiguration).PatchSetting = value; } + + /// Internal Acessors for WindowConfigurationPatchSetting + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal.WindowConfigurationPatchSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfigurationInternal)WindowsConfiguration).PatchSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfigurationInternal)WindowsConfiguration).PatchSetting = value; } + + /// Internal Acessors for WindowsConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileInternal.WindowsConfiguration { get => (this._windowsConfiguration = this._windowsConfiguration ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileWindowsConfiguration()); set { {_windowsConfiguration = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration _windowsConfiguration; + + /// Specifies the windows configuration for update management. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration WindowsConfiguration { get => (this._windowsConfiguration = this._windowsConfiguration ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileWindowsConfiguration()); set => this._windowsConfiguration = value; } + + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? WindowsConfigurationPatchSettingsAssessmentMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfigurationInternal)WindowsConfiguration).PatchSettingAssessmentMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfigurationInternal)WindowsConfiguration).PatchSettingAssessmentMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes)""); } + + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? WindowsConfigurationPatchSettingsPatchMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfigurationInternal)WindowsConfiguration).PatchSettingPatchMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfigurationInternal)WindowsConfiguration).PatchSettingPatchMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes)""); } + + /// Creates an new instance. + public OSProfile() + { + + } + } + /// Specifies the operating system settings for the hybrid machine. + public partial interface IOSProfile : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Specifies the host OS name of the hybrid machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the host OS name of the hybrid machine.", + SerializedName = @"computerName", + PossibleTypes = new [] { typeof(string) })] + string ComputerName { get; } + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the assessment mode.", + SerializedName = @"assessmentMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? LinuxConfigurationPatchSettingsAssessmentMode { get; set; } + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the patch mode.", + SerializedName = @"patchMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? LinuxConfigurationPatchSettingsPatchMode { get; set; } + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the assessment mode.", + SerializedName = @"assessmentMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? WindowsConfigurationPatchSettingsAssessmentMode { get; set; } + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the patch mode.", + SerializedName = @"patchMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? WindowsConfigurationPatchSettingsPatchMode { get; set; } + + } + /// Specifies the operating system settings for the hybrid machine. + internal partial interface IOSProfileInternal + + { + /// Specifies the host OS name of the hybrid machine. + string ComputerName { get; set; } + /// Specifies the linux configuration for update management. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration LinuxConfiguration { get; set; } + /// Specifies the patch settings. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings LinuxConfigurationPatchSetting { get; set; } + /// Specifies the assessment mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? LinuxConfigurationPatchSettingsAssessmentMode { get; set; } + /// Specifies the patch mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? LinuxConfigurationPatchSettingsPatchMode { get; set; } + /// Specifies the patch settings. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings WindowConfigurationPatchSetting { get; set; } + /// Specifies the windows configuration for update management. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration WindowsConfiguration { get; set; } + /// Specifies the assessment mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? WindowsConfigurationPatchSettingsAssessmentMode { get; set; } + /// Specifies the patch mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? WindowsConfigurationPatchSettingsPatchMode { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfile.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfile.json.cs new file mode 100644 index 000000000000..0da694dbd83e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfile.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Specifies the operating system settings for the hybrid machine. + public partial class OSProfile + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfile FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new OSProfile(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal OSProfile(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_windowsConfiguration = If( json?.PropertyT("windowsConfiguration"), out var __jsonWindowsConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileWindowsConfiguration.FromJson(__jsonWindowsConfiguration) : WindowsConfiguration;} + {_linuxConfiguration = If( json?.PropertyT("linuxConfiguration"), out var __jsonLinuxConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OSProfileLinuxConfiguration.FromJson(__jsonLinuxConfiguration) : LinuxConfiguration;} + {_computerName = If( json?.PropertyT("computerName"), out var __jsonComputerName) ? (string)__jsonComputerName : (string)ComputerName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._windowsConfiguration ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._windowsConfiguration.ToJson(null,serializationMode) : null, "windowsConfiguration" ,container.Add ); + AddIf( null != this._linuxConfiguration ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._linuxConfiguration.ToJson(null,serializationMode) : null, "linuxConfiguration" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._computerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._computerName.ToString()) : null, "computerName" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileLinuxConfiguration.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileLinuxConfiguration.PowerShell.cs new file mode 100644 index 000000000000..65295c87c20b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileLinuxConfiguration.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Specifies the linux configuration for update management. + [System.ComponentModel.TypeConverter(typeof(OSProfileLinuxConfigurationTypeConverter))] + public partial class OSProfileLinuxConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OSProfileLinuxConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OSProfileLinuxConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OSProfileLinuxConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfigurationInternal)this).PatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("PatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfigurationInternal)this).PatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("PatchSettingAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfigurationInternal)this).PatchSettingAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("PatchSettingAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfigurationInternal)this).PatchSettingAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("PatchSettingPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfigurationInternal)this).PatchSettingPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("PatchSettingPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfigurationInternal)this).PatchSettingPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OSProfileLinuxConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfigurationInternal)this).PatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("PatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfigurationInternal)this).PatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("PatchSettingAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfigurationInternal)this).PatchSettingAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("PatchSettingAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfigurationInternal)this).PatchSettingAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("PatchSettingPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfigurationInternal)this).PatchSettingPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("PatchSettingPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfigurationInternal)this).PatchSettingPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Specifies the linux configuration for update management. + [System.ComponentModel.TypeConverter(typeof(OSProfileLinuxConfigurationTypeConverter))] + public partial interface IOSProfileLinuxConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileLinuxConfiguration.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileLinuxConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..ee148c6b7890 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileLinuxConfiguration.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OSProfileLinuxConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OSProfileLinuxConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OSProfileLinuxConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OSProfileLinuxConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileLinuxConfiguration.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileLinuxConfiguration.cs new file mode 100644 index 000000000000..a6b520261b8d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileLinuxConfiguration.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Specifies the linux configuration for update management. + public partial class OSProfileLinuxConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfigurationInternal + { + + /// Internal Acessors for PatchSetting + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfigurationInternal.PatchSetting { get => (this._patchSetting = this._patchSetting ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettings()); set { {_patchSetting = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings _patchSetting; + + /// Specifies the patch settings. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings PatchSetting { get => (this._patchSetting = this._patchSetting ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettings()); set => this._patchSetting = value; } + + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? PatchSettingAssessmentMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettingsInternal)PatchSetting).AssessmentMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettingsInternal)PatchSetting).AssessmentMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes)""); } + + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? PatchSettingPatchMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettingsInternal)PatchSetting).PatchMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettingsInternal)PatchSetting).PatchMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes)""); } + + /// Creates an new instance. + public OSProfileLinuxConfiguration() + { + + } + } + /// Specifies the linux configuration for update management. + public partial interface IOSProfileLinuxConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the assessment mode.", + SerializedName = @"assessmentMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? PatchSettingAssessmentMode { get; set; } + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the patch mode.", + SerializedName = @"patchMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? PatchSettingPatchMode { get; set; } + + } + /// Specifies the linux configuration for update management. + internal partial interface IOSProfileLinuxConfigurationInternal + + { + /// Specifies the patch settings. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings PatchSetting { get; set; } + /// Specifies the assessment mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? PatchSettingAssessmentMode { get; set; } + /// Specifies the patch mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? PatchSettingPatchMode { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileLinuxConfiguration.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileLinuxConfiguration.json.cs new file mode 100644 index 000000000000..62661f2985b8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileLinuxConfiguration.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Specifies the linux configuration for update management. + public partial class OSProfileLinuxConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileLinuxConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new OSProfileLinuxConfiguration(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal OSProfileLinuxConfiguration(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_patchSetting = If( json?.PropertyT("patchSettings"), out var __jsonPatchSettings) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettings.FromJson(__jsonPatchSettings) : PatchSetting;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._patchSetting ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._patchSetting.ToJson(null,serializationMode) : null, "patchSettings" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileWindowsConfiguration.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileWindowsConfiguration.PowerShell.cs new file mode 100644 index 000000000000..07b44f949d80 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileWindowsConfiguration.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Specifies the windows configuration for update management. + [System.ComponentModel.TypeConverter(typeof(OSProfileWindowsConfigurationTypeConverter))] + public partial class OSProfileWindowsConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OSProfileWindowsConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OSProfileWindowsConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OSProfileWindowsConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfigurationInternal)this).PatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("PatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfigurationInternal)this).PatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("PatchSettingAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfigurationInternal)this).PatchSettingAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("PatchSettingAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfigurationInternal)this).PatchSettingAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("PatchSettingPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfigurationInternal)this).PatchSettingPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("PatchSettingPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfigurationInternal)this).PatchSettingPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OSProfileWindowsConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PatchSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfigurationInternal)this).PatchSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings) content.GetValueForProperty("PatchSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfigurationInternal)this).PatchSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("PatchSettingAssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfigurationInternal)this).PatchSettingAssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("PatchSettingAssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfigurationInternal)this).PatchSettingAssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("PatchSettingPatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfigurationInternal)this).PatchSettingPatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("PatchSettingPatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfigurationInternal)this).PatchSettingPatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Specifies the windows configuration for update management. + [System.ComponentModel.TypeConverter(typeof(OSProfileWindowsConfigurationTypeConverter))] + public partial interface IOSProfileWindowsConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileWindowsConfiguration.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileWindowsConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..0afde9a4283d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileWindowsConfiguration.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OSProfileWindowsConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OSProfileWindowsConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OSProfileWindowsConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OSProfileWindowsConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileWindowsConfiguration.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileWindowsConfiguration.cs new file mode 100644 index 000000000000..ea62da69b2be --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileWindowsConfiguration.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Specifies the windows configuration for update management. + public partial class OSProfileWindowsConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfigurationInternal + { + + /// Internal Acessors for PatchSetting + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfigurationInternal.PatchSetting { get => (this._patchSetting = this._patchSetting ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettings()); set { {_patchSetting = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings _patchSetting; + + /// Specifies the patch settings. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings PatchSetting { get => (this._patchSetting = this._patchSetting ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettings()); set => this._patchSetting = value; } + + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? PatchSettingAssessmentMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettingsInternal)PatchSetting).AssessmentMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettingsInternal)PatchSetting).AssessmentMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes)""); } + + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? PatchSettingPatchMode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettingsInternal)PatchSetting).PatchMode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettingsInternal)PatchSetting).PatchMode = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes)""); } + + /// Creates an new instance. + public OSProfileWindowsConfiguration() + { + + } + } + /// Specifies the windows configuration for update management. + public partial interface IOSProfileWindowsConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the assessment mode.", + SerializedName = @"assessmentMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? PatchSettingAssessmentMode { get; set; } + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the patch mode.", + SerializedName = @"patchMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? PatchSettingPatchMode { get; set; } + + } + /// Specifies the windows configuration for update management. + internal partial interface IOSProfileWindowsConfigurationInternal + + { + /// Specifies the patch settings. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings PatchSetting { get; set; } + /// Specifies the assessment mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? PatchSettingAssessmentMode { get; set; } + /// Specifies the patch mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? PatchSettingPatchMode { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileWindowsConfiguration.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileWindowsConfiguration.json.cs new file mode 100644 index 000000000000..acc070c1e103 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OSProfileWindowsConfiguration.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Specifies the windows configuration for update management. + public partial class OSProfileWindowsConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOSProfileWindowsConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new OSProfileWindowsConfiguration(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal OSProfileWindowsConfiguration(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_patchSetting = If( json?.PropertyT("patchSettings"), out var __jsonPatchSettings) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.PatchSettings.FromJson(__jsonPatchSettings) : PatchSetting;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._patchSetting ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._patchSetting.ToJson(null,serializationMode) : null, "patchSettings" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationListResultAutoGenerated.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationListResultAutoGenerated.PowerShell.cs new file mode 100644 index 000000000000..5465a9a1fffc --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationListResultAutoGenerated.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The List Compute Operation operation response. + [System.ComponentModel.TypeConverter(typeof(OperationListResultAutoGeneratedTypeConverter))] + public partial class OperationListResultAutoGenerated + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationListResultAutoGenerated DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationListResultAutoGenerated(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationListResultAutoGenerated DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationListResultAutoGenerated(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationListResultAutoGenerated FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationListResultAutoGenerated(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationListResultAutoGeneratedInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationListResultAutoGeneratedInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OperationValueTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OperationListResultAutoGenerated(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationListResultAutoGeneratedInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationListResultAutoGeneratedInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OperationValueTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The List Compute Operation operation response. + [System.ComponentModel.TypeConverter(typeof(OperationListResultAutoGeneratedTypeConverter))] + public partial interface IOperationListResultAutoGenerated + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationListResultAutoGenerated.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationListResultAutoGenerated.TypeConverter.cs new file mode 100644 index 000000000000..bd462d159539 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationListResultAutoGenerated.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationListResultAutoGeneratedTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationListResultAutoGenerated ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationListResultAutoGenerated).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationListResultAutoGenerated.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationListResultAutoGenerated.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationListResultAutoGenerated.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationListResultAutoGenerated.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationListResultAutoGenerated.cs new file mode 100644 index 000000000000..cf60ff03efba --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationListResultAutoGenerated.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The List Compute Operation operation response. + public partial class OperationListResultAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationListResultAutoGenerated, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationListResultAutoGeneratedInternal + { + + /// Internal Acessors for Value + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationListResultAutoGeneratedInternal.Value { get => this._value; set { {_value = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue[] _value; + + /// The list of compute operations + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue[] Value { get => this._value; } + + /// Creates an new instance. + public OperationListResultAutoGenerated() + { + + } + } + /// The List Compute Operation operation response. + public partial interface IOperationListResultAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The list of compute operations + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of compute operations", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue[] Value { get; } + + } + /// The List Compute Operation operation response. + internal partial interface IOperationListResultAutoGeneratedInternal + + { + /// The list of compute operations + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationListResultAutoGenerated.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationListResultAutoGenerated.json.cs new file mode 100644 index 000000000000..ece4a4b08e99 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationListResultAutoGenerated.json.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The List Compute Operation operation response. + public partial class OperationListResultAutoGenerated + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationListResultAutoGenerated. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationListResultAutoGenerated. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationListResultAutoGenerated FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new OperationListResultAutoGenerated(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal OperationListResultAutoGenerated(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OperationValue.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValue.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValue.PowerShell.cs new file mode 100644 index 000000000000..a5b9dc1a4f34 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValue.PowerShell.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes the properties of a Compute Operation value. + [System.ComponentModel.TypeConverter(typeof(OperationValueTypeConverter))] + public partial class OperationValue + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationValue(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationValue(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationValue(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Display")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OperationValueDisplayTypeConverter.ConvertFrom); + } + if (content.Contains("Origin")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).Origin, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("IsDataAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DisplayOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).DisplayOperation, global::System.Convert.ToString); + } + if (content.Contains("DisplayResource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).DisplayResource, global::System.Convert.ToString); + } + if (content.Contains("DisplayDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).DisplayDescription, global::System.Convert.ToString); + } + if (content.Contains("DisplayProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).DisplayProvider, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OperationValue(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Display")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OperationValueDisplayTypeConverter.ConvertFrom); + } + if (content.Contains("Origin")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).Origin, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("IsDataAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DisplayOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).DisplayOperation, global::System.Convert.ToString); + } + if (content.Contains("DisplayResource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).DisplayResource, global::System.Convert.ToString); + } + if (content.Contains("DisplayDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).DisplayDescription, global::System.Convert.ToString); + } + if (content.Contains("DisplayProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal)this).DisplayProvider, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes the properties of a Compute Operation value. + [System.ComponentModel.TypeConverter(typeof(OperationValueTypeConverter))] + public partial interface IOperationValue + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValue.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValue.TypeConverter.cs new file mode 100644 index 000000000000..9e374ec1f8ce --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValue.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationValueTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationValue.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationValue.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationValue.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValue.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValue.cs new file mode 100644 index 000000000000..d33187205380 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValue.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the properties of a Compute Operation value. + public partial class OperationValue : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplay _display; + + /// Display properties + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplay Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OperationValueDisplay()); set => this._display = value; } + + /// The description of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)Display).Description; } + + /// The display name of the compute operation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)Display).Operation; } + + /// The resource provider for the operation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)Display).Provider; } + + /// The display name of the resource the operation applies to. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)Display).Resource; } + + /// Backing field for property. + private bool? _isDataAction; + + /// This property indicates if the operation is an action or a data action + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public bool? IsDataAction { get => this._isDataAction; } + + /// Internal Acessors for Display + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplay Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OperationValueDisplay()); set { {_display = value;} } } + + /// Internal Acessors for DisplayDescription + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal.DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)Display).Description = value; } + + /// Internal Acessors for DisplayOperation + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal.DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)Display).Operation = value; } + + /// Internal Acessors for DisplayProvider + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal.DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)Display).Provider = value; } + + /// Internal Acessors for DisplayResource + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal.DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)Display).Resource = value; } + + /// Internal Acessors for IsDataAction + bool? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal.IsDataAction { get => this._isDataAction; set { {_isDataAction = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Origin + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueInternal.Origin { get => this._origin; set { {_origin = value;} } } + + /// Backing field for property. + private string _name; + + /// The name of the compute operation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private string _origin; + + /// The origin of the compute operation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Origin { get => this._origin; } + + /// Creates an new instance. + public OperationValue() + { + + } + } + /// Describes the properties of a Compute Operation value. + public partial interface IOperationValue : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The description of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The description of the operation.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string DisplayDescription { get; } + /// The display name of the compute operation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The display name of the compute operation.", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + string DisplayOperation { get; } + /// The resource provider for the operation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The resource provider for the operation.", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string DisplayProvider { get; } + /// The display name of the resource the operation applies to. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The display name of the resource the operation applies to.", + SerializedName = @"resource", + PossibleTypes = new [] { typeof(string) })] + string DisplayResource { get; } + /// This property indicates if the operation is an action or a data action + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"This property indicates if the operation is an action or a data action", + SerializedName = @"isDataAction", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDataAction { get; } + /// The name of the compute operation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The name of the compute operation.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// The origin of the compute operation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The origin of the compute operation.", + SerializedName = @"origin", + PossibleTypes = new [] { typeof(string) })] + string Origin { get; } + + } + /// Describes the properties of a Compute Operation value. + internal partial interface IOperationValueInternal + + { + /// Display properties + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplay Display { get; set; } + /// The description of the operation. + string DisplayDescription { get; set; } + /// The display name of the compute operation. + string DisplayOperation { get; set; } + /// The resource provider for the operation. + string DisplayProvider { get; set; } + /// The display name of the resource the operation applies to. + string DisplayResource { get; set; } + /// This property indicates if the operation is an action or a data action + bool? IsDataAction { get; set; } + /// The name of the compute operation. + string Name { get; set; } + /// The origin of the compute operation. + string Origin { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValue.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValue.json.cs new file mode 100644 index 000000000000..c31c5cea928b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValue.json.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the properties of a Compute Operation value. + public partial class OperationValue + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new OperationValue(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal OperationValue(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_display = If( json?.PropertyT("display"), out var __jsonDisplay) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OperationValueDisplay.FromJson(__jsonDisplay) : Display;} + {_origin = If( json?.PropertyT("origin"), out var __jsonOrigin) ? (string)__jsonOrigin : (string)Origin;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_isDataAction = If( json?.PropertyT("isDataAction"), out var __jsonIsDataAction) ? (bool?)__jsonIsDataAction : IsDataAction;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._display ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._display.ToJson(null,serializationMode) : null, "display" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._origin)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._origin.ToString()) : null, "origin" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._isDataAction ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonBoolean((bool)this._isDataAction) : null, "isDataAction" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValueDisplay.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValueDisplay.PowerShell.cs new file mode 100644 index 000000000000..66c204310eb4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValueDisplay.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes the properties of a Hybrid Compute Operation Value Display. + [System.ComponentModel.TypeConverter(typeof(OperationValueDisplayTypeConverter))] + public partial class OperationValueDisplay + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplay DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationValueDisplay(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplay DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationValueDisplay(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplay FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationValueDisplay(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Operation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)this).Operation, global::System.Convert.ToString); + } + if (content.Contains("Resource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)this).Resource, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("Provider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)this).Provider, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OperationValueDisplay(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Operation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)this).Operation, global::System.Convert.ToString); + } + if (content.Contains("Resource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)this).Resource, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("Provider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal)this).Provider, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes the properties of a Hybrid Compute Operation Value Display. + [System.ComponentModel.TypeConverter(typeof(OperationValueDisplayTypeConverter))] + public partial interface IOperationValueDisplay + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValueDisplay.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValueDisplay.TypeConverter.cs new file mode 100644 index 000000000000..817ab2643f1d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValueDisplay.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationValueDisplayTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplay ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplay).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationValueDisplay.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationValueDisplay.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationValueDisplay.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValueDisplay.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValueDisplay.cs new file mode 100644 index 000000000000..c2f2e14bf693 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValueDisplay.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the properties of a Hybrid Compute Operation Value Display. + public partial class OperationValueDisplay : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplay, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal + { + + /// Backing field for property. + private string _description; + + /// The description of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Description { get => this._description; } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal.Description { get => this._description; set { {_description = value;} } } + + /// Internal Acessors for Operation + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal.Operation { get => this._operation; set { {_operation = value;} } } + + /// Internal Acessors for Provider + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal.Provider { get => this._provider; set { {_provider = value;} } } + + /// Internal Acessors for Resource + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplayInternal.Resource { get => this._resource; set { {_resource = value;} } } + + /// Backing field for property. + private string _operation; + + /// The display name of the compute operation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Operation { get => this._operation; } + + /// Backing field for property. + private string _provider; + + /// The resource provider for the operation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Provider { get => this._provider; } + + /// Backing field for property. + private string _resource; + + /// The display name of the resource the operation applies to. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Resource { get => this._resource; } + + /// Creates an new instance. + public OperationValueDisplay() + { + + } + } + /// Describes the properties of a Hybrid Compute Operation Value Display. + public partial interface IOperationValueDisplay : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The description of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The description of the operation.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string Description { get; } + /// The display name of the compute operation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The display name of the compute operation.", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + string Operation { get; } + /// The resource provider for the operation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The resource provider for the operation.", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string Provider { get; } + /// The display name of the resource the operation applies to. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The display name of the resource the operation applies to.", + SerializedName = @"resource", + PossibleTypes = new [] { typeof(string) })] + string Resource { get; } + + } + /// Describes the properties of a Hybrid Compute Operation Value Display. + internal partial interface IOperationValueDisplayInternal + + { + /// The description of the operation. + string Description { get; set; } + /// The display name of the compute operation. + string Operation { get; set; } + /// The resource provider for the operation. + string Provider { get; set; } + /// The display name of the resource the operation applies to. + string Resource { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValueDisplay.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValueDisplay.json.cs new file mode 100644 index 000000000000..41d1f4daa0e0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/OperationValueDisplay.json.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the properties of a Hybrid Compute Operation Value Display. + public partial class OperationValueDisplay + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplay. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplay. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValueDisplay FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new OperationValueDisplay(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal OperationValueDisplay(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_operation = If( json?.PropertyT("operation"), out var __jsonOperation) ? (string)__jsonOperation : (string)Operation;} + {_resource = If( json?.PropertyT("resource"), out var __jsonResource) ? (string)__jsonResource : (string)Resource;} + {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)Description;} + {_provider = If( json?.PropertyT("provider"), out var __jsonProvider) ? (string)__jsonProvider : (string)Provider;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._operation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._operation.ToString()) : null, "operation" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._resource)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._resource.ToString()) : null, "resource" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._description)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._description.ToString()) : null, "description" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provider)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._provider.ToString()) : null, "provider" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/PatchSettings.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/PatchSettings.PowerShell.cs new file mode 100644 index 000000000000..eed08573f131 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/PatchSettings.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Specifies the patch settings. + [System.ComponentModel.TypeConverter(typeof(PatchSettingsTypeConverter))] + public partial class PatchSettings + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PatchSettings(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PatchSettings(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PatchSettings(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettingsInternal)this).AssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("AssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettingsInternal)this).AssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("PatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettingsInternal)this).PatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("PatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettingsInternal)this).PatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PatchSettings(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AssessmentMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettingsInternal)this).AssessmentMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes?) content.GetValueForProperty("AssessmentMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettingsInternal)this).AssessmentMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes.CreateFrom); + } + if (content.Contains("PatchMode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettingsInternal)this).PatchMode = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes?) content.GetValueForProperty("PatchMode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettingsInternal)this).PatchMode, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Specifies the patch settings. + [System.ComponentModel.TypeConverter(typeof(PatchSettingsTypeConverter))] + public partial interface IPatchSettings + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/PatchSettings.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/PatchSettings.TypeConverter.cs new file mode 100644 index 000000000000..e937a3d29dbd --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/PatchSettings.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PatchSettingsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PatchSettings.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PatchSettings.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PatchSettings.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/PatchSettings.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/PatchSettings.cs new file mode 100644 index 000000000000..3f0b443d39db --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/PatchSettings.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Specifies the patch settings. + public partial class PatchSettings : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettingsInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? _assessmentMode; + + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? AssessmentMode { get => this._assessmentMode; set => this._assessmentMode = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? _patchMode; + + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? PatchMode { get => this._patchMode; set => this._patchMode = value; } + + /// Creates an new instance. + public PatchSettings() + { + + } + } + /// Specifies the patch settings. + public partial interface IPatchSettings : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Specifies the assessment mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the assessment mode.", + SerializedName = @"assessmentMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? AssessmentMode { get; set; } + /// Specifies the patch mode. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the patch mode.", + SerializedName = @"patchMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? PatchMode { get; set; } + + } + /// Specifies the patch settings. + internal partial interface IPatchSettingsInternal + + { + /// Specifies the assessment mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes? AssessmentMode { get; set; } + /// Specifies the patch mode. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes? PatchMode { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/PatchSettings.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/PatchSettings.json.cs new file mode 100644 index 000000000000..105bb7b9c5eb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/PatchSettings.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Specifies the patch settings. + public partial class PatchSettings + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IPatchSettings FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new PatchSettings(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal PatchSettings(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_assessmentMode = If( json?.PropertyT("assessmentMode"), out var __jsonAssessmentMode) ? (string)__jsonAssessmentMode : (string)AssessmentMode;} + {_patchMode = If( json?.PropertyT("patchMode"), out var __jsonPatchMode) ? (string)__jsonPatchMode : (string)PatchMode;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._assessmentMode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._assessmentMode.ToString()) : null, "assessmentMode" ,container.Add ); + AddIf( null != (((object)this._patchMode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._patchMode.ToString()) : null, "patchMode" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdate.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdate.PowerShell.cs new file mode 100644 index 000000000000..958ed83dc8d1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdate.PowerShell.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The Update Resource model definition. + [System.ComponentModel.TypeConverter(typeof(ResourceUpdateTypeConverter))] + public partial class ResourceUpdate + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResourceUpdate(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResourceUpdate(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResourceUpdate(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ResourceUpdateTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResourceUpdate(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ResourceUpdateTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The Update Resource model definition. + [System.ComponentModel.TypeConverter(typeof(ResourceUpdateTypeConverter))] + public partial interface IResourceUpdate + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdate.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdate.TypeConverter.cs new file mode 100644 index 000000000000..00c75dcecaa0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdate.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceUpdateTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdate ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdate).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResourceUpdate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResourceUpdate.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResourceUpdate.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdate.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdate.cs new file mode 100644 index 000000000000..7a8cfb7b3419 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdate.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The Update Resource model definition. + public partial class ResourceUpdate : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdate, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags _tag; + + /// Resource tags + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ResourceUpdateTags()); set => this._tag = value; } + + /// Creates an new instance. + public ResourceUpdate() + { + + } + } + /// The Update Resource model definition. + public partial interface IResourceUpdate : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Resource tags + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags Tag { get; set; } + + } + /// The Update Resource model definition. + internal partial interface IResourceUpdateInternal + + { + /// Resource tags + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdate.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdate.json.cs new file mode 100644 index 000000000000..49467026250f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdate.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The Update Resource model definition. + public partial class ResourceUpdate + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdate. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdate. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new ResourceUpdate(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal ResourceUpdate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ResourceUpdateTags.FromJson(__jsonTags) : Tag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdateTags.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdateTags.PowerShell.cs new file mode 100644 index 000000000000..1e918684ed6e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdateTags.PowerShell.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Resource tags + [System.ComponentModel.TypeConverter(typeof(ResourceUpdateTagsTypeConverter))] + public partial class ResourceUpdateTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResourceUpdateTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResourceUpdateTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResourceUpdateTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResourceUpdateTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Resource tags + [System.ComponentModel.TypeConverter(typeof(ResourceUpdateTagsTypeConverter))] + public partial interface IResourceUpdateTags + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdateTags.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdateTags.TypeConverter.cs new file mode 100644 index 000000000000..ffbabb65b430 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdateTags.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceUpdateTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResourceUpdateTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResourceUpdateTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResourceUpdateTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdateTags.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdateTags.cs new file mode 100644 index 000000000000..7e357ca4ed8d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdateTags.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Resource tags + public partial class ResourceUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTagsInternal + { + + /// Creates an new instance. + public ResourceUpdateTags() + { + + } + } + /// Resource tags + public partial interface IResourceUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + + } + /// Resource tags + internal partial interface IResourceUpdateTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdateTags.dictionary.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdateTags.dictionary.cs new file mode 100644 index 000000000000..99ea93524dfa --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdateTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class ResourceUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ResourceUpdateTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdateTags.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdateTags.json.cs new file mode 100644 index 000000000000..dbd4f1119452 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ResourceUpdateTags.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Resource tags + public partial class ResourceUpdateTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new ResourceUpdateTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + /// + internal ResourceUpdateTags(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatus.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatus.PowerShell.cs new file mode 100644 index 000000000000..e083485cd57a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatus.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes the status and behavior of a service. + [System.ComponentModel.TypeConverter(typeof(ServiceStatusTypeConverter))] + public partial class ServiceStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ServiceStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ServiceStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ServiceStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("StartupType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusInternal)this).StartupType = (string) content.GetValueForProperty("StartupType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusInternal)this).StartupType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ServiceStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("StartupType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusInternal)this).StartupType = (string) content.GetValueForProperty("StartupType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusInternal)this).StartupType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes the status and behavior of a service. + [System.ComponentModel.TypeConverter(typeof(ServiceStatusTypeConverter))] + public partial interface IServiceStatus + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatus.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatus.TypeConverter.cs new file mode 100644 index 000000000000..06f766b2fa43 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatus.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ServiceStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ServiceStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ServiceStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ServiceStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatus.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatus.cs new file mode 100644 index 000000000000..8f72ede676f2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatus.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the status and behavior of a service. + public partial class ServiceStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusInternal + { + + /// Backing field for property. + private string _startupType; + + /// The behavior of the service when the Arc-enabled machine starts up. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string StartupType { get => this._startupType; set => this._startupType = value; } + + /// Backing field for property. + private string _status; + + /// The current status of the service. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Status { get => this._status; set => this._status = value; } + + /// Creates an new instance. + public ServiceStatus() + { + + } + } + /// Describes the status and behavior of a service. + public partial interface IServiceStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The behavior of the service when the Arc-enabled machine starts up. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The behavior of the service when the Arc-enabled machine starts up.", + SerializedName = @"startupType", + PossibleTypes = new [] { typeof(string) })] + string StartupType { get; set; } + /// The current status of the service. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The current status of the service.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + string Status { get; set; } + + } + /// Describes the status and behavior of a service. + internal partial interface IServiceStatusInternal + + { + /// The behavior of the service when the Arc-enabled machine starts up. + string StartupType { get; set; } + /// The current status of the service. + string Status { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatus.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatus.json.cs new file mode 100644 index 000000000000..439695e42288 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatus.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the status and behavior of a service. + public partial class ServiceStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new ServiceStatus(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal ServiceStatus(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)Status;} + {_startupType = If( json?.PropertyT("startupType"), out var __jsonStartupType) ? (string)__jsonStartupType : (string)StartupType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + AddIf( null != (((object)this._startupType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._startupType.ToString()) : null, "startupType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatuses.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatuses.PowerShell.cs new file mode 100644 index 000000000000..f5450d97eab1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatuses.PowerShell.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Reports the state and behavior of dependent services. + [System.ComponentModel.TypeConverter(typeof(ServiceStatusesTypeConverter))] + public partial class ServiceStatuses + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatuses DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ServiceStatuses(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatuses DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ServiceStatuses(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatuses FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ServiceStatuses(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ExtensionService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).ExtensionService = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus) content.GetValueForProperty("ExtensionService",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).ExtensionService, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatusTypeConverter.ConvertFrom); + } + if (content.Contains("GuestConfigurationService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).GuestConfigurationService = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus) content.GetValueForProperty("GuestConfigurationService",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).GuestConfigurationService, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ExtensionServiceStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).ExtensionServiceStatus = (string) content.GetValueForProperty("ExtensionServiceStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).ExtensionServiceStatus, global::System.Convert.ToString); + } + if (content.Contains("ExtensionServiceStartupType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).ExtensionServiceStartupType = (string) content.GetValueForProperty("ExtensionServiceStartupType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).ExtensionServiceStartupType, global::System.Convert.ToString); + } + if (content.Contains("GuestConfigurationServiceStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).GuestConfigurationServiceStatus = (string) content.GetValueForProperty("GuestConfigurationServiceStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).GuestConfigurationServiceStatus, global::System.Convert.ToString); + } + if (content.Contains("GuestConfigurationServiceStartupType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).GuestConfigurationServiceStartupType = (string) content.GetValueForProperty("GuestConfigurationServiceStartupType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).GuestConfigurationServiceStartupType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ServiceStatuses(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ExtensionService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).ExtensionService = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus) content.GetValueForProperty("ExtensionService",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).ExtensionService, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatusTypeConverter.ConvertFrom); + } + if (content.Contains("GuestConfigurationService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).GuestConfigurationService = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus) content.GetValueForProperty("GuestConfigurationService",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).GuestConfigurationService, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ExtensionServiceStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).ExtensionServiceStatus = (string) content.GetValueForProperty("ExtensionServiceStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).ExtensionServiceStatus, global::System.Convert.ToString); + } + if (content.Contains("ExtensionServiceStartupType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).ExtensionServiceStartupType = (string) content.GetValueForProperty("ExtensionServiceStartupType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).ExtensionServiceStartupType, global::System.Convert.ToString); + } + if (content.Contains("GuestConfigurationServiceStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).GuestConfigurationServiceStatus = (string) content.GetValueForProperty("GuestConfigurationServiceStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).GuestConfigurationServiceStatus, global::System.Convert.ToString); + } + if (content.Contains("GuestConfigurationServiceStartupType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).GuestConfigurationServiceStartupType = (string) content.GetValueForProperty("GuestConfigurationServiceStartupType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal)this).GuestConfigurationServiceStartupType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Reports the state and behavior of dependent services. + [System.ComponentModel.TypeConverter(typeof(ServiceStatusesTypeConverter))] + public partial interface IServiceStatuses + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatuses.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatuses.TypeConverter.cs new file mode 100644 index 000000000000..a188fcfcc356 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatuses.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ServiceStatusesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatuses ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatuses).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ServiceStatuses.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ServiceStatuses.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ServiceStatuses.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatuses.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatuses.cs new file mode 100644 index 000000000000..1176da33e5ad --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatuses.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Reports the state and behavior of dependent services. + public partial class ServiceStatuses : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatuses, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus _extensionService; + + /// The state of the extension service on the Arc-enabled machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus ExtensionService { get => (this._extensionService = this._extensionService ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatus()); set => this._extensionService = value; } + + /// The behavior of the service when the Arc-enabled machine starts up. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ExtensionServiceStartupType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusInternal)ExtensionService).StartupType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusInternal)ExtensionService).StartupType = value ?? null; } + + /// The current status of the service. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ExtensionServiceStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusInternal)ExtensionService).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusInternal)ExtensionService).Status = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus _guestConfigurationService; + + /// The state of the guest configuration service on the Arc-enabled machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus GuestConfigurationService { get => (this._guestConfigurationService = this._guestConfigurationService ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatus()); set => this._guestConfigurationService = value; } + + /// The behavior of the service when the Arc-enabled machine starts up. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string GuestConfigurationServiceStartupType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusInternal)GuestConfigurationService).StartupType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusInternal)GuestConfigurationService).StartupType = value ?? null; } + + /// The current status of the service. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string GuestConfigurationServiceStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusInternal)GuestConfigurationService).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusInternal)GuestConfigurationService).Status = value ?? null; } + + /// Internal Acessors for ExtensionService + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal.ExtensionService { get => (this._extensionService = this._extensionService ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatus()); set { {_extensionService = value;} } } + + /// Internal Acessors for GuestConfigurationService + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatusesInternal.GuestConfigurationService { get => (this._guestConfigurationService = this._guestConfigurationService ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatus()); set { {_guestConfigurationService = value;} } } + + /// Creates an new instance. + public ServiceStatuses() + { + + } + } + /// Reports the state and behavior of dependent services. + public partial interface IServiceStatuses : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The behavior of the service when the Arc-enabled machine starts up. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The behavior of the service when the Arc-enabled machine starts up.", + SerializedName = @"startupType", + PossibleTypes = new [] { typeof(string) })] + string ExtensionServiceStartupType { get; set; } + /// The current status of the service. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The current status of the service.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + string ExtensionServiceStatus { get; set; } + /// The behavior of the service when the Arc-enabled machine starts up. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The behavior of the service when the Arc-enabled machine starts up.", + SerializedName = @"startupType", + PossibleTypes = new [] { typeof(string) })] + string GuestConfigurationServiceStartupType { get; set; } + /// The current status of the service. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The current status of the service.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + string GuestConfigurationServiceStatus { get; set; } + + } + /// Reports the state and behavior of dependent services. + internal partial interface IServiceStatusesInternal + + { + /// The state of the extension service on the Arc-enabled machine. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus ExtensionService { get; set; } + /// The behavior of the service when the Arc-enabled machine starts up. + string ExtensionServiceStartupType { get; set; } + /// The current status of the service. + string ExtensionServiceStatus { get; set; } + /// The state of the guest configuration service on the Arc-enabled machine. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatus GuestConfigurationService { get; set; } + /// The behavior of the service when the Arc-enabled machine starts up. + string GuestConfigurationServiceStartupType { get; set; } + /// The current status of the service. + string GuestConfigurationServiceStatus { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatuses.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatuses.json.cs new file mode 100644 index 000000000000..15fd7efb4806 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/ServiceStatuses.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Reports the state and behavior of dependent services. + public partial class ServiceStatuses + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatuses. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatuses. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IServiceStatuses FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new ServiceStatuses(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal ServiceStatuses(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_extensionService = If( json?.PropertyT("extensionService"), out var __jsonExtensionService) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatus.FromJson(__jsonExtensionService) : ExtensionService;} + {_guestConfigurationService = If( json?.PropertyT("guestConfigurationService"), out var __jsonGuestConfigurationService) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ServiceStatus.FromJson(__jsonGuestConfigurationService) : GuestConfigurationService;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._extensionService ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._extensionService.ToJson(null,serializationMode) : null, "extensionService" ,container.Add ); + AddIf( null != this._guestConfigurationService ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._guestConfigurationService.ToJson(null,serializationMode) : null, "guestConfigurationService" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/SubnetAutoGenerated.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/SubnetAutoGenerated.PowerShell.cs new file mode 100644 index 000000000000..447a8240eaff --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/SubnetAutoGenerated.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes the subnet. + [System.ComponentModel.TypeConverter(typeof(SubnetAutoGeneratedTypeConverter))] + public partial class SubnetAutoGenerated + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ISubnetAutoGenerated DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SubnetAutoGenerated(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ISubnetAutoGenerated DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SubnetAutoGenerated(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ISubnetAutoGenerated FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SubnetAutoGenerated(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AddressPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ISubnetAutoGeneratedInternal)this).AddressPrefix = (string) content.GetValueForProperty("AddressPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ISubnetAutoGeneratedInternal)this).AddressPrefix, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SubnetAutoGenerated(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AddressPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ISubnetAutoGeneratedInternal)this).AddressPrefix = (string) content.GetValueForProperty("AddressPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ISubnetAutoGeneratedInternal)this).AddressPrefix, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes the subnet. + [System.ComponentModel.TypeConverter(typeof(SubnetAutoGeneratedTypeConverter))] + public partial interface ISubnetAutoGenerated + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/SubnetAutoGenerated.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/SubnetAutoGenerated.TypeConverter.cs new file mode 100644 index 000000000000..c97148b4d78e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/SubnetAutoGenerated.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SubnetAutoGeneratedTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ISubnetAutoGenerated ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ISubnetAutoGenerated).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SubnetAutoGenerated.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SubnetAutoGenerated.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SubnetAutoGenerated.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/SubnetAutoGenerated.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/SubnetAutoGenerated.cs new file mode 100644 index 000000000000..86da0b570c9d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/SubnetAutoGenerated.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the subnet. + public partial class SubnetAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ISubnetAutoGenerated, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ISubnetAutoGeneratedInternal + { + + /// Backing field for property. + private string _addressPrefix; + + /// Represents address prefix. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string AddressPrefix { get => this._addressPrefix; set => this._addressPrefix = value; } + + /// Creates an new instance. + public SubnetAutoGenerated() + { + + } + } + /// Describes the subnet. + public partial interface ISubnetAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Represents address prefix. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Represents address prefix.", + SerializedName = @"addressPrefix", + PossibleTypes = new [] { typeof(string) })] + string AddressPrefix { get; set; } + + } + /// Describes the subnet. + internal partial interface ISubnetAutoGeneratedInternal + + { + /// Represents address prefix. + string AddressPrefix { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/SubnetAutoGenerated.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/SubnetAutoGenerated.json.cs new file mode 100644 index 000000000000..fb99bc525ac7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230315Preview/SubnetAutoGenerated.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the subnet. + public partial class SubnetAutoGenerated + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ISubnetAutoGenerated. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ISubnetAutoGenerated. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ISubnetAutoGenerated FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new SubnetAutoGenerated(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal SubnetAutoGenerated(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_addressPrefix = If( json?.PropertyT("addressPrefix"), out var __jsonAddressPrefix) ? (string)__jsonAddressPrefix : (string)AddressPrefix;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._addressPrefix)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._addressPrefix.ToString()) : null, "addressPrefix" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/ExtendedLocation.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/ExtendedLocation.PowerShell.cs new file mode 100644 index 000000000000..80150822ec73 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/ExtendedLocation.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The complex type of the extended location. + [System.ComponentModel.TypeConverter(typeof(ExtendedLocationTypeConverter))] + public partial class ExtendedLocation + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ExtendedLocation(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ExtendedLocation(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ExtendedLocation(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)this).Type = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes?) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)this).Type, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ExtendedLocation(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)this).Type = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes?) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)this).Type, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The complex type of the extended location. + [System.ComponentModel.TypeConverter(typeof(ExtendedLocationTypeConverter))] + public partial interface IExtendedLocation + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/ExtendedLocation.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/ExtendedLocation.TypeConverter.cs new file mode 100644 index 000000000000..b7ee28f6a134 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/ExtendedLocation.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ExtendedLocationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ExtendedLocation.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ExtendedLocation.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ExtendedLocation.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/ExtendedLocation.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/ExtendedLocation.cs new file mode 100644 index 000000000000..ec361dec9e7d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/ExtendedLocation.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The complex type of the extended location. + public partial class ExtendedLocation : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal + { + + /// Backing field for property. + private string _name; + + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? _type; + + /// The type of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? Type { get => this._type; set => this._type = value; } + + /// Creates an new instance. + public ExtendedLocation() + { + + } + } + /// The complex type of the extended location. + public partial interface IExtendedLocation : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// The type of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the extended location.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? Type { get; set; } + + } + /// The complex type of the extended location. + internal partial interface IExtendedLocationInternal + + { + /// The name of the extended location. + string Name { get; set; } + /// The type of the extended location. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/ExtendedLocation.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/ExtendedLocation.json.cs new file mode 100644 index 000000000000..8746bdfa78f1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/ExtendedLocation.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The complex type of the extended location. + public partial class ExtendedLocation + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal ExtendedLocation(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new ExtendedLocation(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryDiskImage.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryDiskImage.PowerShell.cs new file mode 100644 index 000000000000..f292862f1e0d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryDiskImage.PowerShell.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// This is the disk image base class. + [System.ComponentModel.TypeConverter(typeof(GalleryDiskImageTypeConverter))] + public partial class GalleryDiskImage + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GalleryDiskImage(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GalleryDiskImage(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GalleryDiskImage(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImageInternal)this).SizeInMb = (long?) content.GetValueForProperty("SizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImageInternal)this).SizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GalleryDiskImage(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImageInternal)this).SizeInMb = (long?) content.GetValueForProperty("SizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImageInternal)this).SizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This is the disk image base class. + [System.ComponentModel.TypeConverter(typeof(GalleryDiskImageTypeConverter))] + public partial interface IGalleryDiskImage + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryDiskImage.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryDiskImage.TypeConverter.cs new file mode 100644 index 000000000000..249a89d4e91f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryDiskImage.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GalleryDiskImageTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GalleryDiskImage.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GalleryDiskImage.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GalleryDiskImage.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryDiskImage.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryDiskImage.cs new file mode 100644 index 000000000000..fd8e3744d52e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryDiskImage.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// This is the disk image base class. + public partial class GalleryDiskImage : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImageInternal + { + + /// Internal Acessors for SizeInMb + long? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImageInternal.SizeInMb { get => this._sizeInMb; set { {_sizeInMb = value;} } } + + /// Backing field for property. + private long? _sizeInMb; + + /// This property indicates the size of the VHD to be created. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public long? SizeInMb { get => this._sizeInMb; } + + /// Creates an new instance. + public GalleryDiskImage() + { + + } + } + /// This is the disk image base class. + public partial interface IGalleryDiskImage : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// This property indicates the size of the VHD to be created. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"This property indicates the size of the VHD to be created.", + SerializedName = @"sizeInMB", + PossibleTypes = new [] { typeof(long) })] + long? SizeInMb { get; } + + } + /// This is the disk image base class. + internal partial interface IGalleryDiskImageInternal + + { + /// This property indicates the size of the VHD to be created. + long? SizeInMb { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryDiskImage.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryDiskImage.json.cs new file mode 100644 index 000000000000..958dffff0553 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryDiskImage.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// This is the disk image base class. + public partial class GalleryDiskImage + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new GalleryDiskImage(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal GalleryDiskImage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_sizeInMb = If( json?.PropertyT("sizeInMB"), out var __jsonSizeInMb) ? (long?)__jsonSizeInMb : SizeInMb;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._sizeInMb ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNumber((long)this._sizeInMb) : null, "sizeInMB" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageIdentifier.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageIdentifier.PowerShell.cs new file mode 100644 index 000000000000..ff4cd2ffe573 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageIdentifier.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// This is the gallery image definition identifier. + [System.ComponentModel.TypeConverter(typeof(GalleryImageIdentifierTypeConverter))] + public partial class GalleryImageIdentifier + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GalleryImageIdentifier(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GalleryImageIdentifier(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GalleryImageIdentifier(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Publisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)this).Publisher = (string) content.GetValueForProperty("Publisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)this).Publisher, global::System.Convert.ToString); + } + if (content.Contains("Offer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)this).Offer = (string) content.GetValueForProperty("Offer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)this).Offer, global::System.Convert.ToString); + } + if (content.Contains("Sku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)this).Sku = (string) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)this).Sku, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GalleryImageIdentifier(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Publisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)this).Publisher = (string) content.GetValueForProperty("Publisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)this).Publisher, global::System.Convert.ToString); + } + if (content.Contains("Offer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)this).Offer = (string) content.GetValueForProperty("Offer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)this).Offer, global::System.Convert.ToString); + } + if (content.Contains("Sku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)this).Sku = (string) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)this).Sku, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This is the gallery image definition identifier. + [System.ComponentModel.TypeConverter(typeof(GalleryImageIdentifierTypeConverter))] + public partial interface IGalleryImageIdentifier + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageIdentifier.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageIdentifier.TypeConverter.cs new file mode 100644 index 000000000000..49b7ba42f8d6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageIdentifier.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GalleryImageIdentifierTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GalleryImageIdentifier.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GalleryImageIdentifier.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GalleryImageIdentifier.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageIdentifier.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageIdentifier.cs new file mode 100644 index 000000000000..a8cdc308c555 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageIdentifier.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// This is the gallery image definition identifier. + public partial class GalleryImageIdentifier : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal + { + + /// Backing field for property. + private string _offer; + + /// The name of the gallery image definition offer. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Offer { get => this._offer; set => this._offer = value; } + + /// Backing field for property. + private string _publisher; + + /// The name of the gallery image definition publisher. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Publisher { get => this._publisher; set => this._publisher = value; } + + /// Backing field for property. + private string _sku; + + /// The name of the gallery image definition SKU. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Sku { get => this._sku; set => this._sku = value; } + + /// Creates an new instance. + public GalleryImageIdentifier() + { + + } + } + /// This is the gallery image definition identifier. + public partial interface IGalleryImageIdentifier : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The name of the gallery image definition offer. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the gallery image definition offer.", + SerializedName = @"offer", + PossibleTypes = new [] { typeof(string) })] + string Offer { get; set; } + /// The name of the gallery image definition publisher. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the gallery image definition publisher.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + string Publisher { get; set; } + /// The name of the gallery image definition SKU. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the gallery image definition SKU.", + SerializedName = @"sku", + PossibleTypes = new [] { typeof(string) })] + string Sku { get; set; } + + } + /// This is the gallery image definition identifier. + internal partial interface IGalleryImageIdentifierInternal + + { + /// The name of the gallery image definition offer. + string Offer { get; set; } + /// The name of the gallery image definition publisher. + string Publisher { get; set; } + /// The name of the gallery image definition SKU. + string Sku { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageIdentifier.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageIdentifier.json.cs new file mode 100644 index 000000000000..6ac9985014e6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageIdentifier.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// This is the gallery image definition identifier. + public partial class GalleryImageIdentifier + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new GalleryImageIdentifier(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal GalleryImageIdentifier(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_publisher = If( json?.PropertyT("publisher"), out var __jsonPublisher) ? (string)__jsonPublisher : (string)Publisher;} + {_offer = If( json?.PropertyT("offer"), out var __jsonOffer) ? (string)__jsonOffer : (string)Offer;} + {_sku = If( json?.PropertyT("sku"), out var __jsonSku) ? (string)__jsonSku : (string)Sku;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._publisher)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._publisher.ToString()) : null, "publisher" ,container.Add ); + AddIf( null != (((object)this._offer)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._offer.ToString()) : null, "offer" ,container.Add ); + AddIf( null != (((object)this._sku)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._sku.ToString()) : null, "sku" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageProperties.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageProperties.PowerShell.cs new file mode 100644 index 000000000000..95e3d5a16e48 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageProperties.PowerShell.cs @@ -0,0 +1,338 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Properties under the gallery image resource + [System.ComponentModel.TypeConverter(typeof(GalleryImagePropertiesTypeConverter))] + public partial class GalleryImageProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GalleryImageProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GalleryImageProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GalleryImageProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Identifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).Identifier = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier) content.GetValueForProperty("Identifier",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).Identifier, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageIdentifierTypeConverter.ConvertFrom); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).Version = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).Version, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).ContainerId = (string) content.GetValueForProperty("ContainerId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).ContainerId, global::System.Convert.ToString); + } + if (content.Contains("ImagePath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).ImagePath = (string) content.GetValueForProperty("ImagePath",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).ImagePath, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).OSType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).OSType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes.CreateFrom); + } + if (content.Contains("CloudInitDataSource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).CloudInitDataSource = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource?) content.GetValueForProperty("CloudInitDataSource",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).CloudInitDataSource, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource.CreateFrom); + } + if (content.Contains("HyperVGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).HyperVGeneration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration?) content.GetValueForProperty("HyperVGeneration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).HyperVGeneration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration.CreateFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("IdentifierPublisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).IdentifierPublisher = (string) content.GetValueForProperty("IdentifierPublisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).IdentifierPublisher, global::System.Convert.ToString); + } + if (content.Contains("IdentifierOffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).IdentifierOffer = (string) content.GetValueForProperty("IdentifierOffer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).IdentifierOffer, global::System.Convert.ToString); + } + if (content.Contains("IdentifierSku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).IdentifierSku = (string) content.GetValueForProperty("IdentifierSku",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).IdentifierSku, global::System.Convert.ToString); + } + if (content.Contains("VersionProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).VersionProperty = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties) content.GetValueForProperty("VersionProperty",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).VersionProperty, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("VersionName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).VersionName = (string) content.GetValueForProperty("VersionName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).VersionName, global::System.Convert.ToString); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusDownloadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StatusDownloadStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus) content.GetValueForProperty("StatusDownloadStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StatusDownloadStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusDownloadStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StatusProgressPercentage = (long?) content.GetValueForProperty("StatusProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StatusProgressPercentage, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("StorageProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StorageProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile) content.GetValueForProperty("StorageProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StorageProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionStorageProfileTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + if (content.Contains("DownloadStatusDownloadSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).DownloadStatusDownloadSizeInMb = (long?) content.GetValueForProperty("DownloadStatusDownloadSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).DownloadStatusDownloadSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StorageProfileOSDiskImage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StorageProfileOSDiskImage = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage) content.GetValueForProperty("StorageProfileOSDiskImage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StorageProfileOSDiskImage, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryDiskImageTypeConverter.ConvertFrom); + } + if (content.Contains("OSDiskImageSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).OSDiskImageSizeInMb = (long?) content.GetValueForProperty("OSDiskImageSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).OSDiskImageSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GalleryImageProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Identifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).Identifier = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier) content.GetValueForProperty("Identifier",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).Identifier, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageIdentifierTypeConverter.ConvertFrom); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).Version = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).Version, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).ContainerId = (string) content.GetValueForProperty("ContainerId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).ContainerId, global::System.Convert.ToString); + } + if (content.Contains("ImagePath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).ImagePath = (string) content.GetValueForProperty("ImagePath",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).ImagePath, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).OSType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).OSType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes.CreateFrom); + } + if (content.Contains("CloudInitDataSource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).CloudInitDataSource = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource?) content.GetValueForProperty("CloudInitDataSource",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).CloudInitDataSource, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource.CreateFrom); + } + if (content.Contains("HyperVGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).HyperVGeneration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration?) content.GetValueForProperty("HyperVGeneration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).HyperVGeneration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration.CreateFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("IdentifierPublisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).IdentifierPublisher = (string) content.GetValueForProperty("IdentifierPublisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).IdentifierPublisher, global::System.Convert.ToString); + } + if (content.Contains("IdentifierOffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).IdentifierOffer = (string) content.GetValueForProperty("IdentifierOffer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).IdentifierOffer, global::System.Convert.ToString); + } + if (content.Contains("IdentifierSku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).IdentifierSku = (string) content.GetValueForProperty("IdentifierSku",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).IdentifierSku, global::System.Convert.ToString); + } + if (content.Contains("VersionProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).VersionProperty = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties) content.GetValueForProperty("VersionProperty",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).VersionProperty, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("VersionName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).VersionName = (string) content.GetValueForProperty("VersionName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).VersionName, global::System.Convert.ToString); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusDownloadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StatusDownloadStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus) content.GetValueForProperty("StatusDownloadStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StatusDownloadStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusDownloadStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StatusProgressPercentage = (long?) content.GetValueForProperty("StatusProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StatusProgressPercentage, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("StorageProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StorageProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile) content.GetValueForProperty("StorageProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StorageProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionStorageProfileTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + if (content.Contains("DownloadStatusDownloadSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).DownloadStatusDownloadSizeInMb = (long?) content.GetValueForProperty("DownloadStatusDownloadSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).DownloadStatusDownloadSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StorageProfileOSDiskImage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StorageProfileOSDiskImage = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage) content.GetValueForProperty("StorageProfileOSDiskImage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).StorageProfileOSDiskImage, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryDiskImageTypeConverter.ConvertFrom); + } + if (content.Contains("OSDiskImageSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).OSDiskImageSizeInMb = (long?) content.GetValueForProperty("OSDiskImageSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)this).OSDiskImageSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Properties under the gallery image resource + [System.ComponentModel.TypeConverter(typeof(GalleryImagePropertiesTypeConverter))] + public partial interface IGalleryImageProperties + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageProperties.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageProperties.TypeConverter.cs new file mode 100644 index 000000000000..1db6f3e3784d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GalleryImagePropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GalleryImageProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GalleryImageProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GalleryImageProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageProperties.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageProperties.cs new file mode 100644 index 000000000000..c3cb83712dbd --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageProperties.cs @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Properties under the gallery image resource + public partial class GalleryImageProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageProperties, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource? _cloudInitDataSource; + + /// + /// Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource? CloudInitDataSource { get => this._cloudInitDataSource; set => this._cloudInitDataSource = value; } + + /// Backing field for property. + private string _containerId; + + /// Storage ContainerID of the storage container to be used for gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ContainerId { get => this._containerId; set => this._containerId = value; } + + /// The downloaded sized of the image in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? DownloadStatusDownloadSizeInMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)Status).DownloadStatusDownloadSizeInMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)Status).DownloadStatusDownloadSizeInMb = value ?? default(long); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration? _hyperVGeneration; + + /// The hypervisor generation of the Virtual Machine [V1, V2] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration? HyperVGeneration { get => this._hyperVGeneration; set => this._hyperVGeneration = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier _identifier; + + /// This is the gallery image definition identifier. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier Identifier { get => (this._identifier = this._identifier ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageIdentifier()); set => this._identifier = value; } + + /// The name of the gallery image definition offer. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentifierOffer { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)Identifier).Offer; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)Identifier).Offer = value ?? null; } + + /// The name of the gallery image definition publisher. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentifierPublisher { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)Identifier).Publisher; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)Identifier).Publisher = value ?? null; } + + /// The name of the gallery image definition SKU. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentifierSku { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)Identifier).Sku; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)Identifier).Sku = value ?? null; } + + /// Backing field for property. + private string _imagePath; + + /// location of the image the gallery image should be created from + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ImagePath { get => this._imagePath; set => this._imagePath = value; } + + /// Internal Acessors for Identifier + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal.Identifier { get => (this._identifier = this._identifier ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageIdentifier()); set { {_identifier = value;} } } + + /// Internal Acessors for OSDiskImageSizeInMb + long? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal.OSDiskImageSizeInMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)Version).OSDiskImageSizeInMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)Version).OSDiskImageSizeInMb = value; } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal.Status { get => (this._status = this._status ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatus()); set { {_status = value;} } } + + /// Internal Acessors for StatusDownloadStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal.StatusDownloadStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)Status).DownloadStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)Status).DownloadStatus = value; } + + /// Internal Acessors for StatusProvisioningStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal.StatusProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)Status).ProvisioningStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)Status).ProvisioningStatus = value; } + + /// Internal Acessors for StorageProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal.StorageProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)Version).StorageProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)Version).StorageProfile = value; } + + /// Internal Acessors for StorageProfileOSDiskImage + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal.StorageProfileOSDiskImage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)Version).StorageProfileOSDiskImage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)Version).StorageProfileOSDiskImage = value; } + + /// Internal Acessors for Version + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal.Version { get => (this._version = this._version ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersion()); set { {_version = value;} } } + + /// Internal Acessors for VersionProperty + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal.VersionProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)Version).Property; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)Version).Property = value; } + + /// This property indicates the size of the VHD to be created. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? OSDiskImageSizeInMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)Version).OSDiskImageSizeInMb; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes _oSType; + + /// Operating system type that the gallery image uses [Windows, Linux] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes OSType { get => this._oSType; set => this._oSType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? _provisioningState; + + /// Provisioning state of the gallery image. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get => this._provisioningState; } + + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)Status).ProvisioningStatusStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)Status).ProvisioningStatusStatus = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status)""); } + + /// The ID of the operation performed on the gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningStatusOperationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)Status).ProvisioningStatusOperationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)Status).ProvisioningStatusOperationId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatus _status; + + /// The observed state of gallery images + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatus Status { get => (this._status = this._status ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatus()); } + + /// GalleryImage provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)Status).ErrorCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)Status).ErrorCode = value ?? null; } + + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)Status).ErrorMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)Status).ErrorMessage = value ?? null; } + + /// The progress of the operation in percentage + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? StatusProgressPercentage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)Status).ProgressPercentage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)Status).ProgressPercentage = value ?? default(long); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion _version; + + /// + /// Specifies information about the gallery image version that you want to create or update. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion Version { get => (this._version = this._version ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersion()); set => this._version = value; } + + /// This is the version of the gallery image. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string VersionName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)Version).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)Version).Name = value ?? null; } + + /// Creates an new instance. + public GalleryImageProperties() + { + + } + } + /// Properties under the gallery image resource + public partial interface IGalleryImageProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// + /// Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure]", + SerializedName = @"cloudInitDataSource", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource? CloudInitDataSource { get; set; } + /// Storage ContainerID of the storage container to be used for gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Storage ContainerID of the storage container to be used for gallery image", + SerializedName = @"containerId", + PossibleTypes = new [] { typeof(string) })] + string ContainerId { get; set; } + /// The downloaded sized of the image in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The downloaded sized of the image in MB", + SerializedName = @"downloadSizeInMB", + PossibleTypes = new [] { typeof(long) })] + long? DownloadStatusDownloadSizeInMb { get; set; } + /// The hypervisor generation of the Virtual Machine [V1, V2] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The hypervisor generation of the Virtual Machine [V1, V2]", + SerializedName = @"hyperVGeneration", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration? HyperVGeneration { get; set; } + /// The name of the gallery image definition offer. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition offer.", + SerializedName = @"offer", + PossibleTypes = new [] { typeof(string) })] + string IdentifierOffer { get; set; } + /// The name of the gallery image definition publisher. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition publisher.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + string IdentifierPublisher { get; set; } + /// The name of the gallery image definition SKU. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition SKU.", + SerializedName = @"sku", + PossibleTypes = new [] { typeof(string) })] + string IdentifierSku { get; set; } + /// location of the image the gallery image should be created from + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"location of the image the gallery image should be created from", + SerializedName = @"imagePath", + PossibleTypes = new [] { typeof(string) })] + string ImagePath { get; set; } + /// This property indicates the size of the VHD to be created. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"This property indicates the size of the VHD to be created.", + SerializedName = @"sizeInMB", + PossibleTypes = new [] { typeof(long) })] + long? OSDiskImageSizeInMb { get; } + /// Operating system type that the gallery image uses [Windows, Linux] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Operating system type that the gallery image uses [Windows, Linux]", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes OSType { get; set; } + /// Provisioning state of the gallery image. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Provisioning state of the gallery image.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; } + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the gallery image [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the gallery image", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusOperationId { get; set; } + /// GalleryImage provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"GalleryImage provisioning error code", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorCode { get; set; } + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Descriptive error message", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorMessage { get; set; } + /// The progress of the operation in percentage + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The progress of the operation in percentage", + SerializedName = @"progressPercentage", + PossibleTypes = new [] { typeof(long) })] + long? StatusProgressPercentage { get; set; } + /// This is the version of the gallery image. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"This is the version of the gallery image.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string VersionName { get; set; } + + } + /// Properties under the gallery image resource + internal partial interface IGalleryImagePropertiesInternal + + { + /// + /// Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource? CloudInitDataSource { get; set; } + /// Storage ContainerID of the storage container to be used for gallery image + string ContainerId { get; set; } + /// The downloaded sized of the image in MB + long? DownloadStatusDownloadSizeInMb { get; set; } + /// The hypervisor generation of the Virtual Machine [V1, V2] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration? HyperVGeneration { get; set; } + /// This is the gallery image definition identifier. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier Identifier { get; set; } + /// The name of the gallery image definition offer. + string IdentifierOffer { get; set; } + /// The name of the gallery image definition publisher. + string IdentifierPublisher { get; set; } + /// The name of the gallery image definition SKU. + string IdentifierSku { get; set; } + /// location of the image the gallery image should be created from + string ImagePath { get; set; } + /// This property indicates the size of the VHD to be created. + long? OSDiskImageSizeInMb { get; set; } + /// Operating system type that the gallery image uses [Windows, Linux] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes OSType { get; set; } + /// Provisioning state of the gallery image. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; set; } + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the gallery image + string ProvisioningStatusOperationId { get; set; } + /// The observed state of gallery images + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatus Status { get; set; } + /// The download status of the gallery image + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus StatusDownloadStatus { get; set; } + /// GalleryImage provisioning error code + string StatusErrorCode { get; set; } + /// Descriptive error message + string StatusErrorMessage { get; set; } + /// The progress of the operation in percentage + long? StatusProgressPercentage { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus StatusProvisioningStatus { get; set; } + /// This is the storage profile of a Gallery Image Version. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile StorageProfile { get; set; } + /// This is the disk image base class. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage StorageProfileOSDiskImage { get; set; } + /// + /// Specifies information about the gallery image version that you want to create or update. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion Version { get; set; } + /// This is the version of the gallery image. + string VersionName { get; set; } + /// Describes the properties of a gallery image version. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties VersionProperty { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageProperties.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageProperties.json.cs new file mode 100644 index 000000000000..4d6e54c9cb70 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageProperties.json.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Properties under the gallery image resource + public partial class GalleryImageProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new GalleryImageProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal GalleryImageProperties(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_identifier = If( json?.PropertyT("identifier"), out var __jsonIdentifier) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageIdentifier.FromJson(__jsonIdentifier) : Identifier;} + {_version = If( json?.PropertyT("version"), out var __jsonVersion) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersion.FromJson(__jsonVersion) : Version;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatus.FromJson(__jsonStatus) : Status;} + {_containerId = If( json?.PropertyT("containerId"), out var __jsonContainerId) ? (string)__jsonContainerId : (string)ContainerId;} + {_imagePath = If( json?.PropertyT("imagePath"), out var __jsonImagePath) ? (string)__jsonImagePath : (string)ImagePath;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + {_cloudInitDataSource = If( json?.PropertyT("cloudInitDataSource"), out var __jsonCloudInitDataSource) ? (string)__jsonCloudInitDataSource : (string)CloudInitDataSource;} + {_hyperVGeneration = If( json?.PropertyT("hyperVGeneration"), out var __jsonHyperVGeneration) ? (string)__jsonHyperVGeneration : (string)HyperVGeneration;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._identifier ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._identifier.ToJson(null,serializationMode) : null, "identifier" ,container.Add ); + AddIf( null != this._version ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._version.ToJson(null,serializationMode) : null, "version" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._status ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._status.ToJson(null,serializationMode) : null, "status" ,container.Add ); + } + AddIf( null != (((object)this._containerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._containerId.ToString()) : null, "containerId" ,container.Add ); + AddIf( null != (((object)this._imagePath)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._imagePath.ToString()) : null, "imagePath" ,container.Add ); + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + AddIf( null != (((object)this._cloudInitDataSource)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._cloudInitDataSource.ToString()) : null, "cloudInitDataSource" ,container.Add ); + AddIf( null != (((object)this._hyperVGeneration)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._hyperVGeneration.ToString()) : null, "hyperVGeneration" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatus.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatus.PowerShell.cs new file mode 100644 index 000000000000..0bdc266a26f1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatus.PowerShell.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The observed state of gallery images + [System.ComponentModel.TypeConverter(typeof(GalleryImageStatusTypeConverter))] + public partial class GalleryImageStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GalleryImageStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GalleryImageStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GalleryImageStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("DownloadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).DownloadStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus) content.GetValueForProperty("DownloadStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).DownloadStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusDownloadStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ProgressPercentage = (long?) content.GetValueForProperty("ProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ProgressPercentage, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ProvisioningStatusStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ProvisioningStatusStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatusStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ProvisioningStatusStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + if (content.Contains("DownloadStatusDownloadSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).DownloadStatusDownloadSizeInMb = (long?) content.GetValueForProperty("DownloadStatusDownloadSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).DownloadStatusDownloadSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GalleryImageStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("DownloadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).DownloadStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus) content.GetValueForProperty("DownloadStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).DownloadStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusDownloadStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ProgressPercentage = (long?) content.GetValueForProperty("ProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ProgressPercentage, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ProvisioningStatusStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ProvisioningStatusStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatusStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ProvisioningStatusStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + if (content.Contains("DownloadStatusDownloadSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).DownloadStatusDownloadSizeInMb = (long?) content.GetValueForProperty("DownloadStatusDownloadSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal)this).DownloadStatusDownloadSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The observed state of gallery images + [System.ComponentModel.TypeConverter(typeof(GalleryImageStatusTypeConverter))] + public partial interface IGalleryImageStatus + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatus.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatus.TypeConverter.cs new file mode 100644 index 000000000000..1f110387d7b7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatus.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GalleryImageStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GalleryImageStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GalleryImageStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GalleryImageStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatus.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatus.cs new file mode 100644 index 000000000000..3eac01ccf9bb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatus.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The observed state of gallery images + public partial class GalleryImageStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatus, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus _downloadStatus; + + /// The download status of the gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus DownloadStatus { get => (this._downloadStatus = this._downloadStatus ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusDownloadStatus()); set => this._downloadStatus = value; } + + /// The downloaded sized of the image in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? DownloadStatusDownloadSizeInMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatusInternal)DownloadStatus).DownloadSizeInMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatusInternal)DownloadStatus).DownloadSizeInMb = value ?? default(long); } + + /// Backing field for property. + private string _errorCode; + + /// GalleryImage provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ErrorCode { get => this._errorCode; set => this._errorCode = value; } + + /// Backing field for property. + private string _errorMessage; + + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ErrorMessage { get => this._errorMessage; set => this._errorMessage = value; } + + /// Internal Acessors for DownloadStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal.DownloadStatus { get => (this._downloadStatus = this._downloadStatus ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusDownloadStatus()); set { {_downloadStatus = value;} } } + + /// Internal Acessors for ProvisioningStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusInternal.ProvisioningStatus { get => (this._provisioningStatus = this._provisioningStatus ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusProvisioningStatus()); set { {_provisioningStatus = value;} } } + + /// Backing field for property. + private long? _progressPercentage; + + /// The progress of the operation in percentage + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public long? ProgressPercentage { get => this._progressPercentage; set => this._progressPercentage = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus _provisioningStatus; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus ProvisioningStatus { get => (this._provisioningStatus = this._provisioningStatus ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusProvisioningStatus()); set => this._provisioningStatus = value; } + + /// The ID of the operation performed on the gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningStatusOperationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatusInternal)ProvisioningStatus).OperationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatusInternal)ProvisioningStatus).OperationId = value ?? null; } + + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatusStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatusInternal)ProvisioningStatus).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatusInternal)ProvisioningStatus).Status = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status)""); } + + /// Creates an new instance. + public GalleryImageStatus() + { + + } + } + /// The observed state of gallery images + public partial interface IGalleryImageStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The downloaded sized of the image in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The downloaded sized of the image in MB", + SerializedName = @"downloadSizeInMB", + PossibleTypes = new [] { typeof(long) })] + long? DownloadStatusDownloadSizeInMb { get; set; } + /// GalleryImage provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"GalleryImage provisioning error code", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string ErrorCode { get; set; } + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Descriptive error message", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; set; } + /// The progress of the operation in percentage + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The progress of the operation in percentage", + SerializedName = @"progressPercentage", + PossibleTypes = new [] { typeof(long) })] + long? ProgressPercentage { get; set; } + /// The ID of the operation performed on the gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the gallery image", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusOperationId { get; set; } + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the gallery image [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatusStatus { get; set; } + + } + /// The observed state of gallery images + internal partial interface IGalleryImageStatusInternal + + { + /// The download status of the gallery image + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus DownloadStatus { get; set; } + /// The downloaded sized of the image in MB + long? DownloadStatusDownloadSizeInMb { get; set; } + /// GalleryImage provisioning error code + string ErrorCode { get; set; } + /// Descriptive error message + string ErrorMessage { get; set; } + /// The progress of the operation in percentage + long? ProgressPercentage { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus ProvisioningStatus { get; set; } + /// The ID of the operation performed on the gallery image + string ProvisioningStatusOperationId { get; set; } + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatusStatus { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatus.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatus.json.cs new file mode 100644 index 000000000000..bc3d829e383b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatus.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The observed state of gallery images + public partial class GalleryImageStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new GalleryImageStatus(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal GalleryImageStatus(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provisioningStatus = If( json?.PropertyT("provisioningStatus"), out var __jsonProvisioningStatus) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusProvisioningStatus.FromJson(__jsonProvisioningStatus) : ProvisioningStatus;} + {_downloadStatus = If( json?.PropertyT("downloadStatus"), out var __jsonDownloadStatus) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusDownloadStatus.FromJson(__jsonDownloadStatus) : DownloadStatus;} + {_errorCode = If( json?.PropertyT("errorCode"), out var __jsonErrorCode) ? (string)__jsonErrorCode : (string)ErrorCode;} + {_errorMessage = If( json?.PropertyT("errorMessage"), out var __jsonErrorMessage) ? (string)__jsonErrorMessage : (string)ErrorMessage;} + {_progressPercentage = If( json?.PropertyT("progressPercentage"), out var __jsonProgressPercentage) ? (long?)__jsonProgressPercentage : ProgressPercentage;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._provisioningStatus ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._provisioningStatus.ToJson(null,serializationMode) : null, "provisioningStatus" ,container.Add ); + AddIf( null != this._downloadStatus ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._downloadStatus.ToJson(null,serializationMode) : null, "downloadStatus" ,container.Add ); + AddIf( null != (((object)this._errorCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._errorCode.ToString()) : null, "errorCode" ,container.Add ); + AddIf( null != (((object)this._errorMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._errorMessage.ToString()) : null, "errorMessage" ,container.Add ); + AddIf( null != this._progressPercentage ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNumber((long)this._progressPercentage) : null, "progressPercentage" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusDownloadStatus.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusDownloadStatus.PowerShell.cs new file mode 100644 index 000000000000..2eac57325564 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusDownloadStatus.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The download status of the gallery image + [System.ComponentModel.TypeConverter(typeof(GalleryImageStatusDownloadStatusTypeConverter))] + public partial class GalleryImageStatusDownloadStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GalleryImageStatusDownloadStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GalleryImageStatusDownloadStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GalleryImageStatusDownloadStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DownloadSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatusInternal)this).DownloadSizeInMb = (long?) content.GetValueForProperty("DownloadSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatusInternal)this).DownloadSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GalleryImageStatusDownloadStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DownloadSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatusInternal)this).DownloadSizeInMb = (long?) content.GetValueForProperty("DownloadSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatusInternal)this).DownloadSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The download status of the gallery image + [System.ComponentModel.TypeConverter(typeof(GalleryImageStatusDownloadStatusTypeConverter))] + public partial interface IGalleryImageStatusDownloadStatus + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusDownloadStatus.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusDownloadStatus.TypeConverter.cs new file mode 100644 index 000000000000..dfff20d1087e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusDownloadStatus.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GalleryImageStatusDownloadStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GalleryImageStatusDownloadStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GalleryImageStatusDownloadStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GalleryImageStatusDownloadStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusDownloadStatus.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusDownloadStatus.cs new file mode 100644 index 000000000000..8e5be9586a97 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusDownloadStatus.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The download status of the gallery image + public partial class GalleryImageStatusDownloadStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatusInternal + { + + /// Backing field for property. + private long? _downloadSizeInMb; + + /// The downloaded sized of the image in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public long? DownloadSizeInMb { get => this._downloadSizeInMb; set => this._downloadSizeInMb = value; } + + /// Creates an new instance. + public GalleryImageStatusDownloadStatus() + { + + } + } + /// The download status of the gallery image + public partial interface IGalleryImageStatusDownloadStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The downloaded sized of the image in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The downloaded sized of the image in MB", + SerializedName = @"downloadSizeInMB", + PossibleTypes = new [] { typeof(long) })] + long? DownloadSizeInMb { get; set; } + + } + /// The download status of the gallery image + internal partial interface IGalleryImageStatusDownloadStatusInternal + + { + /// The downloaded sized of the image in MB + long? DownloadSizeInMb { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusDownloadStatus.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusDownloadStatus.json.cs new file mode 100644 index 000000000000..63f21748baa7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusDownloadStatus.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The download status of the gallery image + public partial class GalleryImageStatusDownloadStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new GalleryImageStatusDownloadStatus(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal GalleryImageStatusDownloadStatus(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_downloadSizeInMb = If( json?.PropertyT("downloadSizeInMB"), out var __jsonDownloadSizeInMb) ? (long?)__jsonDownloadSizeInMb : DownloadSizeInMb;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._downloadSizeInMb ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNumber((long)this._downloadSizeInMb) : null, "downloadSizeInMB" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusProvisioningStatus.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusProvisioningStatus.PowerShell.cs new file mode 100644 index 000000000000..9abebe7aa8f7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusProvisioningStatus.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(GalleryImageStatusProvisioningStatusTypeConverter))] + public partial class GalleryImageStatusProvisioningStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GalleryImageStatusProvisioningStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GalleryImageStatusProvisioningStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GalleryImageStatusProvisioningStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatusInternal)this).OperationId = (string) content.GetValueForProperty("OperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatusInternal)this).OperationId, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatusInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatusInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GalleryImageStatusProvisioningStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatusInternal)this).OperationId = (string) content.GetValueForProperty("OperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatusInternal)this).OperationId, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatusInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatusInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(GalleryImageStatusProvisioningStatusTypeConverter))] + public partial interface IGalleryImageStatusProvisioningStatus + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusProvisioningStatus.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusProvisioningStatus.TypeConverter.cs new file mode 100644 index 000000000000..6f2b02e16c57 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusProvisioningStatus.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GalleryImageStatusProvisioningStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GalleryImageStatusProvisioningStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GalleryImageStatusProvisioningStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GalleryImageStatusProvisioningStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusProvisioningStatus.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusProvisioningStatus.cs new file mode 100644 index 000000000000..db582412514e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusProvisioningStatus.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class GalleryImageStatusProvisioningStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatusInternal + { + + /// Backing field for property. + private string _operationId; + + /// The ID of the operation performed on the gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string OperationId { get => this._operationId; set => this._operationId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? _status; + + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? Status { get => this._status; set => this._status = value; } + + /// Creates an new instance. + public GalleryImageStatusProvisioningStatus() + { + + } + } + public partial interface IGalleryImageStatusProvisioningStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The ID of the operation performed on the gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the gallery image", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string OperationId { get; set; } + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the gallery image [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? Status { get; set; } + + } + internal partial interface IGalleryImageStatusProvisioningStatusInternal + + { + /// The ID of the operation performed on the gallery image + string OperationId { get; set; } + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? Status { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusProvisioningStatus.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusProvisioningStatus.json.cs new file mode 100644 index 000000000000..49754bf115e2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageStatusProvisioningStatus.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class GalleryImageStatusProvisioningStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new GalleryImageStatusProvisioningStatus(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal GalleryImageStatusProvisioningStatus(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_operationId = If( json?.PropertyT("operationId"), out var __jsonOperationId) ? (string)__jsonOperationId : (string)OperationId;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)Status;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._operationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._operationId.ToString()) : null, "operationId" ,container.Add ); + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersion.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersion.PowerShell.cs new file mode 100644 index 000000000000..1e792c3c61b3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersion.PowerShell.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// Specifies information about the gallery image version that you want to create or update. + /// + [System.ComponentModel.TypeConverter(typeof(GalleryImageVersionTypeConverter))] + public partial class GalleryImageVersion + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GalleryImageVersion(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GalleryImageVersion(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GalleryImageVersion(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("StorageProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)this).StorageProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile) content.GetValueForProperty("StorageProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)this).StorageProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionStorageProfileTypeConverter.ConvertFrom); + } + if (content.Contains("StorageProfileOSDiskImage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)this).StorageProfileOSDiskImage = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage) content.GetValueForProperty("StorageProfileOSDiskImage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)this).StorageProfileOSDiskImage, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryDiskImageTypeConverter.ConvertFrom); + } + if (content.Contains("OSDiskImageSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)this).OSDiskImageSizeInMb = (long?) content.GetValueForProperty("OSDiskImageSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)this).OSDiskImageSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GalleryImageVersion(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("StorageProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)this).StorageProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile) content.GetValueForProperty("StorageProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)this).StorageProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionStorageProfileTypeConverter.ConvertFrom); + } + if (content.Contains("StorageProfileOSDiskImage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)this).StorageProfileOSDiskImage = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage) content.GetValueForProperty("StorageProfileOSDiskImage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)this).StorageProfileOSDiskImage, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryDiskImageTypeConverter.ConvertFrom); + } + if (content.Contains("OSDiskImageSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)this).OSDiskImageSizeInMb = (long?) content.GetValueForProperty("OSDiskImageSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)this).OSDiskImageSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Specifies information about the gallery image version that you want to create or update. + [System.ComponentModel.TypeConverter(typeof(GalleryImageVersionTypeConverter))] + public partial interface IGalleryImageVersion + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersion.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersion.TypeConverter.cs new file mode 100644 index 000000000000..ba6da9dfd801 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersion.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GalleryImageVersionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GalleryImageVersion.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GalleryImageVersion.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GalleryImageVersion.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersion.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersion.cs new file mode 100644 index 000000000000..6c9ed86276a7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersion.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// Specifies information about the gallery image version that you want to create or update. + /// + public partial class GalleryImageVersion : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal + { + + /// Internal Acessors for OSDiskImageSizeInMb + long? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal.OSDiskImageSizeInMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal)Property).OSDiskImageSizeInMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal)Property).OSDiskImageSizeInMb = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionProperties()); set { {_property = value;} } } + + /// Internal Acessors for StorageProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal.StorageProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal)Property).StorageProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal)Property).StorageProfile = value; } + + /// Internal Acessors for StorageProfileOSDiskImage + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal.StorageProfileOSDiskImage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal)Property).StorageProfileOSDiskImage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal)Property).StorageProfileOSDiskImage = value; } + + /// Backing field for property. + private string _name; + + /// This is the version of the gallery image. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// This property indicates the size of the VHD to be created. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? OSDiskImageSizeInMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal)Property).OSDiskImageSizeInMb; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties _property; + + /// Describes the properties of a gallery image version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionProperties()); set => this._property = value; } + + /// Creates an new instance. + public GalleryImageVersion() + { + + } + } + /// Specifies information about the gallery image version that you want to create or update. + public partial interface IGalleryImageVersion : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// This is the version of the gallery image. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"This is the version of the gallery image.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// This property indicates the size of the VHD to be created. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"This property indicates the size of the VHD to be created.", + SerializedName = @"sizeInMB", + PossibleTypes = new [] { typeof(long) })] + long? OSDiskImageSizeInMb { get; } + + } + /// Specifies information about the gallery image version that you want to create or update. + internal partial interface IGalleryImageVersionInternal + + { + /// This is the version of the gallery image. + string Name { get; set; } + /// This property indicates the size of the VHD to be created. + long? OSDiskImageSizeInMb { get; set; } + /// Describes the properties of a gallery image version. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties Property { get; set; } + /// This is the storage profile of a Gallery Image Version. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile StorageProfile { get; set; } + /// This is the disk image base class. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage StorageProfileOSDiskImage { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersion.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersion.json.cs new file mode 100644 index 000000000000..3a5aa0b88f03 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersion.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// Specifies information about the gallery image version that you want to create or update. + /// + public partial class GalleryImageVersion + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new GalleryImageVersion(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal GalleryImageVersion(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionProperties.FromJson(__jsonProperties) : Property;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionProperties.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionProperties.PowerShell.cs new file mode 100644 index 000000000000..454d59a7d758 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionProperties.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Describes the properties of a gallery image version. + [System.ComponentModel.TypeConverter(typeof(GalleryImageVersionPropertiesTypeConverter))] + public partial class GalleryImageVersionProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GalleryImageVersionProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GalleryImageVersionProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GalleryImageVersionProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StorageProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal)this).StorageProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile) content.GetValueForProperty("StorageProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal)this).StorageProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionStorageProfileTypeConverter.ConvertFrom); + } + if (content.Contains("StorageProfileOSDiskImage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal)this).StorageProfileOSDiskImage = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage) content.GetValueForProperty("StorageProfileOSDiskImage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal)this).StorageProfileOSDiskImage, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryDiskImageTypeConverter.ConvertFrom); + } + if (content.Contains("OSDiskImageSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal)this).OSDiskImageSizeInMb = (long?) content.GetValueForProperty("OSDiskImageSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal)this).OSDiskImageSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GalleryImageVersionProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StorageProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal)this).StorageProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile) content.GetValueForProperty("StorageProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal)this).StorageProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionStorageProfileTypeConverter.ConvertFrom); + } + if (content.Contains("StorageProfileOSDiskImage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal)this).StorageProfileOSDiskImage = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage) content.GetValueForProperty("StorageProfileOSDiskImage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal)this).StorageProfileOSDiskImage, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryDiskImageTypeConverter.ConvertFrom); + } + if (content.Contains("OSDiskImageSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal)this).OSDiskImageSizeInMb = (long?) content.GetValueForProperty("OSDiskImageSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal)this).OSDiskImageSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes the properties of a gallery image version. + [System.ComponentModel.TypeConverter(typeof(GalleryImageVersionPropertiesTypeConverter))] + public partial interface IGalleryImageVersionProperties + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionProperties.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionProperties.TypeConverter.cs new file mode 100644 index 000000000000..c3c78db13b7a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GalleryImageVersionPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GalleryImageVersionProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GalleryImageVersionProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GalleryImageVersionProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionProperties.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionProperties.cs new file mode 100644 index 000000000000..5ee07f306513 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionProperties.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the properties of a gallery image version. + public partial class GalleryImageVersionProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal + { + + /// Internal Acessors for OSDiskImageSizeInMb + long? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal.OSDiskImageSizeInMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfileInternal)StorageProfile).OSDiskImageSizeInMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfileInternal)StorageProfile).OSDiskImageSizeInMb = value; } + + /// Internal Acessors for StorageProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal.StorageProfile { get => (this._storageProfile = this._storageProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionStorageProfile()); set { {_storageProfile = value;} } } + + /// Internal Acessors for StorageProfileOSDiskImage + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionPropertiesInternal.StorageProfileOSDiskImage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfileInternal)StorageProfile).OSDiskImage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfileInternal)StorageProfile).OSDiskImage = value; } + + /// This property indicates the size of the VHD to be created. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? OSDiskImageSizeInMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfileInternal)StorageProfile).OSDiskImageSizeInMb; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile _storageProfile; + + /// This is the storage profile of a Gallery Image Version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile StorageProfile { get => (this._storageProfile = this._storageProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionStorageProfile()); set => this._storageProfile = value; } + + /// Creates an new instance. + public GalleryImageVersionProperties() + { + + } + } + /// Describes the properties of a gallery image version. + public partial interface IGalleryImageVersionProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// This property indicates the size of the VHD to be created. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"This property indicates the size of the VHD to be created.", + SerializedName = @"sizeInMB", + PossibleTypes = new [] { typeof(long) })] + long? OSDiskImageSizeInMb { get; } + + } + /// Describes the properties of a gallery image version. + internal partial interface IGalleryImageVersionPropertiesInternal + + { + /// This property indicates the size of the VHD to be created. + long? OSDiskImageSizeInMb { get; set; } + /// This is the storage profile of a Gallery Image Version. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile StorageProfile { get; set; } + /// This is the disk image base class. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage StorageProfileOSDiskImage { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionProperties.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionProperties.json.cs new file mode 100644 index 000000000000..f71a533fff2e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionProperties.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Describes the properties of a gallery image version. + public partial class GalleryImageVersionProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new GalleryImageVersionProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal GalleryImageVersionProperties(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_storageProfile = If( json?.PropertyT("storageProfile"), out var __jsonStorageProfile) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionStorageProfile.FromJson(__jsonStorageProfile) : StorageProfile;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._storageProfile ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._storageProfile.ToJson(null,serializationMode) : null, "storageProfile" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionStorageProfile.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionStorageProfile.PowerShell.cs new file mode 100644 index 000000000000..533894c62eef --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionStorageProfile.PowerShell.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// This is the storage profile of a Gallery Image Version. + [System.ComponentModel.TypeConverter(typeof(GalleryImageVersionStorageProfileTypeConverter))] + public partial class GalleryImageVersionStorageProfile + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GalleryImageVersionStorageProfile(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GalleryImageVersionStorageProfile(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GalleryImageVersionStorageProfile(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OSDiskImage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfileInternal)this).OSDiskImage = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage) content.GetValueForProperty("OSDiskImage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfileInternal)this).OSDiskImage, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryDiskImageTypeConverter.ConvertFrom); + } + if (content.Contains("OSDiskImageSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfileInternal)this).OSDiskImageSizeInMb = (long?) content.GetValueForProperty("OSDiskImageSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfileInternal)this).OSDiskImageSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GalleryImageVersionStorageProfile(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OSDiskImage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfileInternal)this).OSDiskImage = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage) content.GetValueForProperty("OSDiskImage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfileInternal)this).OSDiskImage, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryDiskImageTypeConverter.ConvertFrom); + } + if (content.Contains("OSDiskImageSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfileInternal)this).OSDiskImageSizeInMb = (long?) content.GetValueForProperty("OSDiskImageSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfileInternal)this).OSDiskImageSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This is the storage profile of a Gallery Image Version. + [System.ComponentModel.TypeConverter(typeof(GalleryImageVersionStorageProfileTypeConverter))] + public partial interface IGalleryImageVersionStorageProfile + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionStorageProfile.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionStorageProfile.TypeConverter.cs new file mode 100644 index 000000000000..4e16ac39ce0e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionStorageProfile.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GalleryImageVersionStorageProfileTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GalleryImageVersionStorageProfile.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GalleryImageVersionStorageProfile.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GalleryImageVersionStorageProfile.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionStorageProfile.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionStorageProfile.cs new file mode 100644 index 000000000000..dd0a0149b31b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionStorageProfile.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// This is the storage profile of a Gallery Image Version. + public partial class GalleryImageVersionStorageProfile : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfileInternal + { + + /// Internal Acessors for OSDiskImage + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfileInternal.OSDiskImage { get => (this._oSDiskImage = this._oSDiskImage ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryDiskImage()); set { {_oSDiskImage = value;} } } + + /// Internal Acessors for OSDiskImageSizeInMb + long? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfileInternal.OSDiskImageSizeInMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImageInternal)OSDiskImage).SizeInMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImageInternal)OSDiskImage).SizeInMb = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage _oSDiskImage; + + /// This is the disk image base class. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage OSDiskImage { get => (this._oSDiskImage = this._oSDiskImage ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryDiskImage()); set => this._oSDiskImage = value; } + + /// This property indicates the size of the VHD to be created. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? OSDiskImageSizeInMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImageInternal)OSDiskImage).SizeInMb; } + + /// Creates an new instance. + public GalleryImageVersionStorageProfile() + { + + } + } + /// This is the storage profile of a Gallery Image Version. + public partial interface IGalleryImageVersionStorageProfile : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// This property indicates the size of the VHD to be created. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"This property indicates the size of the VHD to be created.", + SerializedName = @"sizeInMB", + PossibleTypes = new [] { typeof(long) })] + long? OSDiskImageSizeInMb { get; } + + } + /// This is the storage profile of a Gallery Image Version. + internal partial interface IGalleryImageVersionStorageProfileInternal + + { + /// This is the disk image base class. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage OSDiskImage { get; set; } + /// This property indicates the size of the VHD to be created. + long? OSDiskImageSizeInMb { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionStorageProfile.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionStorageProfile.json.cs new file mode 100644 index 000000000000..a13eba2c046a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImageVersionStorageProfile.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// This is the storage profile of a Gallery Image Version. + public partial class GalleryImageVersionStorageProfile + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new GalleryImageVersionStorageProfile(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal GalleryImageVersionStorageProfile(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_oSDiskImage = If( json?.PropertyT("osDiskImage"), out var __jsonOSDiskImage) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryDiskImage.FromJson(__jsonOSDiskImage) : OSDiskImage;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._oSDiskImage ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._oSDiskImage.ToJson(null,serializationMode) : null, "osDiskImage" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImages.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImages.PowerShell.cs new file mode 100644 index 000000000000..dd61144213a8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImages.PowerShell.cs @@ -0,0 +1,464 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The gallery images resource definition. + [System.ComponentModel.TypeConverter(typeof(GalleryImagesTypeConverter))] + public partial class GalleryImages + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GalleryImages(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GalleryImages(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GalleryImages(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImagePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation) content.GetValueForProperty("ExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ExtendedLocationName = (string) content.GetValueForProperty("ExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("Identifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).Identifier = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier) content.GetValueForProperty("Identifier",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).Identifier, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageIdentifierTypeConverter.ConvertFrom); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).Version = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).Version, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ContainerId = (string) content.GetValueForProperty("ContainerId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ContainerId, global::System.Convert.ToString); + } + if (content.Contains("ImagePath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ImagePath = (string) content.GetValueForProperty("ImagePath",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ImagePath, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).OSType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).OSType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes.CreateFrom); + } + if (content.Contains("CloudInitDataSource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).CloudInitDataSource = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource?) content.GetValueForProperty("CloudInitDataSource",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).CloudInitDataSource, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource.CreateFrom); + } + if (content.Contains("HyperVGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).HyperVGeneration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration?) content.GetValueForProperty("HyperVGeneration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).HyperVGeneration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration.CreateFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("ExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ExtendedLocationType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes?) content.GetValueForProperty("ExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ExtendedLocationType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes.CreateFrom); + } + if (content.Contains("IdentifierPublisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).IdentifierPublisher = (string) content.GetValueForProperty("IdentifierPublisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).IdentifierPublisher, global::System.Convert.ToString); + } + if (content.Contains("IdentifierOffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).IdentifierOffer = (string) content.GetValueForProperty("IdentifierOffer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).IdentifierOffer, global::System.Convert.ToString); + } + if (content.Contains("IdentifierSku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).IdentifierSku = (string) content.GetValueForProperty("IdentifierSku",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).IdentifierSku, global::System.Convert.ToString); + } + if (content.Contains("VersionProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).VersionProperty = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties) content.GetValueForProperty("VersionProperty",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).VersionProperty, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("VersionName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).VersionName = (string) content.GetValueForProperty("VersionName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).VersionName, global::System.Convert.ToString); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusDownloadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StatusDownloadStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus) content.GetValueForProperty("StatusDownloadStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StatusDownloadStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusDownloadStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StatusProgressPercentage = (long?) content.GetValueForProperty("StatusProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StatusProgressPercentage, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("StorageProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StorageProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile) content.GetValueForProperty("StorageProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StorageProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionStorageProfileTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + if (content.Contains("DownloadStatusDownloadSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).DownloadStatusDownloadSizeInMb = (long?) content.GetValueForProperty("DownloadStatusDownloadSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).DownloadStatusDownloadSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StorageProfileOSDiskImage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StorageProfileOSDiskImage = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage) content.GetValueForProperty("StorageProfileOSDiskImage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StorageProfileOSDiskImage, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryDiskImageTypeConverter.ConvertFrom); + } + if (content.Contains("OSDiskImageSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).OSDiskImageSizeInMb = (long?) content.GetValueForProperty("OSDiskImageSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).OSDiskImageSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GalleryImages(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImagePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation) content.GetValueForProperty("ExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ExtendedLocationName = (string) content.GetValueForProperty("ExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("Identifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).Identifier = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier) content.GetValueForProperty("Identifier",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).Identifier, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageIdentifierTypeConverter.ConvertFrom); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).Version = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).Version, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ContainerId = (string) content.GetValueForProperty("ContainerId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ContainerId, global::System.Convert.ToString); + } + if (content.Contains("ImagePath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ImagePath = (string) content.GetValueForProperty("ImagePath",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ImagePath, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).OSType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).OSType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes.CreateFrom); + } + if (content.Contains("CloudInitDataSource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).CloudInitDataSource = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource?) content.GetValueForProperty("CloudInitDataSource",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).CloudInitDataSource, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource.CreateFrom); + } + if (content.Contains("HyperVGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).HyperVGeneration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration?) content.GetValueForProperty("HyperVGeneration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).HyperVGeneration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration.CreateFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("ExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ExtendedLocationType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes?) content.GetValueForProperty("ExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ExtendedLocationType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes.CreateFrom); + } + if (content.Contains("IdentifierPublisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).IdentifierPublisher = (string) content.GetValueForProperty("IdentifierPublisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).IdentifierPublisher, global::System.Convert.ToString); + } + if (content.Contains("IdentifierOffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).IdentifierOffer = (string) content.GetValueForProperty("IdentifierOffer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).IdentifierOffer, global::System.Convert.ToString); + } + if (content.Contains("IdentifierSku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).IdentifierSku = (string) content.GetValueForProperty("IdentifierSku",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).IdentifierSku, global::System.Convert.ToString); + } + if (content.Contains("VersionProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).VersionProperty = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties) content.GetValueForProperty("VersionProperty",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).VersionProperty, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("VersionName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).VersionName = (string) content.GetValueForProperty("VersionName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).VersionName, global::System.Convert.ToString); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusDownloadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StatusDownloadStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus) content.GetValueForProperty("StatusDownloadStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StatusDownloadStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageStatusDownloadStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StatusProgressPercentage = (long?) content.GetValueForProperty("StatusProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StatusProgressPercentage, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("StorageProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StorageProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile) content.GetValueForProperty("StorageProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StorageProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionStorageProfileTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + if (content.Contains("DownloadStatusDownloadSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).DownloadStatusDownloadSizeInMb = (long?) content.GetValueForProperty("DownloadStatusDownloadSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).DownloadStatusDownloadSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StorageProfileOSDiskImage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StorageProfileOSDiskImage = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage) content.GetValueForProperty("StorageProfileOSDiskImage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).StorageProfileOSDiskImage, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryDiskImageTypeConverter.ConvertFrom); + } + if (content.Contains("OSDiskImageSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).OSDiskImageSizeInMb = (long?) content.GetValueForProperty("OSDiskImageSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal)this).OSDiskImageSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The gallery images resource definition. + [System.ComponentModel.TypeConverter(typeof(GalleryImagesTypeConverter))] + public partial interface IGalleryImages + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImages.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImages.TypeConverter.cs new file mode 100644 index 000000000000..fbd46a72e621 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImages.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GalleryImagesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GalleryImages.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GalleryImages.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GalleryImages.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImages.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImages.cs new file mode 100644 index 000000000000..89b877c05efc --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImages.cs @@ -0,0 +1,473 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The gallery images resource definition. + public partial class GalleryImages : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResource(); + + /// + /// Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource? CloudInitDataSource { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).CloudInitDataSource; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).CloudInitDataSource = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource)""); } + + /// Storage ContainerID of the storage container to be used for gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ContainerId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).ContainerId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).ContainerId = value ?? null; } + + /// The downloaded sized of the image in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? DownloadStatusDownloadSizeInMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).DownloadStatusDownloadSizeInMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).DownloadStatusDownloadSizeInMb = value ?? default(long); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation _extendedLocation; + + /// The extendedLocation of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation ExtendedLocation { get => (this._extendedLocation = this._extendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation()); set => this._extendedLocation = value; } + + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ExtendedLocationName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Name = value ?? null; } + + /// The type of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? ExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Type = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes)""); } + + /// The hypervisor generation of the Virtual Machine [V1, V2] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration? HyperVGeneration { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).HyperVGeneration; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).HyperVGeneration = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration)""); } + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id; } + + /// The name of the gallery image definition offer. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentifierOffer { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).IdentifierOffer; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).IdentifierOffer = value ?? null; } + + /// The name of the gallery image definition publisher. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentifierPublisher { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).IdentifierPublisher; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).IdentifierPublisher = value ?? null; } + + /// The name of the gallery image definition SKU. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentifierSku { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).IdentifierSku; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).IdentifierSku = value ?? null; } + + /// location of the image the gallery image should be created from + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ImagePath { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).ImagePath; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).ImagePath = value ?? null; } + + /// The geo-location where the resource lives + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Location = value ; } + + /// Internal Acessors for ExtendedLocation + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal.ExtendedLocation { get => (this._extendedLocation = this._extendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation()); set { {_extendedLocation = value;} } } + + /// Internal Acessors for Identifier + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal.Identifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).Identifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).Identifier = value; } + + /// Internal Acessors for OSDiskImageSizeInMb + long? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal.OSDiskImageSizeInMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).OSDiskImageSizeInMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).OSDiskImageSizeInMb = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal.Status { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).Status = value; } + + /// Internal Acessors for StatusDownloadStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal.StatusDownloadStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).StatusDownloadStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).StatusDownloadStatus = value; } + + /// Internal Acessors for StatusProvisioningStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal.StatusProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).StatusProvisioningStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).StatusProvisioningStatus = value; } + + /// Internal Acessors for StorageProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal.StorageProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).StorageProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).StorageProfile = value; } + + /// Internal Acessors for StorageProfileOSDiskImage + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal.StorageProfileOSDiskImage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).StorageProfileOSDiskImage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).StorageProfileOSDiskImage = value; } + + /// Internal Acessors for Version + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal.Version { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).Version; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).Version = value; } + + /// Internal Acessors for VersionProperty + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesInternal.VersionProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).VersionProperty; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).VersionProperty = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name; } + + /// This property indicates the size of the VHD to be created. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? OSDiskImageSizeInMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).OSDiskImageSizeInMb; } + + /// Operating system type that the gallery image uses [Windows, Linux] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes? OSType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).OSType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).OSType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes)""); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageProperties _property; + + /// Properties under the gallery image resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageProperties()); set => this._property = value; } + + /// Provisioning state of the gallery image. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).ProvisioningState; } + + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).ProvisioningStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).ProvisioningStatus = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status)""); } + + /// The ID of the operation performed on the gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningStatusOperationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).ProvisioningStatusOperationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).ProvisioningStatusOperationId = value ?? null; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// GalleryImage provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).StatusErrorCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).StatusErrorCode = value ?? null; } + + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).StatusErrorMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).StatusErrorMessage = value ?? null; } + + /// The progress of the operation in percentage + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? StatusProgressPercentage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).StatusProgressPercentage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).StatusProgressPercentage = value ?? default(long); } + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData; } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Tag = value ?? null /* model class */; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type; } + + /// This is the version of the gallery image. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string VersionName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).VersionName; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagePropertiesInternal)Property).VersionName = value ?? null; } + + /// Creates an new instance. + public GalleryImages() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__trackedResource), __trackedResource); + await eventListener.AssertObjectIsValid(nameof(__trackedResource), __trackedResource); + } + } + /// The gallery images resource definition. + public partial interface IGalleryImages : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource + { + /// + /// Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure]", + SerializedName = @"cloudInitDataSource", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource? CloudInitDataSource { get; set; } + /// Storage ContainerID of the storage container to be used for gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Storage ContainerID of the storage container to be used for gallery image", + SerializedName = @"containerId", + PossibleTypes = new [] { typeof(string) })] + string ContainerId { get; set; } + /// The downloaded sized of the image in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The downloaded sized of the image in MB", + SerializedName = @"downloadSizeInMB", + PossibleTypes = new [] { typeof(long) })] + long? DownloadStatusDownloadSizeInMb { get; set; } + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string ExtendedLocationName { get; set; } + /// The type of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the extended location.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? ExtendedLocationType { get; set; } + /// The hypervisor generation of the Virtual Machine [V1, V2] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The hypervisor generation of the Virtual Machine [V1, V2]", + SerializedName = @"hyperVGeneration", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration? HyperVGeneration { get; set; } + /// The name of the gallery image definition offer. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition offer.", + SerializedName = @"offer", + PossibleTypes = new [] { typeof(string) })] + string IdentifierOffer { get; set; } + /// The name of the gallery image definition publisher. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition publisher.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + string IdentifierPublisher { get; set; } + /// The name of the gallery image definition SKU. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition SKU.", + SerializedName = @"sku", + PossibleTypes = new [] { typeof(string) })] + string IdentifierSku { get; set; } + /// location of the image the gallery image should be created from + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"location of the image the gallery image should be created from", + SerializedName = @"imagePath", + PossibleTypes = new [] { typeof(string) })] + string ImagePath { get; set; } + /// This property indicates the size of the VHD to be created. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"This property indicates the size of the VHD to be created.", + SerializedName = @"sizeInMB", + PossibleTypes = new [] { typeof(long) })] + long? OSDiskImageSizeInMb { get; } + /// Operating system type that the gallery image uses [Windows, Linux] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Operating system type that the gallery image uses [Windows, Linux]", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes? OSType { get; set; } + /// Provisioning state of the gallery image. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Provisioning state of the gallery image.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; } + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the gallery image [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the gallery image", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusOperationId { get; set; } + /// GalleryImage provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"GalleryImage provisioning error code", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorCode { get; set; } + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Descriptive error message", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorMessage { get; set; } + /// The progress of the operation in percentage + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The progress of the operation in percentage", + SerializedName = @"progressPercentage", + PossibleTypes = new [] { typeof(long) })] + long? StatusProgressPercentage { get; set; } + /// This is the version of the gallery image. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"This is the version of the gallery image.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string VersionName { get; set; } + + } + /// The gallery images resource definition. + internal partial interface IGalleryImagesInternal : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal + { + /// + /// Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource? CloudInitDataSource { get; set; } + /// Storage ContainerID of the storage container to be used for gallery image + string ContainerId { get; set; } + /// The downloaded sized of the image in MB + long? DownloadStatusDownloadSizeInMb { get; set; } + /// The extendedLocation of the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation ExtendedLocation { get; set; } + /// The name of the extended location. + string ExtendedLocationName { get; set; } + /// The type of the extended location. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? ExtendedLocationType { get; set; } + /// The hypervisor generation of the Virtual Machine [V1, V2] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration? HyperVGeneration { get; set; } + /// This is the gallery image definition identifier. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier Identifier { get; set; } + /// The name of the gallery image definition offer. + string IdentifierOffer { get; set; } + /// The name of the gallery image definition publisher. + string IdentifierPublisher { get; set; } + /// The name of the gallery image definition SKU. + string IdentifierSku { get; set; } + /// location of the image the gallery image should be created from + string ImagePath { get; set; } + /// This property indicates the size of the VHD to be created. + long? OSDiskImageSizeInMb { get; set; } + /// Operating system type that the gallery image uses [Windows, Linux] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes? OSType { get; set; } + /// Properties under the gallery image resource + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageProperties Property { get; set; } + /// Provisioning state of the gallery image. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; set; } + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the gallery image + string ProvisioningStatusOperationId { get; set; } + /// The observed state of gallery images + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatus Status { get; set; } + /// The download status of the gallery image + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusDownloadStatus StatusDownloadStatus { get; set; } + /// GalleryImage provisioning error code + string StatusErrorCode { get; set; } + /// Descriptive error message + string StatusErrorMessage { get; set; } + /// The progress of the operation in percentage + long? StatusProgressPercentage { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageStatusProvisioningStatus StatusProvisioningStatus { get; set; } + /// This is the storage profile of a Gallery Image Version. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile StorageProfile { get; set; } + /// This is the disk image base class. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage StorageProfileOSDiskImage { get; set; } + /// + /// Specifies information about the gallery image version that you want to create or update. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion Version { get; set; } + /// This is the version of the gallery image. + string VersionName { get; set; } + /// Describes the properties of a gallery image version. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties VersionProperty { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImages.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImages.json.cs new file mode 100644 index 000000000000..2c3290a05223 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImages.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The gallery images resource definition. + public partial class GalleryImages + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new GalleryImages(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal GalleryImages(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageProperties.FromJson(__jsonProperties) : Property;} + {_extendedLocation = If( json?.PropertyT("extendedLocation"), out var __jsonExtendedLocation) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation.FromJson(__jsonExtendedLocation) : ExtendedLocation;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __trackedResource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != this._extendedLocation ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._extendedLocation.ToJson(null,serializationMode) : null, "extendedLocation" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesListResult.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesListResult.PowerShell.cs new file mode 100644 index 000000000000..d602cf2ea113 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesListResult.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// List of gallery images. + [System.ComponentModel.TypeConverter(typeof(GalleryImagesListResultTypeConverter))] + public partial class GalleryImagesListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GalleryImagesListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GalleryImagesListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GalleryImagesListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImagesTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GalleryImagesListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImagesTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// List of gallery images. + [System.ComponentModel.TypeConverter(typeof(GalleryImagesListResultTypeConverter))] + public partial interface IGalleryImagesListResult + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesListResult.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesListResult.TypeConverter.cs new file mode 100644 index 000000000000..3042c0c6e2aa --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesListResult.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GalleryImagesListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GalleryImagesListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GalleryImagesListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GalleryImagesListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesListResult.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesListResult.cs new file mode 100644 index 000000000000..9f8bdf751a9b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesListResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// List of gallery images. + public partial class GalleryImagesListResult : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResult, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResultInternal + { + + /// Internal Acessors for NextLink + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResultInternal.NextLink { get => this._nextLink; set { {_nextLink = value;} } } + + /// Backing field for property. + private string _nextLink; + + /// Link to the next set of results. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages[] _value; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public GalleryImagesListResult() + { + + } + } + /// List of gallery images. + public partial interface IGalleryImagesListResult : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Link to the next set of results. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Link to the next set of results.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages[] Value { get; set; } + + } + /// List of gallery images. + internal partial interface IGalleryImagesListResultInternal + + { + /// Link to the next set of results. + string NextLink { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesListResult.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesListResult.json.cs new file mode 100644 index 000000000000..5f103ca39214 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesListResult.json.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// List of gallery images. + public partial class GalleryImagesListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new GalleryImagesListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal GalleryImagesListResult(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImages.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequest.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequest.PowerShell.cs new file mode 100644 index 000000000000..8e791c85e017 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequest.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The gallery images resource patch definition. + [System.ComponentModel.TypeConverter(typeof(GalleryImagesUpdateRequestTypeConverter))] + public partial class GalleryImagesUpdateRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GalleryImagesUpdateRequest(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GalleryImagesUpdateRequest(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GalleryImagesUpdateRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImagesUpdateRequestTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GalleryImagesUpdateRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImagesUpdateRequestTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The gallery images resource patch definition. + [System.ComponentModel.TypeConverter(typeof(GalleryImagesUpdateRequestTypeConverter))] + public partial interface IGalleryImagesUpdateRequest + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequest.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequest.TypeConverter.cs new file mode 100644 index 000000000000..4f4bc8eef4f6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequest.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GalleryImagesUpdateRequestTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GalleryImagesUpdateRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GalleryImagesUpdateRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GalleryImagesUpdateRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequest.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequest.cs new file mode 100644 index 000000000000..ff350c3d7ad9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequest.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The gallery images resource patch definition. + public partial class GalleryImagesUpdateRequest : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequest, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags _tag; + + /// Resource tags + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImagesUpdateRequestTags()); set => this._tag = value; } + + /// Creates an new instance. + public GalleryImagesUpdateRequest() + { + + } + } + /// The gallery images resource patch definition. + public partial interface IGalleryImagesUpdateRequest : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Resource tags + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags Tag { get; set; } + + } + /// The gallery images resource patch definition. + internal partial interface IGalleryImagesUpdateRequestInternal + + { + /// Resource tags + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequest.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequest.json.cs new file mode 100644 index 000000000000..d26635fc37be --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequest.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The gallery images resource patch definition. + public partial class GalleryImagesUpdateRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new GalleryImagesUpdateRequest(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal GalleryImagesUpdateRequest(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImagesUpdateRequestTags.FromJson(__jsonTags) : Tag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequestTags.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequestTags.PowerShell.cs new file mode 100644 index 000000000000..6548bafacb82 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequestTags.PowerShell.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Resource tags + [System.ComponentModel.TypeConverter(typeof(GalleryImagesUpdateRequestTagsTypeConverter))] + public partial class GalleryImagesUpdateRequestTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GalleryImagesUpdateRequestTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GalleryImagesUpdateRequestTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GalleryImagesUpdateRequestTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GalleryImagesUpdateRequestTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Resource tags + [System.ComponentModel.TypeConverter(typeof(GalleryImagesUpdateRequestTagsTypeConverter))] + public partial interface IGalleryImagesUpdateRequestTags + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequestTags.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequestTags.TypeConverter.cs new file mode 100644 index 000000000000..d3447cba336c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequestTags.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GalleryImagesUpdateRequestTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GalleryImagesUpdateRequestTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GalleryImagesUpdateRequestTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GalleryImagesUpdateRequestTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequestTags.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequestTags.cs new file mode 100644 index 000000000000..4da6ff157e34 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequestTags.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Resource tags + public partial class GalleryImagesUpdateRequestTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTagsInternal + { + + /// Creates an new instance. + public GalleryImagesUpdateRequestTags() + { + + } + } + /// Resource tags + public partial interface IGalleryImagesUpdateRequestTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + + } + /// Resource tags + internal partial interface IGalleryImagesUpdateRequestTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequestTags.dictionary.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequestTags.dictionary.cs new file mode 100644 index 000000000000..d91345e42781 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequestTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class GalleryImagesUpdateRequestTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImagesUpdateRequestTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequestTags.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequestTags.json.cs new file mode 100644 index 000000000000..a5e86d6ca68e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryImagesUpdateRequestTags.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Resource tags + public partial class GalleryImagesUpdateRequestTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new GalleryImagesUpdateRequestTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + /// + internal GalleryImagesUpdateRequestTags(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryOSDiskImage.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryOSDiskImage.PowerShell.cs new file mode 100644 index 000000000000..18a65dba32dd --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryOSDiskImage.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// This is the OS disk image. + [System.ComponentModel.TypeConverter(typeof(GalleryOSDiskImageTypeConverter))] + public partial class GalleryOSDiskImage + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryOSDiskImage DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GalleryOSDiskImage(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryOSDiskImage DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GalleryOSDiskImage(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryOSDiskImage FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GalleryOSDiskImage(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImageInternal)this).SizeInMb = (long?) content.GetValueForProperty("SizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImageInternal)this).SizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GalleryOSDiskImage(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImageInternal)this).SizeInMb = (long?) content.GetValueForProperty("SizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImageInternal)this).SizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This is the OS disk image. + [System.ComponentModel.TypeConverter(typeof(GalleryOSDiskImageTypeConverter))] + public partial interface IGalleryOSDiskImage + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryOSDiskImage.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryOSDiskImage.TypeConverter.cs new file mode 100644 index 000000000000..d6519b7e2d5a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryOSDiskImage.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GalleryOSDiskImageTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryOSDiskImage ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryOSDiskImage).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GalleryOSDiskImage.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GalleryOSDiskImage.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GalleryOSDiskImage.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryOSDiskImage.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryOSDiskImage.cs new file mode 100644 index 000000000000..29e21c311910 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryOSDiskImage.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// This is the OS disk image. + public partial class GalleryOSDiskImage : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryOSDiskImage, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryOSDiskImageInternal, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage __galleryDiskImage = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryDiskImage(); + + /// Internal Acessors for SizeInMb + long? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImageInternal.SizeInMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImageInternal)__galleryDiskImage).SizeInMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImageInternal)__galleryDiskImage).SizeInMb = value; } + + /// This property indicates the size of the VHD to be created. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public long? SizeInMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImageInternal)__galleryDiskImage).SizeInMb; } + + /// Creates an new instance. + public GalleryOSDiskImage() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__galleryDiskImage), __galleryDiskImage); + await eventListener.AssertObjectIsValid(nameof(__galleryDiskImage), __galleryDiskImage); + } + } + /// This is the OS disk image. + public partial interface IGalleryOSDiskImage : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage + { + + } + /// This is the OS disk image. + internal partial interface IGalleryOSDiskImageInternal : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImageInternal + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryOSDiskImage.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryOSDiskImage.json.cs new file mode 100644 index 000000000000..eb5e292115f7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GalleryOSDiskImage.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// This is the OS disk image. + public partial class GalleryOSDiskImage + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryOSDiskImage. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryOSDiskImage. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryOSDiskImage FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new GalleryOSDiskImage(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal GalleryOSDiskImage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __galleryDiskImage = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryDiskImage(json); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __galleryDiskImage?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgent.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgent.PowerShell.cs new file mode 100644 index 000000000000..bffdd4beaa78 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgent.PowerShell.cs @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Defines the GuestAgent. + [System.ComponentModel.TypeConverter(typeof(GuestAgentTypeConverter))] + public partial class GuestAgent + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GuestAgent(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GuestAgent(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GuestAgent(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgentPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).ProvisioningAction = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction?) content.GetValueForProperty("ProvisioningAction",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).ProvisioningAction, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction.CreateFrom); + } + if (content.Contains("Credentials")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).Credentials = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredential) content.GetValueForProperty("Credentials",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).Credentials, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestCredentialTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("CredentialsUsername")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).CredentialsUsername = (string) content.GetValueForProperty("CredentialsUsername",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).CredentialsUsername, global::System.Convert.ToString); + } + if (content.Contains("CredentialsPassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).CredentialsPassword = (string) content.GetValueForProperty("CredentialsPassword",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).CredentialsPassword, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GuestAgent(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgentPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).ProvisioningAction = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction?) content.GetValueForProperty("ProvisioningAction",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).ProvisioningAction, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction.CreateFrom); + } + if (content.Contains("Credentials")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).Credentials = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredential) content.GetValueForProperty("Credentials",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).Credentials, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestCredentialTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("CredentialsUsername")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).CredentialsUsername = (string) content.GetValueForProperty("CredentialsUsername",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).CredentialsUsername, global::System.Convert.ToString); + } + if (content.Contains("CredentialsPassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).CredentialsPassword = (string) content.GetValueForProperty("CredentialsPassword",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal)this).CredentialsPassword, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Defines the GuestAgent. + [System.ComponentModel.TypeConverter(typeof(GuestAgentTypeConverter))] + public partial interface IGuestAgent + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgent.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgent.TypeConverter.cs new file mode 100644 index 000000000000..eec21d0a5bc4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgent.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GuestAgentTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GuestAgent.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GuestAgent.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GuestAgent.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgent.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgent.cs new file mode 100644 index 000000000000..562bfd79e375 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgent.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Defines the GuestAgent. + public partial class GuestAgent : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Resource(); + + /// The password to connect with the guest. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string CredentialsPassword { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)Property).CredentialsPassword; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)Property).CredentialsPassword = value ?? null; } + + /// The username to connect with the guest. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string CredentialsUsername { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)Property).CredentialsUsername; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)Property).CredentialsUsername = value ?? null; } + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Id; } + + /// Internal Acessors for Credentials + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredential Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal.Credentials { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)Property).Credentials; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)Property).Credentials = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgentProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for Status + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInternal.Status { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)Property).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)Property).Status = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemData = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentProperties _property; + + /// Resource properties. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgentProperties()); set => this._property = value; } + + /// The guest agent provisioning action. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction? ProvisioningAction { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)Property).ProvisioningAction; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)Property).ProvisioningAction = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction)""); } + + /// The provisioning state. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)Property).ProvisioningState; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// The guest agent status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string Status { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)Property).Status; } + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemData; } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public GuestAgent() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Defines the GuestAgent. + public partial interface IGuestAgent : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource + { + /// The password to connect with the guest. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The password to connect with the guest.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + string CredentialsPassword { get; set; } + /// The username to connect with the guest. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The username to connect with the guest.", + SerializedName = @"username", + PossibleTypes = new [] { typeof(string) })] + string CredentialsUsername { get; set; } + /// The guest agent provisioning action. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The guest agent provisioning action.", + SerializedName = @"provisioningAction", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction? ProvisioningAction { get; set; } + /// The provisioning state. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The provisioning state.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningState { get; } + /// The guest agent status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The guest agent status.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + string Status { get; } + + } + /// Defines the GuestAgent. + internal partial interface IGuestAgentInternal : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal + { + /// Username / Password Credentials to provision guest agent. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredential Credentials { get; set; } + /// The password to connect with the guest. + string CredentialsPassword { get; set; } + /// The username to connect with the guest. + string CredentialsUsername { get; set; } + /// Resource properties. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentProperties Property { get; set; } + /// The guest agent provisioning action. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction? ProvisioningAction { get; set; } + /// The provisioning state. + string ProvisioningState { get; set; } + /// The guest agent status. + string Status { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgent.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgent.json.cs new file mode 100644 index 000000000000..5f829b6aec24 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgent.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Defines the GuestAgent. + public partial class GuestAgent + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new GuestAgent(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal GuestAgent(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgentProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentInstallStatus.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentInstallStatus.PowerShell.cs new file mode 100644 index 000000000000..13fae18cf0a2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentInstallStatus.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Defines the status of a guest agent installation. + [System.ComponentModel.TypeConverter(typeof(GuestAgentInstallStatusTypeConverter))] + public partial class GuestAgentInstallStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GuestAgentInstallStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GuestAgentInstallStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GuestAgentInstallStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VMUuid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)this).VMUuid = (string) content.GetValueForProperty("VMUuid",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)this).VMUuid, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes.CreateFrom); + } + if (content.Contains("LastStatusChange")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)this).LastStatusChange = (global::System.DateTime?) content.GetValueForProperty("LastStatusChange",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)this).LastStatusChange, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("AgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)this).AgentVersion = (string) content.GetValueForProperty("AgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)this).AgentVersion, global::System.Convert.ToString); + } + if (content.Contains("ErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)this).ErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[]) content.GetValueForProperty("ErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)this).ErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetailTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GuestAgentInstallStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VMUuid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)this).VMUuid = (string) content.GetValueForProperty("VMUuid",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)this).VMUuid, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes.CreateFrom); + } + if (content.Contains("LastStatusChange")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)this).LastStatusChange = (global::System.DateTime?) content.GetValueForProperty("LastStatusChange",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)this).LastStatusChange, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("AgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)this).AgentVersion = (string) content.GetValueForProperty("AgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)this).AgentVersion, global::System.Convert.ToString); + } + if (content.Contains("ErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)this).ErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[]) content.GetValueForProperty("ErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)this).ErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetailTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Defines the status of a guest agent installation. + [System.ComponentModel.TypeConverter(typeof(GuestAgentInstallStatusTypeConverter))] + public partial interface IGuestAgentInstallStatus + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentInstallStatus.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentInstallStatus.TypeConverter.cs new file mode 100644 index 000000000000..64d2c915fd03 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentInstallStatus.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GuestAgentInstallStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GuestAgentInstallStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GuestAgentInstallStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GuestAgentInstallStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentInstallStatus.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentInstallStatus.cs new file mode 100644 index 000000000000..18067b99842b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentInstallStatus.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Defines the status of a guest agent installation. + public partial class GuestAgentInstallStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatus, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal + { + + /// Backing field for property. + private string _agentVersion; + + /// The hybrid machine agent full version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string AgentVersion { get => this._agentVersion; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] _errorDetail; + + /// Details about the error state. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] ErrorDetail { get => this._errorDetail; } + + /// Backing field for property. + private global::System.DateTime? _lastStatusChange; + + /// The time of the last status change. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public global::System.DateTime? LastStatusChange { get => this._lastStatusChange; } + + /// Internal Acessors for AgentVersion + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal.AgentVersion { get => this._agentVersion; set { {_agentVersion = value;} } } + + /// Internal Acessors for ErrorDetail + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal.ErrorDetail { get => this._errorDetail; set { {_errorDetail = value;} } } + + /// Internal Acessors for LastStatusChange + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal.LastStatusChange { get => this._lastStatusChange; set { {_lastStatusChange = value;} } } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal.Status { get => this._status; set { {_status = value;} } } + + /// Internal Acessors for VMUuid + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal.VMUuid { get => this._vMUuid; set { {_vMUuid = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes? _status; + + /// The installation status of the hybrid machine agent installation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes? Status { get => this._status; } + + /// Backing field for property. + private string _vMUuid; + + /// Specifies the VM's unique SMBIOS ID. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string VMUuid { get => this._vMUuid; } + + /// Creates an new instance. + public GuestAgentInstallStatus() + { + + } + } + /// Defines the status of a guest agent installation. + public partial interface IGuestAgentInstallStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The hybrid machine agent full version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The hybrid machine agent full version.", + SerializedName = @"agentVersion", + PossibleTypes = new [] { typeof(string) })] + string AgentVersion { get; } + /// Details about the error state. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Details about the error state.", + SerializedName = @"errorDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] ErrorDetail { get; } + /// The time of the last status change. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The time of the last status change.", + SerializedName = @"lastStatusChange", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastStatusChange { get; } + /// The installation status of the hybrid machine agent installation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The installation status of the hybrid machine agent installation.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes? Status { get; } + /// Specifies the VM's unique SMBIOS ID. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the VM's unique SMBIOS ID.", + SerializedName = @"vmUuid", + PossibleTypes = new [] { typeof(string) })] + string VMUuid { get; } + + } + /// Defines the status of a guest agent installation. + internal partial interface IGuestAgentInstallStatusInternal + + { + /// The hybrid machine agent full version. + string AgentVersion { get; set; } + /// Details about the error state. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] ErrorDetail { get; set; } + /// The time of the last status change. + global::System.DateTime? LastStatusChange { get; set; } + /// The installation status of the hybrid machine agent installation. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes? Status { get; set; } + /// Specifies the VM's unique SMBIOS ID. + string VMUuid { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentInstallStatus.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentInstallStatus.json.cs new file mode 100644 index 000000000000..e2882c50aaec --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentInstallStatus.json.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Defines the status of a guest agent installation. + public partial class GuestAgentInstallStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new GuestAgentInstallStatus(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal GuestAgentInstallStatus(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_vMUuid = If( json?.PropertyT("vmUuid"), out var __jsonVMUuid) ? (string)__jsonVMUuid : (string)VMUuid;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)Status;} + {_lastStatusChange = If( json?.PropertyT("lastStatusChange"), out var __jsonLastStatusChange) ? global::System.DateTime.TryParse((string)__jsonLastStatusChange, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastStatusChangeValue) ? __jsonLastStatusChangeValue : LastStatusChange : LastStatusChange;} + {_agentVersion = If( json?.PropertyT("agentVersion"), out var __jsonAgentVersion) ? (string)__jsonAgentVersion : (string)AgentVersion;} + {_errorDetail = If( json?.PropertyT("errorDetails"), out var __jsonErrorDetails) ? If( __jsonErrorDetails as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetail.FromJson(__u) )) ))() : null : ErrorDetail;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._vMUuid)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._vMUuid.ToString()) : null, "vmUuid" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastStatusChange ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._lastStatusChange?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastStatusChange" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._agentVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._agentVersion.ToString()) : null, "agentVersion" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._errorDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._errorDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("errorDetails",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentList.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentList.PowerShell.cs new file mode 100644 index 000000000000..30d56826df12 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentList.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// List of GuestAgent. + [System.ComponentModel.TypeConverter(typeof(GuestAgentListTypeConverter))] + public partial class GuestAgentList + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentList DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GuestAgentList(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GuestAgentList(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GuestAgentList(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentListInternal)this).NextLink, global::System.Convert.ToString); + } + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentListInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentListInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgentTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GuestAgentList(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentListInternal)this).NextLink, global::System.Convert.ToString); + } + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentListInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentListInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgentTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// List of GuestAgent. + [System.ComponentModel.TypeConverter(typeof(GuestAgentListTypeConverter))] + public partial interface IGuestAgentList + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentList.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentList.TypeConverter.cs new file mode 100644 index 000000000000..6f30efc2b248 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentList.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GuestAgentListTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentList ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentList).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GuestAgentList.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GuestAgentList.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GuestAgentList.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentList.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentList.cs new file mode 100644 index 000000000000..cb74629eb60d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentList.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// List of GuestAgent. + public partial class GuestAgentList : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentList, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentListInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Url to follow for getting next page of GuestAgent. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent[] _value; + + /// Array of GuestAgent + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public GuestAgentList() + { + + } + } + /// List of GuestAgent. + public partial interface IGuestAgentList : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Url to follow for getting next page of GuestAgent. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Url to follow for getting next page of GuestAgent.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Array of GuestAgent + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Array of GuestAgent", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent[] Value { get; set; } + + } + /// List of GuestAgent. + internal partial interface IGuestAgentListInternal + + { + /// Url to follow for getting next page of GuestAgent. + string NextLink { get; set; } + /// Array of GuestAgent + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentList.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentList.json.cs new file mode 100644 index 000000000000..a885ee5799ab --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentList.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// List of GuestAgent. + public partial class GuestAgentList + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentList. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentList. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentList FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new GuestAgentList(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal GuestAgentList(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgent.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentProperties.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentProperties.PowerShell.cs new file mode 100644 index 000000000000..eeec1ab27fa9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentProperties.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Defines the resource properties. + [System.ComponentModel.TypeConverter(typeof(GuestAgentPropertiesTypeConverter))] + public partial class GuestAgentProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GuestAgentProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GuestAgentProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GuestAgentProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Credentials")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).Credentials = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredential) content.GetValueForProperty("Credentials",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).Credentials, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestCredentialTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).ProvisioningAction = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction?) content.GetValueForProperty("ProvisioningAction",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).ProvisioningAction, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction.CreateFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("CredentialsUsername")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).CredentialsUsername = (string) content.GetValueForProperty("CredentialsUsername",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).CredentialsUsername, global::System.Convert.ToString); + } + if (content.Contains("CredentialsPassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).CredentialsPassword = (string) content.GetValueForProperty("CredentialsPassword",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).CredentialsPassword, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GuestAgentProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Credentials")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).Credentials = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredential) content.GetValueForProperty("Credentials",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).Credentials, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestCredentialTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).ProvisioningAction = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction?) content.GetValueForProperty("ProvisioningAction",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).ProvisioningAction, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction.CreateFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("CredentialsUsername")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).CredentialsUsername = (string) content.GetValueForProperty("CredentialsUsername",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).CredentialsUsername, global::System.Convert.ToString); + } + if (content.Contains("CredentialsPassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).CredentialsPassword = (string) content.GetValueForProperty("CredentialsPassword",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal)this).CredentialsPassword, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Defines the resource properties. + [System.ComponentModel.TypeConverter(typeof(GuestAgentPropertiesTypeConverter))] + public partial interface IGuestAgentProperties + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentProperties.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentProperties.TypeConverter.cs new file mode 100644 index 000000000000..189f963691f0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GuestAgentPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GuestAgentProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GuestAgentProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GuestAgentProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentProperties.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentProperties.cs new file mode 100644 index 000000000000..08f765b863c9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentProperties.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Defines the resource properties. + public partial class GuestAgentProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentProperties, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredential _credentials; + + /// Username / Password Credentials to provision guest agent. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredential Credentials { get => (this._credentials = this._credentials ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestCredential()); set => this._credentials = value; } + + /// The password to connect with the guest. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string CredentialsPassword { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredentialInternal)Credentials).Password; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredentialInternal)Credentials).Password = value ?? null; } + + /// The username to connect with the guest. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string CredentialsUsername { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredentialInternal)Credentials).Username; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredentialInternal)Credentials).Username = value ?? null; } + + /// Internal Acessors for Credentials + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredential Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal.Credentials { get => (this._credentials = this._credentials ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestCredential()); set { {_credentials = value;} } } + + /// Internal Acessors for ProvisioningState + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Internal Acessors for Status + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentPropertiesInternal.Status { get => this._status; set { {_status = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction? _provisioningAction; + + /// The guest agent provisioning action. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction? ProvisioningAction { get => this._provisioningAction; set => this._provisioningAction = value; } + + /// Backing field for property. + private string _provisioningState; + + /// The provisioning state. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ProvisioningState { get => this._provisioningState; } + + /// Backing field for property. + private string _status; + + /// The guest agent status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Status { get => this._status; } + + /// Creates an new instance. + public GuestAgentProperties() + { + + } + } + /// Defines the resource properties. + public partial interface IGuestAgentProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The password to connect with the guest. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The password to connect with the guest.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + string CredentialsPassword { get; set; } + /// The username to connect with the guest. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The username to connect with the guest.", + SerializedName = @"username", + PossibleTypes = new [] { typeof(string) })] + string CredentialsUsername { get; set; } + /// The guest agent provisioning action. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The guest agent provisioning action.", + SerializedName = @"provisioningAction", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction? ProvisioningAction { get; set; } + /// The provisioning state. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The provisioning state.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningState { get; } + /// The guest agent status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The guest agent status.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + string Status { get; } + + } + /// Defines the resource properties. + internal partial interface IGuestAgentPropertiesInternal + + { + /// Username / Password Credentials to provision guest agent. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredential Credentials { get; set; } + /// The password to connect with the guest. + string CredentialsPassword { get; set; } + /// The username to connect with the guest. + string CredentialsUsername { get; set; } + /// The guest agent provisioning action. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction? ProvisioningAction { get; set; } + /// The provisioning state. + string ProvisioningState { get; set; } + /// The guest agent status. + string Status { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentProperties.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentProperties.json.cs new file mode 100644 index 000000000000..e1ca36039d4d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestAgentProperties.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Defines the resource properties. + public partial class GuestAgentProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new GuestAgentProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal GuestAgentProperties(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_credentials = If( json?.PropertyT("credentials"), out var __jsonCredentials) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestCredential.FromJson(__jsonCredentials) : Credentials;} + {_provisioningAction = If( json?.PropertyT("provisioningAction"), out var __jsonProvisioningAction) ? (string)__jsonProvisioningAction : (string)ProvisioningAction;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)Status;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._credentials ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._credentials.ToJson(null,serializationMode) : null, "credentials" ,container.Add ); + AddIf( null != (((object)this._provisioningAction)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._provisioningAction.ToString()) : null, "provisioningAction" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestCredential.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestCredential.PowerShell.cs new file mode 100644 index 000000000000..bf504b9d421f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestCredential.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Username / Password Credentials to connect to guest. + [System.ComponentModel.TypeConverter(typeof(GuestCredentialTypeConverter))] + public partial class GuestCredential + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredential DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GuestCredential(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredential DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GuestCredential(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredential FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GuestCredential(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Username")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredentialInternal)this).Username = (string) content.GetValueForProperty("Username",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredentialInternal)this).Username, global::System.Convert.ToString); + } + if (content.Contains("Password")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredentialInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredentialInternal)this).Password, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GuestCredential(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Username")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredentialInternal)this).Username = (string) content.GetValueForProperty("Username",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredentialInternal)this).Username, global::System.Convert.ToString); + } + if (content.Contains("Password")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredentialInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredentialInternal)this).Password, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Username / Password Credentials to connect to guest. + [System.ComponentModel.TypeConverter(typeof(GuestCredentialTypeConverter))] + public partial interface IGuestCredential + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestCredential.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestCredential.TypeConverter.cs new file mode 100644 index 000000000000..8dbd7e7dd8a3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestCredential.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GuestCredentialTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredential ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredential).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GuestCredential.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GuestCredential.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GuestCredential.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestCredential.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestCredential.cs new file mode 100644 index 000000000000..bc8d748eddfb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestCredential.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Username / Password Credentials to connect to guest. + public partial class GuestCredential : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredential, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredentialInternal + { + + /// Backing field for property. + private string _password; + + /// The password to connect with the guest. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Password { get => this._password; set => this._password = value; } + + /// Backing field for property. + private string _username; + + /// The username to connect with the guest. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Username { get => this._username; set => this._username = value; } + + /// Creates an new instance. + public GuestCredential() + { + + } + } + /// Username / Password Credentials to connect to guest. + public partial interface IGuestCredential : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The password to connect with the guest. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The password to connect with the guest.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + string Password { get; set; } + /// The username to connect with the guest. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The username to connect with the guest.", + SerializedName = @"username", + PossibleTypes = new [] { typeof(string) })] + string Username { get; set; } + + } + /// Username / Password Credentials to connect to guest. + internal partial interface IGuestCredentialInternal + + { + /// The password to connect with the guest. + string Password { get; set; } + /// The username to connect with the guest. + string Username { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestCredential.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestCredential.json.cs new file mode 100644 index 000000000000..5ee2fd363a32 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/GuestCredential.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Username / Password Credentials to connect to guest. + public partial class GuestCredential + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredential. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredential. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestCredential FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new GuestCredential(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal GuestCredential(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_username = If( json?.PropertyT("username"), out var __jsonUsername) ? (string)__jsonUsername : (string)Username;} + {_password = If( json?.PropertyT("password"), out var __jsonPassword) ? (string)__jsonPassword : (string)Password;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._username)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._username.ToString()) : null, "username" ,container.Add ); + AddIf( null != (((object)this._password)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._password.ToString()) : null, "password" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HardwareProfileUpdate.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HardwareProfileUpdate.PowerShell.cs new file mode 100644 index 000000000000..059c355a781f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HardwareProfileUpdate.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// HardwareProfile - Specifies the hardware settings for the virtual machine instance. + /// + [System.ComponentModel.TypeConverter(typeof(HardwareProfileUpdateTypeConverter))] + public partial class HardwareProfileUpdate + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HardwareProfileUpdate(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HardwareProfileUpdate(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HardwareProfileUpdate(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdateInternal)this).VMSize = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum?) content.GetValueForProperty("VMSize",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdateInternal)this).VMSize, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum.CreateFrom); + } + if (content.Contains("Processor")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdateInternal)this).Processor = (int?) content.GetValueForProperty("Processor",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdateInternal)this).Processor, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdateInternal)this).MemoryMb = (long?) content.GetValueForProperty("MemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdateInternal)this).MemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HardwareProfileUpdate(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdateInternal)this).VMSize = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum?) content.GetValueForProperty("VMSize",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdateInternal)this).VMSize, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum.CreateFrom); + } + if (content.Contains("Processor")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdateInternal)this).Processor = (int?) content.GetValueForProperty("Processor",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdateInternal)this).Processor, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdateInternal)this).MemoryMb = (long?) content.GetValueForProperty("MemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdateInternal)this).MemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HardwareProfile - Specifies the hardware settings for the virtual machine instance. + [System.ComponentModel.TypeConverter(typeof(HardwareProfileUpdateTypeConverter))] + public partial interface IHardwareProfileUpdate + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HardwareProfileUpdate.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HardwareProfileUpdate.TypeConverter.cs new file mode 100644 index 000000000000..fb039d1d71d8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HardwareProfileUpdate.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HardwareProfileUpdateTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdate ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdate).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HardwareProfileUpdate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HardwareProfileUpdate.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HardwareProfileUpdate.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HardwareProfileUpdate.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HardwareProfileUpdate.cs new file mode 100644 index 000000000000..480294c8e1b8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HardwareProfileUpdate.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// HardwareProfile - Specifies the hardware settings for the virtual machine instance. + /// + public partial class HardwareProfileUpdate : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdate, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdateInternal + { + + /// Backing field for property. + private long? _memoryMb; + + /// RAM in MB for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public long? MemoryMb { get => this._memoryMb; set => this._memoryMb = value; } + + /// Backing field for property. + private int? _processor; + + /// number of processors for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public int? Processor { get => this._processor; set => this._processor = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum? _vMSize; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum? VMSize { get => this._vMSize; set => this._vMSize = value; } + + /// Creates an new instance. + public HardwareProfileUpdate() + { + + } + } + /// HardwareProfile - Specifies the hardware settings for the virtual machine instance. + public partial interface IHardwareProfileUpdate : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// RAM in MB for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"RAM in MB for the virtual machine instance", + SerializedName = @"memoryMB", + PossibleTypes = new [] { typeof(long) })] + long? MemoryMb { get; set; } + /// number of processors for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"number of processors for the virtual machine instance", + SerializedName = @"processors", + PossibleTypes = new [] { typeof(int) })] + int? Processor { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"vmSize", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum? VMSize { get; set; } + + } + /// HardwareProfile - Specifies the hardware settings for the virtual machine instance. + internal partial interface IHardwareProfileUpdateInternal + + { + /// RAM in MB for the virtual machine instance + long? MemoryMb { get; set; } + /// number of processors for the virtual machine instance + int? Processor { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum? VMSize { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HardwareProfileUpdate.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HardwareProfileUpdate.json.cs new file mode 100644 index 000000000000..0b2658e3ce02 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HardwareProfileUpdate.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// HardwareProfile - Specifies the hardware settings for the virtual machine instance. + /// + public partial class HardwareProfileUpdate + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdate. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdate. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new HardwareProfileUpdate(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal HardwareProfileUpdate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_vMSize = If( json?.PropertyT("vmSize"), out var __jsonVMSize) ? (string)__jsonVMSize : (string)VMSize;} + {_processor = If( json?.PropertyT("processors"), out var __jsonProcessors) ? (int?)__jsonProcessors : Processor;} + {_memoryMb = If( json?.PropertyT("memoryMB"), out var __jsonMemoryMb) ? (long?)__jsonMemoryMb : MemoryMb;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._vMSize)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._vMSize.ToString()) : null, "vmSize" ,container.Add ); + AddIf( null != this._processor ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNumber((int)this._processor) : null, "processors" ,container.Add ); + AddIf( null != this._memoryMb ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNumber((long)this._memoryMb) : null, "memoryMB" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HttpProxyConfiguration.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HttpProxyConfiguration.PowerShell.cs new file mode 100644 index 000000000000..18b1d2c409c9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HttpProxyConfiguration.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// HTTP Proxy configuration for the VM. + [System.ComponentModel.TypeConverter(typeof(HttpProxyConfigurationTypeConverter))] + public partial class HttpProxyConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HttpProxyConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HttpProxyConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HttpProxyConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HttpProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)this).HttpProxy = (string) content.GetValueForProperty("HttpProxy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)this).HttpProxy, global::System.Convert.ToString); + } + if (content.Contains("HttpsProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)this).HttpsProxy = (string) content.GetValueForProperty("HttpsProxy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)this).HttpsProxy, global::System.Convert.ToString); + } + if (content.Contains("NoProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)this).NoProxy = (string[]) content.GetValueForProperty("NoProxy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)this).NoProxy, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("TrustedCa")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)this).TrustedCa = (string) content.GetValueForProperty("TrustedCa",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)this).TrustedCa, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HttpProxyConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HttpProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)this).HttpProxy = (string) content.GetValueForProperty("HttpProxy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)this).HttpProxy, global::System.Convert.ToString); + } + if (content.Contains("HttpsProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)this).HttpsProxy = (string) content.GetValueForProperty("HttpsProxy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)this).HttpsProxy, global::System.Convert.ToString); + } + if (content.Contains("NoProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)this).NoProxy = (string[]) content.GetValueForProperty("NoProxy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)this).NoProxy, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("TrustedCa")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)this).TrustedCa = (string) content.GetValueForProperty("TrustedCa",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)this).TrustedCa, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HTTP Proxy configuration for the VM. + [System.ComponentModel.TypeConverter(typeof(HttpProxyConfigurationTypeConverter))] + public partial interface IHttpProxyConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HttpProxyConfiguration.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HttpProxyConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..d47bf941bc77 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HttpProxyConfiguration.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HttpProxyConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HttpProxyConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HttpProxyConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HttpProxyConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HttpProxyConfiguration.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HttpProxyConfiguration.cs new file mode 100644 index 000000000000..c883b6d106f3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HttpProxyConfiguration.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// HTTP Proxy configuration for the VM. + public partial class HttpProxyConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal + { + + /// Backing field for property. + private string _httpProxy; + + /// The HTTP proxy server endpoint to use. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string HttpProxy { get => this._httpProxy; set => this._httpProxy = value; } + + /// Backing field for property. + private string _httpsProxy; + + /// The HTTPS proxy server endpoint to use. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string HttpsProxy { get => this._httpsProxy; set => this._httpsProxy = value; } + + /// Backing field for property. + private string[] _noProxy; + + /// The endpoints that should not go through proxy. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string[] NoProxy { get => this._noProxy; set => this._noProxy = value; } + + /// Backing field for property. + private string _trustedCa; + + /// Alternative CA cert to use for connecting to proxy servers. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string TrustedCa { get => this._trustedCa; set => this._trustedCa = value; } + + /// Creates an new instance. + public HttpProxyConfiguration() + { + + } + } + /// HTTP Proxy configuration for the VM. + public partial interface IHttpProxyConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The HTTP proxy server endpoint to use. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The HTTP proxy server endpoint to use.", + SerializedName = @"httpProxy", + PossibleTypes = new [] { typeof(string) })] + string HttpProxy { get; set; } + /// The HTTPS proxy server endpoint to use. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The HTTPS proxy server endpoint to use.", + SerializedName = @"httpsProxy", + PossibleTypes = new [] { typeof(string) })] + string HttpsProxy { get; set; } + /// The endpoints that should not go through proxy. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The endpoints that should not go through proxy.", + SerializedName = @"noProxy", + PossibleTypes = new [] { typeof(string) })] + string[] NoProxy { get; set; } + /// Alternative CA cert to use for connecting to proxy servers. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Alternative CA cert to use for connecting to proxy servers.", + SerializedName = @"trustedCa", + PossibleTypes = new [] { typeof(string) })] + string TrustedCa { get; set; } + + } + /// HTTP Proxy configuration for the VM. + internal partial interface IHttpProxyConfigurationInternal + + { + /// The HTTP proxy server endpoint to use. + string HttpProxy { get; set; } + /// The HTTPS proxy server endpoint to use. + string HttpsProxy { get; set; } + /// The endpoints that should not go through proxy. + string[] NoProxy { get; set; } + /// Alternative CA cert to use for connecting to proxy servers. + string TrustedCa { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HttpProxyConfiguration.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HttpProxyConfiguration.json.cs new file mode 100644 index 000000000000..ffc329f21622 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HttpProxyConfiguration.json.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// HTTP Proxy configuration for the VM. + public partial class HttpProxyConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new HttpProxyConfiguration(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal HttpProxyConfiguration(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_httpProxy = If( json?.PropertyT("httpProxy"), out var __jsonHttpProxy) ? (string)__jsonHttpProxy : (string)HttpProxy;} + {_httpsProxy = If( json?.PropertyT("httpsProxy"), out var __jsonHttpsProxy) ? (string)__jsonHttpsProxy : (string)HttpsProxy;} + {_noProxy = If( json?.PropertyT("noProxy"), out var __jsonNoProxy) ? If( __jsonNoProxy as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : NoProxy;} + {_trustedCa = If( json?.PropertyT("trustedCa"), out var __jsonTrustedCa) ? (string)__jsonTrustedCa : (string)TrustedCa;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._httpProxy)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._httpProxy.ToString()) : null, "httpProxy" ,container.Add ); + AddIf( null != (((object)this._httpsProxy)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._httpsProxy.ToString()) : null, "httpsProxy" ,container.Add ); + if (null != this._noProxy) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._noProxy ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("noProxy",__w); + } + AddIf( null != (((object)this._trustedCa)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._trustedCa.ToString()) : null, "trustedCa" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadata.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadata.PowerShell.cs new file mode 100644 index 000000000000..7eab52dbf5c4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadata.PowerShell.cs @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Defines the HybridIdentityMetadata. + [System.ComponentModel.TypeConverter(typeof(HybridIdentityMetadataTypeConverter))] + public partial class HybridIdentityMetadata + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HybridIdentityMetadata(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HybridIdentityMetadata(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HybridIdentityMetadata(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HybridIdentityMetadataPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Identity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IdentityTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceUid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).ResourceUid = (string) content.GetValueForProperty("ResourceUid",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).ResourceUid, global::System.Convert.ToString); + } + if (content.Contains("PublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).PublicKey, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("IdentityPrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).IdentityPrincipalId = (string) content.GetValueForProperty("IdentityPrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).IdentityPrincipalId, global::System.Convert.ToString); + } + if (content.Contains("IdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).IdentityTenantId = (string) content.GetValueForProperty("IdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).IdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("IdentityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).IdentityType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType?) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).IdentityType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HybridIdentityMetadata(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HybridIdentityMetadataPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Identity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IdentityTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceUid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).ResourceUid = (string) content.GetValueForProperty("ResourceUid",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).ResourceUid, global::System.Convert.ToString); + } + if (content.Contains("PublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).PublicKey, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("IdentityPrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).IdentityPrincipalId = (string) content.GetValueForProperty("IdentityPrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).IdentityPrincipalId, global::System.Convert.ToString); + } + if (content.Contains("IdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).IdentityTenantId = (string) content.GetValueForProperty("IdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).IdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("IdentityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).IdentityType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType?) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal)this).IdentityType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Defines the HybridIdentityMetadata. + [System.ComponentModel.TypeConverter(typeof(HybridIdentityMetadataTypeConverter))] + public partial interface IHybridIdentityMetadata + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadata.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadata.TypeConverter.cs new file mode 100644 index 000000000000..68e163349cd2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadata.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HybridIdentityMetadataTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HybridIdentityMetadata.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HybridIdentityMetadata.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HybridIdentityMetadata.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadata.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadata.cs new file mode 100644 index 000000000000..00d75480a846 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadata.cs @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Defines the HybridIdentityMetadata. + public partial class HybridIdentityMetadata : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Resource(); + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Id; } + + /// The principal ID of resource identity. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentityPrincipalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)Property).IdentityPrincipalId; } + + /// The tenant ID of resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)Property).IdentityTenantId; } + + /// The identity type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)Property).IdentityType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)Property).IdentityType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType)""); } + + /// Internal Acessors for Identity + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal.Identity { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)Property).Identity; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)Property).Identity = value; } + + /// Internal Acessors for IdentityPrincipalId + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal.IdentityPrincipalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)Property).IdentityPrincipalId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)Property).IdentityPrincipalId = value; } + + /// Internal Acessors for IdentityTenantId + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal.IdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)Property).IdentityTenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)Property).IdentityTenantId = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HybridIdentityMetadataProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemData = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataProperties _property; + + /// Resource properties. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HybridIdentityMetadataProperties()); set => this._property = value; } + + /// The provisioning state. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)Property).ProvisioningState; } + + /// The Public Key. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string PublicKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)Property).PublicKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)Property).PublicKey = value ?? null; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// The unique identifier for the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ResourceUid { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)Property).ResourceUid; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)Property).ResourceUid = value ?? null; } + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemData; } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public HybridIdentityMetadata() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Defines the HybridIdentityMetadata. + public partial interface IHybridIdentityMetadata : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource + { + /// The principal ID of resource identity. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The principal ID of resource identity.", + SerializedName = @"principalId", + PossibleTypes = new [] { typeof(string) })] + string IdentityPrincipalId { get; } + /// The tenant ID of resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The tenant ID of resource.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string IdentityTenantId { get; } + /// The identity type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identity type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get; set; } + /// The provisioning state. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The provisioning state.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningState { get; } + /// The Public Key. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Public Key.", + SerializedName = @"publicKey", + PossibleTypes = new [] { typeof(string) })] + string PublicKey { get; set; } + /// The unique identifier for the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The unique identifier for the resource.", + SerializedName = @"resourceUid", + PossibleTypes = new [] { typeof(string) })] + string ResourceUid { get; set; } + + } + /// Defines the HybridIdentityMetadata. + internal partial interface IHybridIdentityMetadataInternal : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal + { + /// Identity for the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity Identity { get; set; } + /// The principal ID of resource identity. + string IdentityPrincipalId { get; set; } + /// The tenant ID of resource. + string IdentityTenantId { get; set; } + /// The identity type. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get; set; } + /// Resource properties. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataProperties Property { get; set; } + /// The provisioning state. + string ProvisioningState { get; set; } + /// The Public Key. + string PublicKey { get; set; } + /// The unique identifier for the resource. + string ResourceUid { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadata.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadata.json.cs new file mode 100644 index 000000000000..02af2d87d045 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadata.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Defines the HybridIdentityMetadata. + public partial class HybridIdentityMetadata + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new HybridIdentityMetadata(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal HybridIdentityMetadata(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HybridIdentityMetadataProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataList.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataList.PowerShell.cs new file mode 100644 index 000000000000..dd47209321fd --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataList.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// List of HybridIdentityMetadata. + [System.ComponentModel.TypeConverter(typeof(HybridIdentityMetadataListTypeConverter))] + public partial class HybridIdentityMetadataList + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataList DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HybridIdentityMetadataList(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HybridIdentityMetadataList(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HybridIdentityMetadataList(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataListInternal)this).NextLink, global::System.Convert.ToString); + } + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataListInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataListInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HybridIdentityMetadataTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HybridIdentityMetadataList(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataListInternal)this).NextLink, global::System.Convert.ToString); + } + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataListInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataListInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HybridIdentityMetadataTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// List of HybridIdentityMetadata. + [System.ComponentModel.TypeConverter(typeof(HybridIdentityMetadataListTypeConverter))] + public partial interface IHybridIdentityMetadataList + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataList.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataList.TypeConverter.cs new file mode 100644 index 000000000000..169835931acd --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataList.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HybridIdentityMetadataListTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataList ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataList).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HybridIdentityMetadataList.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HybridIdentityMetadataList.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HybridIdentityMetadataList.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataList.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataList.cs new file mode 100644 index 000000000000..27c58f58a862 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataList.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// List of HybridIdentityMetadata. + public partial class HybridIdentityMetadataList : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataList, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataListInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Url to follow for getting next page of HybridIdentityMetadata. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata[] _value; + + /// Array of HybridIdentityMetadata + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public HybridIdentityMetadataList() + { + + } + } + /// List of HybridIdentityMetadata. + public partial interface IHybridIdentityMetadataList : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Url to follow for getting next page of HybridIdentityMetadata. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Url to follow for getting next page of HybridIdentityMetadata.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Array of HybridIdentityMetadata + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Array of HybridIdentityMetadata", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata[] Value { get; set; } + + } + /// List of HybridIdentityMetadata. + internal partial interface IHybridIdentityMetadataListInternal + + { + /// Url to follow for getting next page of HybridIdentityMetadata. + string NextLink { get; set; } + /// Array of HybridIdentityMetadata + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataList.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataList.json.cs new file mode 100644 index 000000000000..1b0d401731ec --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataList.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// List of HybridIdentityMetadata. + public partial class HybridIdentityMetadataList + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataList. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataList. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataList FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new HybridIdentityMetadataList(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal HybridIdentityMetadataList(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HybridIdentityMetadata.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataProperties.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataProperties.PowerShell.cs new file mode 100644 index 000000000000..b5bc23998240 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataProperties.PowerShell.cs @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Defines the resource properties. + [System.ComponentModel.TypeConverter(typeof(HybridIdentityMetadataPropertiesTypeConverter))] + public partial class HybridIdentityMetadataProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HybridIdentityMetadataProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HybridIdentityMetadataProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HybridIdentityMetadataProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Identity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IdentityTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceUid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).ResourceUid = (string) content.GetValueForProperty("ResourceUid",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).ResourceUid, global::System.Convert.ToString); + } + if (content.Contains("PublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).PublicKey, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("IdentityPrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).IdentityPrincipalId = (string) content.GetValueForProperty("IdentityPrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).IdentityPrincipalId, global::System.Convert.ToString); + } + if (content.Contains("IdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).IdentityTenantId = (string) content.GetValueForProperty("IdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).IdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("IdentityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).IdentityType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType?) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).IdentityType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HybridIdentityMetadataProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Identity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IdentityTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceUid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).ResourceUid = (string) content.GetValueForProperty("ResourceUid",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).ResourceUid, global::System.Convert.ToString); + } + if (content.Contains("PublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).PublicKey, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).ProvisioningState, global::System.Convert.ToString); + } + if (content.Contains("IdentityPrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).IdentityPrincipalId = (string) content.GetValueForProperty("IdentityPrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).IdentityPrincipalId, global::System.Convert.ToString); + } + if (content.Contains("IdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).IdentityTenantId = (string) content.GetValueForProperty("IdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).IdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("IdentityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).IdentityType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType?) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal)this).IdentityType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Defines the resource properties. + [System.ComponentModel.TypeConverter(typeof(HybridIdentityMetadataPropertiesTypeConverter))] + public partial interface IHybridIdentityMetadataProperties + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataProperties.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataProperties.TypeConverter.cs new file mode 100644 index 000000000000..d932de80ea4e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HybridIdentityMetadataPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HybridIdentityMetadataProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HybridIdentityMetadataProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HybridIdentityMetadataProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataProperties.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataProperties.cs new file mode 100644 index 000000000000..7cc86e99e05f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataProperties.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Defines the resource properties. + public partial class HybridIdentityMetadataProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataProperties, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity _identity; + + /// Identity for the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity Identity { get => (this._identity = this._identity ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Identity()); } + + /// The principal ID of resource identity. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentityPrincipalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).PrincipalId; } + + /// The tenant ID of resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).TenantId; } + + /// The identity type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).Type = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType)""); } + + /// Internal Acessors for Identity + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal.Identity { get => (this._identity = this._identity ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Identity()); set { {_identity = value;} } } + + /// Internal Acessors for IdentityPrincipalId + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal.IdentityPrincipalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).PrincipalId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).PrincipalId = value; } + + /// Internal Acessors for IdentityTenantId + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal.IdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).TenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).TenantId = value; } + + /// Internal Acessors for ProvisioningState + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Backing field for property. + private string _provisioningState; + + /// The provisioning state. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ProvisioningState { get => this._provisioningState; } + + /// Backing field for property. + private string _publicKey; + + /// The Public Key. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string PublicKey { get => this._publicKey; set => this._publicKey = value; } + + /// Backing field for property. + private string _resourceUid; + + /// The unique identifier for the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ResourceUid { get => this._resourceUid; set => this._resourceUid = value; } + + /// Creates an new instance. + public HybridIdentityMetadataProperties() + { + + } + } + /// Defines the resource properties. + public partial interface IHybridIdentityMetadataProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The principal ID of resource identity. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The principal ID of resource identity.", + SerializedName = @"principalId", + PossibleTypes = new [] { typeof(string) })] + string IdentityPrincipalId { get; } + /// The tenant ID of resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The tenant ID of resource.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string IdentityTenantId { get; } + /// The identity type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identity type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get; set; } + /// The provisioning state. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The provisioning state.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningState { get; } + /// The Public Key. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Public Key.", + SerializedName = @"publicKey", + PossibleTypes = new [] { typeof(string) })] + string PublicKey { get; set; } + /// The unique identifier for the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The unique identifier for the resource.", + SerializedName = @"resourceUid", + PossibleTypes = new [] { typeof(string) })] + string ResourceUid { get; set; } + + } + /// Defines the resource properties. + internal partial interface IHybridIdentityMetadataPropertiesInternal + + { + /// Identity for the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity Identity { get; set; } + /// The principal ID of resource identity. + string IdentityPrincipalId { get; set; } + /// The tenant ID of resource. + string IdentityTenantId { get; set; } + /// The identity type. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get; set; } + /// The provisioning state. + string ProvisioningState { get; set; } + /// The Public Key. + string PublicKey { get; set; } + /// The unique identifier for the resource. + string ResourceUid { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataProperties.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataProperties.json.cs new file mode 100644 index 000000000000..6761424c2d52 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/HybridIdentityMetadataProperties.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Defines the resource properties. + public partial class HybridIdentityMetadataProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new HybridIdentityMetadataProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal HybridIdentityMetadataProperties(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_identity = If( json?.PropertyT("identity"), out var __jsonIdentity) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Identity.FromJson(__jsonIdentity) : Identity;} + {_resourceUid = If( json?.PropertyT("resourceUid"), out var __jsonResourceUid) ? (string)__jsonResourceUid : (string)ResourceUid;} + {_publicKey = If( json?.PropertyT("publicKey"), out var __jsonPublicKey) ? (string)__jsonPublicKey : (string)PublicKey;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._identity ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._identity.ToJson(null,serializationMode) : null, "identity" ,container.Add ); + } + AddIf( null != (((object)this._resourceUid)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._resourceUid.ToString()) : null, "resourceUid" ,container.Add ); + AddIf( null != (((object)this._publicKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._publicKey.ToString()) : null, "publicKey" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfiguration.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfiguration.PowerShell.cs new file mode 100644 index 000000000000..be9e3a740514 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfiguration.PowerShell.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// InterfaceIPConfiguration iPConfiguration in a network interface. + [System.ComponentModel.TypeConverter(typeof(IPConfigurationTypeConverter))] + public partial class IPConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new IPConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new IPConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal IPConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPConfigurationPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Subnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).Subnet = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnet) content.GetValueForProperty("Subnet",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).Subnet, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPConfigurationPropertiesSubnetTypeConverter.ConvertFrom); + } + if (content.Contains("Gateway")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).Gateway = (string) content.GetValueForProperty("Gateway",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).Gateway, global::System.Convert.ToString); + } + if (content.Contains("PrefixLength")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).PrefixLength = (string) content.GetValueForProperty("PrefixLength",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).PrefixLength, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("SubnetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).SubnetId = (string) content.GetValueForProperty("SubnetId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).SubnetId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal IPConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPConfigurationPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Subnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).Subnet = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnet) content.GetValueForProperty("Subnet",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).Subnet, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPConfigurationPropertiesSubnetTypeConverter.ConvertFrom); + } + if (content.Contains("Gateway")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).Gateway = (string) content.GetValueForProperty("Gateway",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).Gateway, global::System.Convert.ToString); + } + if (content.Contains("PrefixLength")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).PrefixLength = (string) content.GetValueForProperty("PrefixLength",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).PrefixLength, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("SubnetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).SubnetId = (string) content.GetValueForProperty("SubnetId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal)this).SubnetId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InterfaceIPConfiguration iPConfiguration in a network interface. + [System.ComponentModel.TypeConverter(typeof(IPConfigurationTypeConverter))] + public partial interface IIPConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfiguration.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..461fb5ad6a97 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfiguration.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class IPConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return IPConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return IPConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return IPConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfiguration.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfiguration.cs new file mode 100644 index 000000000000..b29db9925bc5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfiguration.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// InterfaceIPConfiguration iPConfiguration in a network interface. + public partial class IPConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal + { + + /// Gateway for network interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string Gateway { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)Property).Gateway; } + + /// PrivateIPAddress - Private IP address of the IP configuration. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IPAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)Property).PrivateIPAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)Property).PrivateIPAddress = value ?? null; } + + /// Internal Acessors for Gateway + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal.Gateway { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)Property).Gateway; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)Property).Gateway = value; } + + /// Internal Acessors for PrefixLength + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal.PrefixLength { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)Property).PrefixLength; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)Property).PrefixLength = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPConfigurationProperties()); set { {_property = value;} } } + + /// Internal Acessors for Subnet + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnet Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationInternal.Subnet { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)Property).Subnet; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)Property).Subnet = value; } + + /// Backing field for property. + private string _name; + + /// + /// Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// prefixLength for network interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string PrefixLength { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)Property).PrefixLength; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationProperties _property; + + /// InterfaceIPConfigurationPropertiesFormat properties of IP configuration. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPConfigurationProperties()); set => this._property = value; } + + /// + /// ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string SubnetId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)Property).SubnetId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)Property).SubnetId = value ?? null; } + + /// Creates an new instance. + public IPConfiguration() + { + + } + } + /// InterfaceIPConfiguration iPConfiguration in a network interface. + public partial interface IIPConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Gateway for network interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gateway for network interface", + SerializedName = @"gateway", + PossibleTypes = new [] { typeof(string) })] + string Gateway { get; } + /// PrivateIPAddress - Private IP address of the IP configuration. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"PrivateIPAddress - Private IP address of the IP configuration.", + SerializedName = @"privateIPAddress", + PossibleTypes = new [] { typeof(string) })] + string IPAddress { get; set; } + /// + /// Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Name - The name of the resource that is unique within a resource group. This name can be used to access the resource.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// prefixLength for network interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"prefixLength for network interface", + SerializedName = @"prefixLength", + PossibleTypes = new [] { typeof(string) })] + string PrefixLength { get; } + /// + /// ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/...", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string SubnetId { get; set; } + + } + /// InterfaceIPConfiguration iPConfiguration in a network interface. + internal partial interface IIPConfigurationInternal + + { + /// Gateway for network interface + string Gateway { get; set; } + /// PrivateIPAddress - Private IP address of the IP configuration. + string IPAddress { get; set; } + /// + /// Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + /// + string Name { get; set; } + /// prefixLength for network interface + string PrefixLength { get; set; } + /// InterfaceIPConfigurationPropertiesFormat properties of IP configuration. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationProperties Property { get; set; } + /// Subnet - Name of Subnet bound to the IP configuration. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnet Subnet { get; set; } + /// + /// ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + /// + string SubnetId { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfiguration.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfiguration.json.cs new file mode 100644 index 000000000000..8704b51d7173 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfiguration.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// InterfaceIPConfiguration iPConfiguration in a network interface. + public partial class IPConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new IPConfiguration(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal IPConfiguration(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPConfigurationProperties.FromJson(__jsonProperties) : Property;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationProperties.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationProperties.PowerShell.cs new file mode 100644 index 000000000000..c240f8e355ab --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationProperties.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// InterfaceIPConfigurationPropertiesFormat properties of IP configuration. + [System.ComponentModel.TypeConverter(typeof(IPConfigurationPropertiesTypeConverter))] + public partial class IPConfigurationProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new IPConfigurationProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new IPConfigurationProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal IPConfigurationProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Subnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)this).Subnet = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnet) content.GetValueForProperty("Subnet",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)this).Subnet, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPConfigurationPropertiesSubnetTypeConverter.ConvertFrom); + } + if (content.Contains("Gateway")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)this).Gateway = (string) content.GetValueForProperty("Gateway",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)this).Gateway, global::System.Convert.ToString); + } + if (content.Contains("PrefixLength")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)this).PrefixLength = (string) content.GetValueForProperty("PrefixLength",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)this).PrefixLength, global::System.Convert.ToString); + } + if (content.Contains("PrivateIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)this).PrivateIPAddress = (string) content.GetValueForProperty("PrivateIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)this).PrivateIPAddress, global::System.Convert.ToString); + } + if (content.Contains("SubnetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)this).SubnetId = (string) content.GetValueForProperty("SubnetId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)this).SubnetId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal IPConfigurationProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Subnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)this).Subnet = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnet) content.GetValueForProperty("Subnet",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)this).Subnet, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPConfigurationPropertiesSubnetTypeConverter.ConvertFrom); + } + if (content.Contains("Gateway")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)this).Gateway = (string) content.GetValueForProperty("Gateway",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)this).Gateway, global::System.Convert.ToString); + } + if (content.Contains("PrefixLength")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)this).PrefixLength = (string) content.GetValueForProperty("PrefixLength",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)this).PrefixLength, global::System.Convert.ToString); + } + if (content.Contains("PrivateIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)this).PrivateIPAddress = (string) content.GetValueForProperty("PrivateIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)this).PrivateIPAddress, global::System.Convert.ToString); + } + if (content.Contains("SubnetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)this).SubnetId = (string) content.GetValueForProperty("SubnetId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal)this).SubnetId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InterfaceIPConfigurationPropertiesFormat properties of IP configuration. + [System.ComponentModel.TypeConverter(typeof(IPConfigurationPropertiesTypeConverter))] + public partial interface IIPConfigurationProperties + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationProperties.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationProperties.TypeConverter.cs new file mode 100644 index 000000000000..eb9a08f9a02a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class IPConfigurationPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return IPConfigurationProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return IPConfigurationProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return IPConfigurationProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationProperties.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationProperties.cs new file mode 100644 index 000000000000..c8c07024f444 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationProperties.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// InterfaceIPConfigurationPropertiesFormat properties of IP configuration. + public partial class IPConfigurationProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationProperties, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal + { + + /// Backing field for property. + private string _gateway; + + /// Gateway for network interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Gateway { get => this._gateway; } + + /// Internal Acessors for Gateway + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal.Gateway { get => this._gateway; set { {_gateway = value;} } } + + /// Internal Acessors for PrefixLength + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal.PrefixLength { get => this._prefixLength; set { {_prefixLength = value;} } } + + /// Internal Acessors for Subnet + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnet Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesInternal.Subnet { get => (this._subnet = this._subnet ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPConfigurationPropertiesSubnet()); set { {_subnet = value;} } } + + /// Backing field for property. + private string _prefixLength; + + /// prefixLength for network interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string PrefixLength { get => this._prefixLength; } + + /// Backing field for property. + private string _privateIPAddress; + + /// PrivateIPAddress - Private IP address of the IP configuration. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string PrivateIPAddress { get => this._privateIPAddress; set => this._privateIPAddress = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnet _subnet; + + /// Subnet - Name of Subnet bound to the IP configuration. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnet Subnet { get => (this._subnet = this._subnet ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPConfigurationPropertiesSubnet()); set => this._subnet = value; } + + /// + /// ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string SubnetId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnetInternal)Subnet).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnetInternal)Subnet).Id = value ?? null; } + + /// Creates an new instance. + public IPConfigurationProperties() + { + + } + } + /// InterfaceIPConfigurationPropertiesFormat properties of IP configuration. + public partial interface IIPConfigurationProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Gateway for network interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gateway for network interface", + SerializedName = @"gateway", + PossibleTypes = new [] { typeof(string) })] + string Gateway { get; } + /// prefixLength for network interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"prefixLength for network interface", + SerializedName = @"prefixLength", + PossibleTypes = new [] { typeof(string) })] + string PrefixLength { get; } + /// PrivateIPAddress - Private IP address of the IP configuration. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"PrivateIPAddress - Private IP address of the IP configuration.", + SerializedName = @"privateIPAddress", + PossibleTypes = new [] { typeof(string) })] + string PrivateIPAddress { get; set; } + /// + /// ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/...", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string SubnetId { get; set; } + + } + /// InterfaceIPConfigurationPropertiesFormat properties of IP configuration. + internal partial interface IIPConfigurationPropertiesInternal + + { + /// Gateway for network interface + string Gateway { get; set; } + /// prefixLength for network interface + string PrefixLength { get; set; } + /// PrivateIPAddress - Private IP address of the IP configuration. + string PrivateIPAddress { get; set; } + /// Subnet - Name of Subnet bound to the IP configuration. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnet Subnet { get; set; } + /// + /// ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + /// + string SubnetId { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationProperties.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationProperties.json.cs new file mode 100644 index 000000000000..54f43ec20dba --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationProperties.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// InterfaceIPConfigurationPropertiesFormat properties of IP configuration. + public partial class IPConfigurationProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new IPConfigurationProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal IPConfigurationProperties(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_subnet = If( json?.PropertyT("subnet"), out var __jsonSubnet) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPConfigurationPropertiesSubnet.FromJson(__jsonSubnet) : Subnet;} + {_gateway = If( json?.PropertyT("gateway"), out var __jsonGateway) ? (string)__jsonGateway : (string)Gateway;} + {_prefixLength = If( json?.PropertyT("prefixLength"), out var __jsonPrefixLength) ? (string)__jsonPrefixLength : (string)PrefixLength;} + {_privateIPAddress = If( json?.PropertyT("privateIPAddress"), out var __jsonPrivateIPAddress) ? (string)__jsonPrivateIPAddress : (string)PrivateIPAddress;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._subnet ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._subnet.ToJson(null,serializationMode) : null, "subnet" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._gateway)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._gateway.ToString()) : null, "gateway" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._prefixLength)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._prefixLength.ToString()) : null, "prefixLength" ,container.Add ); + } + AddIf( null != (((object)this._privateIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._privateIPAddress.ToString()) : null, "privateIPAddress" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationPropertiesSubnet.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationPropertiesSubnet.PowerShell.cs new file mode 100644 index 000000000000..ad1c2303e164 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationPropertiesSubnet.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Subnet - Name of Subnet bound to the IP configuration. + [System.ComponentModel.TypeConverter(typeof(IPConfigurationPropertiesSubnetTypeConverter))] + public partial class IPConfigurationPropertiesSubnet + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnet DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new IPConfigurationPropertiesSubnet(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnet DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new IPConfigurationPropertiesSubnet(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnet FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal IPConfigurationPropertiesSubnet(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnetInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnetInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal IPConfigurationPropertiesSubnet(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnetInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnetInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Subnet - Name of Subnet bound to the IP configuration. + [System.ComponentModel.TypeConverter(typeof(IPConfigurationPropertiesSubnetTypeConverter))] + public partial interface IIPConfigurationPropertiesSubnet + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationPropertiesSubnet.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationPropertiesSubnet.TypeConverter.cs new file mode 100644 index 000000000000..8f2e96623204 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationPropertiesSubnet.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class IPConfigurationPropertiesSubnetTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnet ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnet).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return IPConfigurationPropertiesSubnet.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return IPConfigurationPropertiesSubnet.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return IPConfigurationPropertiesSubnet.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationPropertiesSubnet.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationPropertiesSubnet.cs new file mode 100644 index 000000000000..07b697334577 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationPropertiesSubnet.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Subnet - Name of Subnet bound to the IP configuration. + public partial class IPConfigurationPropertiesSubnet : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnetInternal + { + + /// Backing field for property. + private string _id; + + /// + /// ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// Creates an new instance. + public IPConfigurationPropertiesSubnet() + { + + } + } + /// Subnet - Name of Subnet bound to the IP configuration. + public partial interface IIPConfigurationPropertiesSubnet : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// + /// ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/...", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + + } + /// Subnet - Name of Subnet bound to the IP configuration. + internal partial interface IIPConfigurationPropertiesSubnetInternal + + { + /// + /// ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + /// + string Id { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationPropertiesSubnet.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationPropertiesSubnet.json.cs new file mode 100644 index 000000000000..dcc4a698a07c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPConfigurationPropertiesSubnet.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Subnet - Name of Subnet bound to the IP configuration. + public partial class IPConfigurationPropertiesSubnet + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnet. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnet. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfigurationPropertiesSubnet FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new IPConfigurationPropertiesSubnet(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal IPConfigurationPropertiesSubnet(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPool.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPool.PowerShell.cs new file mode 100644 index 000000000000..e69363cf0487 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPool.PowerShell.cs @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(IPPoolTypeConverter))] + public partial class IPPool + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new IPPool(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new IPPool(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal IPPool(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Info")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfo) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPPoolInfoTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).Type = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPPoolTypeEnum?) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).Type, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPPoolTypeEnum.CreateFrom); + } + if (content.Contains("Start")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).Start = (string) content.GetValueForProperty("Start",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).Start, global::System.Convert.ToString); + } + if (content.Contains("End")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).End = (string) content.GetValueForProperty("End",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).End, global::System.Convert.ToString); + } + if (content.Contains("InfoUsed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).InfoUsed = (string) content.GetValueForProperty("InfoUsed",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).InfoUsed, global::System.Convert.ToString); + } + if (content.Contains("InfoAvailable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).InfoAvailable = (string) content.GetValueForProperty("InfoAvailable",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).InfoAvailable, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal IPPool(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Info")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfo) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPPoolInfoTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).Type = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPPoolTypeEnum?) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).Type, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPPoolTypeEnum.CreateFrom); + } + if (content.Contains("Start")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).Start = (string) content.GetValueForProperty("Start",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).Start, global::System.Convert.ToString); + } + if (content.Contains("End")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).End = (string) content.GetValueForProperty("End",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).End, global::System.Convert.ToString); + } + if (content.Contains("InfoUsed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).InfoUsed = (string) content.GetValueForProperty("InfoUsed",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).InfoUsed, global::System.Convert.ToString); + } + if (content.Contains("InfoAvailable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).InfoAvailable = (string) content.GetValueForProperty("InfoAvailable",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal)this).InfoAvailable, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(IPPoolTypeConverter))] + public partial interface IIPPool + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPool.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPool.TypeConverter.cs new file mode 100644 index 000000000000..bf66647cf318 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPool.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class IPPoolTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return IPPool.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return IPPool.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return IPPool.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPool.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPool.cs new file mode 100644 index 000000000000..0b585109152e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPool.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class IPPool : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal + { + + /// Backing field for property. + private string _end; + + /// End of the IP address pool + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string End { get => this._end; set => this._end = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfo _info; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfo Info { get => (this._info = this._info ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPPoolInfo()); set => this._info = value; } + + /// Number of IP addresses available in the IP Pool + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string InfoAvailable { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfoInternal)Info).Available; } + + /// Number of IP addresses allocated from the IP Pool + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string InfoUsed { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfoInternal)Info).Used; } + + /// Internal Acessors for Info + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfo Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal.Info { get => (this._info = this._info ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPPoolInfo()); set { {_info = value;} } } + + /// Internal Acessors for InfoAvailable + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal.InfoAvailable { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfoInternal)Info).Available; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfoInternal)Info).Available = value; } + + /// Internal Acessors for InfoUsed + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInternal.InfoUsed { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfoInternal)Info).Used; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfoInternal)Info).Used = value; } + + /// Backing field for property. + private string _name; + + /// Name of the IP-Pool + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _start; + + /// Start of the IP address pool + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Start { get => this._start; set => this._start = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPPoolTypeEnum? _type; + + /// Type of the IP Pool [vm, vippool] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPPoolTypeEnum? Type { get => this._type; set => this._type = value; } + + /// Creates an new instance. + public IPPool() + { + + } + } + public partial interface IIPPool : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// End of the IP address pool + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"End of the IP address pool", + SerializedName = @"end", + PossibleTypes = new [] { typeof(string) })] + string End { get; set; } + /// Number of IP addresses available in the IP Pool + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Number of IP addresses available in the IP Pool", + SerializedName = @"available", + PossibleTypes = new [] { typeof(string) })] + string InfoAvailable { get; } + /// Number of IP addresses allocated from the IP Pool + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Number of IP addresses allocated from the IP Pool", + SerializedName = @"used", + PossibleTypes = new [] { typeof(string) })] + string InfoUsed { get; } + /// Name of the IP-Pool + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Name of the IP-Pool", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Start of the IP address pool + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Start of the IP address pool", + SerializedName = @"start", + PossibleTypes = new [] { typeof(string) })] + string Start { get; set; } + /// Type of the IP Pool [vm, vippool] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Type of the IP Pool [vm, vippool]", + SerializedName = @"ipPoolType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPPoolTypeEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPPoolTypeEnum? Type { get; set; } + + } + internal partial interface IIPPoolInternal + + { + /// End of the IP address pool + string End { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfo Info { get; set; } + /// Number of IP addresses available in the IP Pool + string InfoAvailable { get; set; } + /// Number of IP addresses allocated from the IP Pool + string InfoUsed { get; set; } + /// Name of the IP-Pool + string Name { get; set; } + /// Start of the IP address pool + string Start { get; set; } + /// Type of the IP Pool [vm, vippool] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPPoolTypeEnum? Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPool.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPool.json.cs new file mode 100644 index 000000000000..67b6c744550f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPool.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class IPPool + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new IPPool(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal IPPool(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_info = If( json?.PropertyT("info"), out var __jsonInfo) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPPoolInfo.FromJson(__jsonInfo) : Info;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_type = If( json?.PropertyT("ipPoolType"), out var __jsonIPPoolType) ? (string)__jsonIPPoolType : (string)Type;} + {_start = If( json?.PropertyT("start"), out var __jsonStart) ? (string)__jsonStart : (string)Start;} + {_end = If( json?.PropertyT("end"), out var __jsonEnd) ? (string)__jsonEnd : (string)End;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._info ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._info.ToJson(null,serializationMode) : null, "info" ,container.Add ); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._type.ToString()) : null, "ipPoolType" ,container.Add ); + AddIf( null != (((object)this._start)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._start.ToString()) : null, "start" ,container.Add ); + AddIf( null != (((object)this._end)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._end.ToString()) : null, "end" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPoolInfo.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPoolInfo.PowerShell.cs new file mode 100644 index 000000000000..4d57ee66da1f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPoolInfo.PowerShell.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(IPPoolInfoTypeConverter))] + public partial class IPPoolInfo + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfo DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new IPPoolInfo(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfo DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new IPPoolInfo(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfo FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal IPPoolInfo(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Used")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfoInternal)this).Used = (string) content.GetValueForProperty("Used",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfoInternal)this).Used, global::System.Convert.ToString); + } + if (content.Contains("Available")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfoInternal)this).Available = (string) content.GetValueForProperty("Available",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfoInternal)this).Available, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal IPPoolInfo(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Used")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfoInternal)this).Used = (string) content.GetValueForProperty("Used",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfoInternal)this).Used, global::System.Convert.ToString); + } + if (content.Contains("Available")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfoInternal)this).Available = (string) content.GetValueForProperty("Available",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfoInternal)this).Available, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(IPPoolInfoTypeConverter))] + public partial interface IIPPoolInfo + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPoolInfo.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPoolInfo.TypeConverter.cs new file mode 100644 index 000000000000..2bfb6ada1b9b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPoolInfo.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class IPPoolInfoTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfo ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfo).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return IPPoolInfo.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return IPPoolInfo.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return IPPoolInfo.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPoolInfo.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPoolInfo.cs new file mode 100644 index 000000000000..407dc3ef4e4a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPoolInfo.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class IPPoolInfo : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfo, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfoInternal + { + + /// Backing field for property. + private string _available; + + /// Number of IP addresses available in the IP Pool + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Available { get => this._available; } + + /// Internal Acessors for Available + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfoInternal.Available { get => this._available; set { {_available = value;} } } + + /// Internal Acessors for Used + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfoInternal.Used { get => this._used; set { {_used = value;} } } + + /// Backing field for property. + private string _used; + + /// Number of IP addresses allocated from the IP Pool + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Used { get => this._used; } + + /// Creates an new instance. + public IPPoolInfo() + { + + } + } + public partial interface IIPPoolInfo : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Number of IP addresses available in the IP Pool + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Number of IP addresses available in the IP Pool", + SerializedName = @"available", + PossibleTypes = new [] { typeof(string) })] + string Available { get; } + /// Number of IP addresses allocated from the IP Pool + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Number of IP addresses allocated from the IP Pool", + SerializedName = @"used", + PossibleTypes = new [] { typeof(string) })] + string Used { get; } + + } + internal partial interface IIPPoolInfoInternal + + { + /// Number of IP addresses available in the IP Pool + string Available { get; set; } + /// Number of IP addresses allocated from the IP Pool + string Used { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPoolInfo.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPoolInfo.json.cs new file mode 100644 index 000000000000..f42c358fe7c1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/IPPoolInfo.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class IPPoolInfo + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfo. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfo. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPoolInfo FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new IPPoolInfo(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal IPPoolInfo(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_used = If( json?.PropertyT("used"), out var __jsonUsed) ? (string)__jsonUsed : (string)Used;} + {_available = If( json?.PropertyT("available"), out var __jsonAvailable) ? (string)__jsonAvailable : (string)Available;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._used)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._used.ToString()) : null, "used" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._available)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._available.ToString()) : null, "available" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InstanceViewStatus.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InstanceViewStatus.PowerShell.cs new file mode 100644 index 000000000000..cc49cf7747fc --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InstanceViewStatus.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Instance view status. + [System.ComponentModel.TypeConverter(typeof(InstanceViewStatusTypeConverter))] + public partial class InstanceViewStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InstanceViewStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InstanceViewStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InstanceViewStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatusInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatusInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Level")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatusInternal)this).Level = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes?) content.GetValueForProperty("Level",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatusInternal)this).Level, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes.CreateFrom); + } + if (content.Contains("DisplayStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatusInternal)this).DisplayStatus = (string) content.GetValueForProperty("DisplayStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatusInternal)this).DisplayStatus, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatusInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatusInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Time")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatusInternal)this).Time = (global::System.DateTime?) content.GetValueForProperty("Time",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatusInternal)this).Time, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InstanceViewStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatusInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatusInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Level")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatusInternal)this).Level = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes?) content.GetValueForProperty("Level",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatusInternal)this).Level, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes.CreateFrom); + } + if (content.Contains("DisplayStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatusInternal)this).DisplayStatus = (string) content.GetValueForProperty("DisplayStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatusInternal)this).DisplayStatus, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatusInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatusInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Time")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatusInternal)this).Time = (global::System.DateTime?) content.GetValueForProperty("Time",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatusInternal)this).Time, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Instance view status. + [System.ComponentModel.TypeConverter(typeof(InstanceViewStatusTypeConverter))] + public partial interface IInstanceViewStatus + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InstanceViewStatus.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InstanceViewStatus.TypeConverter.cs new file mode 100644 index 000000000000..ff772de4d3a9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InstanceViewStatus.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InstanceViewStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InstanceViewStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InstanceViewStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InstanceViewStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InstanceViewStatus.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InstanceViewStatus.cs new file mode 100644 index 000000000000..639cb12caeb7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InstanceViewStatus.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Instance view status. + public partial class InstanceViewStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatusInternal + { + + /// Backing field for property. + private string _code; + + /// The status code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Code { get => this._code; set => this._code = value; } + + /// Backing field for property. + private string _displayStatus; + + /// The short localizable label for the status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string DisplayStatus { get => this._displayStatus; set => this._displayStatus = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes? _level; + + /// The level code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes? Level { get => this._level; set => this._level = value; } + + /// Backing field for property. + private string _message; + + /// The detailed status message, including for alerts and error messages. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Message { get => this._message; set => this._message = value; } + + /// Backing field for property. + private global::System.DateTime? _time; + + /// The time of the status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public global::System.DateTime? Time { get => this._time; set => this._time = value; } + + /// Creates an new instance. + public InstanceViewStatus() + { + + } + } + /// Instance view status. + public partial interface IInstanceViewStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The status code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; set; } + /// The short localizable label for the status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The short localizable label for the status.", + SerializedName = @"displayStatus", + PossibleTypes = new [] { typeof(string) })] + string DisplayStatus { get; set; } + /// The level code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The level code.", + SerializedName = @"level", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes? Level { get; set; } + /// The detailed status message, including for alerts and error messages. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The detailed status message, including for alerts and error messages.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; set; } + /// The time of the status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The time of the status.", + SerializedName = @"time", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? Time { get; set; } + + } + /// Instance view status. + internal partial interface IInstanceViewStatusInternal + + { + /// The status code. + string Code { get; set; } + /// The short localizable label for the status. + string DisplayStatus { get; set; } + /// The level code. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes? Level { get; set; } + /// The detailed status message, including for alerts and error messages. + string Message { get; set; } + /// The time of the status. + global::System.DateTime? Time { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InstanceViewStatus.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InstanceViewStatus.json.cs new file mode 100644 index 000000000000..1d78449b23ad --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InstanceViewStatus.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Instance view status. + public partial class InstanceViewStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new InstanceViewStatus(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal InstanceViewStatus(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)Code;} + {_level = If( json?.PropertyT("level"), out var __jsonLevel) ? (string)__jsonLevel : (string)Level;} + {_displayStatus = If( json?.PropertyT("displayStatus"), out var __jsonDisplayStatus) ? (string)__jsonDisplayStatus : (string)DisplayStatus;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} + {_time = If( json?.PropertyT("time"), out var __jsonTime) ? global::System.DateTime.TryParse((string)__jsonTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonTimeValue) ? __jsonTimeValue : Time : Time;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + AddIf( null != (((object)this._level)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._level.ToString()) : null, "level" ,container.Add ); + AddIf( null != (((object)this._displayStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._displayStatus.ToString()) : null, "displayStatus" ,container.Add ); + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + AddIf( null != this._time ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._time?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "time" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InterfaceDnsSettings.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InterfaceDnsSettings.PowerShell.cs new file mode 100644 index 000000000000..9a295bdc9841 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InterfaceDnsSettings.PowerShell.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(InterfaceDnsSettingsTypeConverter))] + public partial class InterfaceDnsSettings + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettings DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InterfaceDnsSettings(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettings DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InterfaceDnsSettings(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettings FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InterfaceDnsSettings(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DnsServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettingsInternal)this).DnsServer = (string[]) content.GetValueForProperty("DnsServer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettingsInternal)this).DnsServer, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InterfaceDnsSettings(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DnsServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettingsInternal)this).DnsServer = (string[]) content.GetValueForProperty("DnsServer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettingsInternal)this).DnsServer, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(InterfaceDnsSettingsTypeConverter))] + public partial interface IInterfaceDnsSettings + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InterfaceDnsSettings.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InterfaceDnsSettings.TypeConverter.cs new file mode 100644 index 000000000000..a2babc83c140 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InterfaceDnsSettings.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InterfaceDnsSettingsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettings ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettings).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InterfaceDnsSettings.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InterfaceDnsSettings.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InterfaceDnsSettings.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InterfaceDnsSettings.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InterfaceDnsSettings.cs new file mode 100644 index 000000000000..ab563d30a27f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InterfaceDnsSettings.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class InterfaceDnsSettings : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettings, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettingsInternal + { + + /// Backing field for property. + private string[] _dnsServer; + + /// List of DNS server IP Addresses for the interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string[] DnsServer { get => this._dnsServer; set => this._dnsServer = value; } + + /// Creates an new instance. + public InterfaceDnsSettings() + { + + } + } + public partial interface IInterfaceDnsSettings : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// List of DNS server IP Addresses for the interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of DNS server IP Addresses for the interface", + SerializedName = @"dnsServers", + PossibleTypes = new [] { typeof(string) })] + string[] DnsServer { get; set; } + + } + internal partial interface IInterfaceDnsSettingsInternal + + { + /// List of DNS server IP Addresses for the interface + string[] DnsServer { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InterfaceDnsSettings.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InterfaceDnsSettings.json.cs new file mode 100644 index 000000000000..c647da09165d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/InterfaceDnsSettings.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class InterfaceDnsSettings + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettings. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettings. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettings FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new InterfaceDnsSettings(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal InterfaceDnsSettings(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_dnsServer = If( json?.PropertyT("dnsServers"), out var __jsonDnsServers) ? If( __jsonDnsServers as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : DnsServer;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._dnsServer) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._dnsServer ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("dnsServers",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkProperties.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkProperties.PowerShell.cs new file mode 100644 index 000000000000..d2c510457c20 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkProperties.PowerShell.cs @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Properties under the logical network resource + [System.ComponentModel.TypeConverter(typeof(LogicalNetworkPropertiesTypeConverter))] + public partial class LogicalNetworkProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new LogicalNetworkProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new LogicalNetworkProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal LogicalNetworkProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DhcpOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).DhcpOption = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptions) content.GetValueForProperty("DhcpOption",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).DhcpOption, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkPropertiesDhcpOptionsTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkStatusTypeConverter.ConvertFrom); + } + if (content.Contains("Subnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).Subnet = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet[]) content.GetValueForProperty("Subnet",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).Subnet, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SubnetTypeConverter.ConvertFrom)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("VMSwitchName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).VMSwitchName = (string) content.GetValueForProperty("VMSwitchName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).VMSwitchName, global::System.Convert.ToString); + } + if (content.Contains("DhcpOptionDnsServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).DhcpOptionDnsServer = (string[]) content.GetValueForProperty("DhcpOptionDnsServer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).DhcpOptionDnsServer, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal LogicalNetworkProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DhcpOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).DhcpOption = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptions) content.GetValueForProperty("DhcpOption",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).DhcpOption, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkPropertiesDhcpOptionsTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkStatusTypeConverter.ConvertFrom); + } + if (content.Contains("Subnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).Subnet = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet[]) content.GetValueForProperty("Subnet",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).Subnet, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SubnetTypeConverter.ConvertFrom)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("VMSwitchName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).VMSwitchName = (string) content.GetValueForProperty("VMSwitchName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).VMSwitchName, global::System.Convert.ToString); + } + if (content.Contains("DhcpOptionDnsServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).DhcpOptionDnsServer = (string[]) content.GetValueForProperty("DhcpOptionDnsServer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).DhcpOptionDnsServer, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Properties under the logical network resource + [System.ComponentModel.TypeConverter(typeof(LogicalNetworkPropertiesTypeConverter))] + public partial interface ILogicalNetworkProperties + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkProperties.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkProperties.TypeConverter.cs new file mode 100644 index 000000000000..e12c7619428c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class LogicalNetworkPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return LogicalNetworkProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return LogicalNetworkProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return LogicalNetworkProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkProperties.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkProperties.cs new file mode 100644 index 000000000000..04d6f7f5589e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkProperties.cs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Properties under the logical network resource + public partial class LogicalNetworkProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkProperties, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptions _dhcpOption; + + /// + /// DhcpOptions contains an array of DNS servers available to VMs deployed in the logical network. Standard DHCP option for + /// a subnet overrides logical network DHCP options. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptions DhcpOption { get => (this._dhcpOption = this._dhcpOption ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkPropertiesDhcpOptions()); set => this._dhcpOption = value; } + + /// The list of DNS servers IP addresses. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string[] DhcpOptionDnsServer { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptionsInternal)DhcpOption).DnsServer; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptionsInternal)DhcpOption).DnsServer = value ?? null /* arrayOf */; } + + /// Internal Acessors for DhcpOption + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptions Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal.DhcpOption { get => (this._dhcpOption = this._dhcpOption ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkPropertiesDhcpOptions()); set { {_dhcpOption = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal.Status { get => (this._status = this._status ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkStatus()); set { {_status = value;} } } + + /// Internal Acessors for StatusProvisioningStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal.StatusProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)Status).ProvisioningStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)Status).ProvisioningStatus = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? _provisioningState; + + /// Provisioning state of the logical network. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get => this._provisioningState; } + + /// + /// The status of the operation performed on the logical network [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)Status).ProvisioningStatusStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)Status).ProvisioningStatusStatus = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status)""); } + + /// The ID of the operation performed on the logical network + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningStatusOperationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)Status).ProvisioningStatusOperationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)Status).ProvisioningStatusOperationId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatus _status; + + /// The observed state of logical networks + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatus Status { get => (this._status = this._status ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkStatus()); } + + /// LogicalNetwork provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)Status).ErrorCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)Status).ErrorCode = value ?? null; } + + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)Status).ErrorMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)Status).ErrorMessage = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet[] _subnet; + + /// Subnet - list of subnets under the logical network + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet[] Subnet { get => this._subnet; set => this._subnet = value; } + + /// Backing field for property. + private string _vMSwitchName; + + /// name of the network switch to be used for VMs + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string VMSwitchName { get => this._vMSwitchName; set => this._vMSwitchName = value; } + + /// Creates an new instance. + public LogicalNetworkProperties() + { + + } + } + /// Properties under the logical network resource + public partial interface ILogicalNetworkProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The list of DNS servers IP addresses. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of DNS servers IP addresses.", + SerializedName = @"dnsServers", + PossibleTypes = new [] { typeof(string) })] + string[] DhcpOptionDnsServer { get; set; } + /// Provisioning state of the logical network. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Provisioning state of the logical network.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; } + /// + /// The status of the operation performed on the logical network [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the logical network [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the logical network + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the logical network", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusOperationId { get; set; } + /// LogicalNetwork provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"LogicalNetwork provisioning error code", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorCode { get; set; } + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Descriptive error message", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorMessage { get; set; } + /// Subnet - list of subnets under the logical network + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Subnet - list of subnets under the logical network", + SerializedName = @"subnets", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet[] Subnet { get; set; } + /// name of the network switch to be used for VMs + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"name of the network switch to be used for VMs", + SerializedName = @"vmSwitchName", + PossibleTypes = new [] { typeof(string) })] + string VMSwitchName { get; set; } + + } + /// Properties under the logical network resource + internal partial interface ILogicalNetworkPropertiesInternal + + { + /// + /// DhcpOptions contains an array of DNS servers available to VMs deployed in the logical network. Standard DHCP option for + /// a subnet overrides logical network DHCP options. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptions DhcpOption { get; set; } + /// The list of DNS servers IP addresses. + string[] DhcpOptionDnsServer { get; set; } + /// Provisioning state of the logical network. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; set; } + /// + /// The status of the operation performed on the logical network [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the logical network + string ProvisioningStatusOperationId { get; set; } + /// The observed state of logical networks + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatus Status { get; set; } + /// LogicalNetwork provisioning error code + string StatusErrorCode { get; set; } + /// Descriptive error message + string StatusErrorMessage { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus StatusProvisioningStatus { get; set; } + /// Subnet - list of subnets under the logical network + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet[] Subnet { get; set; } + /// name of the network switch to be used for VMs + string VMSwitchName { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkProperties.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkProperties.json.cs new file mode 100644 index 000000000000..eef645df9311 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkProperties.json.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Properties under the logical network resource + public partial class LogicalNetworkProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new LogicalNetworkProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal LogicalNetworkProperties(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_dhcpOption = If( json?.PropertyT("dhcpOptions"), out var __jsonDhcpOptions) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkPropertiesDhcpOptions.FromJson(__jsonDhcpOptions) : DhcpOption;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkStatus.FromJson(__jsonStatus) : Status;} + {_subnet = If( json?.PropertyT("subnets"), out var __jsonSubnets) ? If( __jsonSubnets as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.Subnet.FromJson(__u) )) ))() : null : Subnet;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + {_vMSwitchName = If( json?.PropertyT("vmSwitchName"), out var __jsonVMSwitchName) ? (string)__jsonVMSwitchName : (string)VMSwitchName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._dhcpOption ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._dhcpOption.ToJson(null,serializationMode) : null, "dhcpOptions" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._status ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._status.ToJson(null,serializationMode) : null, "status" ,container.Add ); + } + if (null != this._subnet) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._subnet ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("subnets",__w); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + AddIf( null != (((object)this._vMSwitchName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._vMSwitchName.ToString()) : null, "vmSwitchName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkPropertiesDhcpOptions.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkPropertiesDhcpOptions.PowerShell.cs new file mode 100644 index 000000000000..a52a21a0db6f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkPropertiesDhcpOptions.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// DhcpOptions contains an array of DNS servers available to VMs deployed in the logical network. Standard DHCP option for + /// a subnet overrides logical network DHCP options. + /// + [System.ComponentModel.TypeConverter(typeof(LogicalNetworkPropertiesDhcpOptionsTypeConverter))] + public partial class LogicalNetworkPropertiesDhcpOptions + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptions DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new LogicalNetworkPropertiesDhcpOptions(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptions DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new LogicalNetworkPropertiesDhcpOptions(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptions FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal LogicalNetworkPropertiesDhcpOptions(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DnsServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptionsInternal)this).DnsServer = (string[]) content.GetValueForProperty("DnsServer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptionsInternal)this).DnsServer, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal LogicalNetworkPropertiesDhcpOptions(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DnsServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptionsInternal)this).DnsServer = (string[]) content.GetValueForProperty("DnsServer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptionsInternal)this).DnsServer, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// DhcpOptions contains an array of DNS servers available to VMs deployed in the logical network. Standard DHCP option for + /// a subnet overrides logical network DHCP options. + [System.ComponentModel.TypeConverter(typeof(LogicalNetworkPropertiesDhcpOptionsTypeConverter))] + public partial interface ILogicalNetworkPropertiesDhcpOptions + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkPropertiesDhcpOptions.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkPropertiesDhcpOptions.TypeConverter.cs new file mode 100644 index 000000000000..0a7ba906dd59 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkPropertiesDhcpOptions.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class LogicalNetworkPropertiesDhcpOptionsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptions ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptions).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return LogicalNetworkPropertiesDhcpOptions.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return LogicalNetworkPropertiesDhcpOptions.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return LogicalNetworkPropertiesDhcpOptions.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkPropertiesDhcpOptions.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkPropertiesDhcpOptions.cs new file mode 100644 index 000000000000..d0e1bc78f307 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkPropertiesDhcpOptions.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// DhcpOptions contains an array of DNS servers available to VMs deployed in the logical network. Standard DHCP option for + /// a subnet overrides logical network DHCP options. + /// + public partial class LogicalNetworkPropertiesDhcpOptions : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptions, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptionsInternal + { + + /// Backing field for property. + private string[] _dnsServer; + + /// The list of DNS servers IP addresses. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string[] DnsServer { get => this._dnsServer; set => this._dnsServer = value; } + + /// Creates an new instance. + public LogicalNetworkPropertiesDhcpOptions() + { + + } + } + /// DhcpOptions contains an array of DNS servers available to VMs deployed in the logical network. Standard DHCP option for + /// a subnet overrides logical network DHCP options. + public partial interface ILogicalNetworkPropertiesDhcpOptions : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The list of DNS servers IP addresses. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of DNS servers IP addresses.", + SerializedName = @"dnsServers", + PossibleTypes = new [] { typeof(string) })] + string[] DnsServer { get; set; } + + } + /// DhcpOptions contains an array of DNS servers available to VMs deployed in the logical network. Standard DHCP option for + /// a subnet overrides logical network DHCP options. + internal partial interface ILogicalNetworkPropertiesDhcpOptionsInternal + + { + /// The list of DNS servers IP addresses. + string[] DnsServer { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkPropertiesDhcpOptions.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkPropertiesDhcpOptions.json.cs new file mode 100644 index 000000000000..354e722f1423 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkPropertiesDhcpOptions.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// DhcpOptions contains an array of DNS servers available to VMs deployed in the logical network. Standard DHCP option for + /// a subnet overrides logical network DHCP options. + /// + public partial class LogicalNetworkPropertiesDhcpOptions + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptions. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptions. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptions FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new LogicalNetworkPropertiesDhcpOptions(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal LogicalNetworkPropertiesDhcpOptions(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_dnsServer = If( json?.PropertyT("dnsServers"), out var __jsonDnsServers) ? If( __jsonDnsServers as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : DnsServer;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._dnsServer) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._dnsServer ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("dnsServers",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatus.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatus.PowerShell.cs new file mode 100644 index 000000000000..03f1be43af24 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatus.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The observed state of logical networks + [System.ComponentModel.TypeConverter(typeof(LogicalNetworkStatusTypeConverter))] + public partial class LogicalNetworkStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new LogicalNetworkStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new LogicalNetworkStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal LogicalNetworkStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)this).ProvisioningStatusStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatusStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)this).ProvisioningStatusStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal LogicalNetworkStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)this).ProvisioningStatusStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatusStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)this).ProvisioningStatusStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The observed state of logical networks + [System.ComponentModel.TypeConverter(typeof(LogicalNetworkStatusTypeConverter))] + public partial interface ILogicalNetworkStatus + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatus.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatus.TypeConverter.cs new file mode 100644 index 000000000000..b3e3b23390a0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatus.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class LogicalNetworkStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return LogicalNetworkStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return LogicalNetworkStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return LogicalNetworkStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatus.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatus.cs new file mode 100644 index 000000000000..2ecdf8256e19 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatus.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The observed state of logical networks + public partial class LogicalNetworkStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatus, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal + { + + /// Backing field for property. + private string _errorCode; + + /// LogicalNetwork provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ErrorCode { get => this._errorCode; set => this._errorCode = value; } + + /// Backing field for property. + private string _errorMessage; + + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ErrorMessage { get => this._errorMessage; set => this._errorMessage = value; } + + /// Internal Acessors for ProvisioningStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusInternal.ProvisioningStatus { get => (this._provisioningStatus = this._provisioningStatus ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkStatusProvisioningStatus()); set { {_provisioningStatus = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus _provisioningStatus; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus ProvisioningStatus { get => (this._provisioningStatus = this._provisioningStatus ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkStatusProvisioningStatus()); set => this._provisioningStatus = value; } + + /// The ID of the operation performed on the logical network + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningStatusOperationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatusInternal)ProvisioningStatus).OperationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatusInternal)ProvisioningStatus).OperationId = value ?? null; } + + /// + /// The status of the operation performed on the logical network [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatusStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatusInternal)ProvisioningStatus).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatusInternal)ProvisioningStatus).Status = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status)""); } + + /// Creates an new instance. + public LogicalNetworkStatus() + { + + } + } + /// The observed state of logical networks + public partial interface ILogicalNetworkStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// LogicalNetwork provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"LogicalNetwork provisioning error code", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string ErrorCode { get; set; } + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Descriptive error message", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; set; } + /// The ID of the operation performed on the logical network + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the logical network", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusOperationId { get; set; } + /// + /// The status of the operation performed on the logical network [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the logical network [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatusStatus { get; set; } + + } + /// The observed state of logical networks + internal partial interface ILogicalNetworkStatusInternal + + { + /// LogicalNetwork provisioning error code + string ErrorCode { get; set; } + /// Descriptive error message + string ErrorMessage { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus ProvisioningStatus { get; set; } + /// The ID of the operation performed on the logical network + string ProvisioningStatusOperationId { get; set; } + /// + /// The status of the operation performed on the logical network [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatusStatus { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatus.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatus.json.cs new file mode 100644 index 000000000000..cacec182ba92 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatus.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The observed state of logical networks + public partial class LogicalNetworkStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new LogicalNetworkStatus(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal LogicalNetworkStatus(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provisioningStatus = If( json?.PropertyT("provisioningStatus"), out var __jsonProvisioningStatus) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkStatusProvisioningStatus.FromJson(__jsonProvisioningStatus) : ProvisioningStatus;} + {_errorCode = If( json?.PropertyT("errorCode"), out var __jsonErrorCode) ? (string)__jsonErrorCode : (string)ErrorCode;} + {_errorMessage = If( json?.PropertyT("errorMessage"), out var __jsonErrorMessage) ? (string)__jsonErrorMessage : (string)ErrorMessage;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._provisioningStatus ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._provisioningStatus.ToJson(null,serializationMode) : null, "provisioningStatus" ,container.Add ); + AddIf( null != (((object)this._errorCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._errorCode.ToString()) : null, "errorCode" ,container.Add ); + AddIf( null != (((object)this._errorMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._errorMessage.ToString()) : null, "errorMessage" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatusProvisioningStatus.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatusProvisioningStatus.PowerShell.cs new file mode 100644 index 000000000000..a3b4ee538130 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatusProvisioningStatus.PowerShell.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(LogicalNetworkStatusProvisioningStatusTypeConverter))] + public partial class LogicalNetworkStatusProvisioningStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new LogicalNetworkStatusProvisioningStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new LogicalNetworkStatusProvisioningStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal LogicalNetworkStatusProvisioningStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatusInternal)this).OperationId = (string) content.GetValueForProperty("OperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatusInternal)this).OperationId, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatusInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatusInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal LogicalNetworkStatusProvisioningStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatusInternal)this).OperationId = (string) content.GetValueForProperty("OperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatusInternal)this).OperationId, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatusInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatusInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(LogicalNetworkStatusProvisioningStatusTypeConverter))] + public partial interface ILogicalNetworkStatusProvisioningStatus + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatusProvisioningStatus.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatusProvisioningStatus.TypeConverter.cs new file mode 100644 index 000000000000..20d8647e2310 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatusProvisioningStatus.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class LogicalNetworkStatusProvisioningStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return LogicalNetworkStatusProvisioningStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return LogicalNetworkStatusProvisioningStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return LogicalNetworkStatusProvisioningStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatusProvisioningStatus.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatusProvisioningStatus.cs new file mode 100644 index 000000000000..adea6376b5df --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatusProvisioningStatus.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class LogicalNetworkStatusProvisioningStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatusInternal + { + + /// Backing field for property. + private string _operationId; + + /// The ID of the operation performed on the logical network + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string OperationId { get => this._operationId; set => this._operationId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? _status; + + /// + /// The status of the operation performed on the logical network [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? Status { get => this._status; set => this._status = value; } + + /// Creates an new instance. + public LogicalNetworkStatusProvisioningStatus() + { + + } + } + public partial interface ILogicalNetworkStatusProvisioningStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The ID of the operation performed on the logical network + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the logical network", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string OperationId { get; set; } + /// + /// The status of the operation performed on the logical network [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the logical network [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? Status { get; set; } + + } + internal partial interface ILogicalNetworkStatusProvisioningStatusInternal + + { + /// The ID of the operation performed on the logical network + string OperationId { get; set; } + /// + /// The status of the operation performed on the logical network [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? Status { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatusProvisioningStatus.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatusProvisioningStatus.json.cs new file mode 100644 index 000000000000..c47ac3fbfa9e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworkStatusProvisioningStatus.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class LogicalNetworkStatusProvisioningStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new LogicalNetworkStatusProvisioningStatus(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal LogicalNetworkStatusProvisioningStatus(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_operationId = If( json?.PropertyT("operationId"), out var __jsonOperationId) ? (string)__jsonOperationId : (string)OperationId;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)Status;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._operationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._operationId.ToString()) : null, "operationId" ,container.Add ); + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworks.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworks.PowerShell.cs new file mode 100644 index 000000000000..c82ec12670c1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworks.PowerShell.cs @@ -0,0 +1,352 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The logical network resource definition. + [System.ComponentModel.TypeConverter(typeof(LogicalNetworksTypeConverter))] + public partial class LogicalNetworks + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new LogicalNetworks(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new LogicalNetworks(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal LogicalNetworks(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation) content.GetValueForProperty("ExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ExtendedLocationName = (string) content.GetValueForProperty("ExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("DhcpOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).DhcpOption = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptions) content.GetValueForProperty("DhcpOption",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).DhcpOption, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkPropertiesDhcpOptionsTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkStatusTypeConverter.ConvertFrom); + } + if (content.Contains("Subnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).Subnet = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet[]) content.GetValueForProperty("Subnet",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).Subnet, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SubnetTypeConverter.ConvertFrom)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("VMSwitchName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).VMSwitchName = (string) content.GetValueForProperty("VMSwitchName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).VMSwitchName, global::System.Convert.ToString); + } + if (content.Contains("ExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ExtendedLocationType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes?) content.GetValueForProperty("ExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ExtendedLocationType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes.CreateFrom); + } + if (content.Contains("DhcpOptionDnsServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).DhcpOptionDnsServer = (string[]) content.GetValueForProperty("DhcpOptionDnsServer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).DhcpOptionDnsServer, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal LogicalNetworks(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation) content.GetValueForProperty("ExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ExtendedLocationName = (string) content.GetValueForProperty("ExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("DhcpOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).DhcpOption = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptions) content.GetValueForProperty("DhcpOption",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).DhcpOption, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkPropertiesDhcpOptionsTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkStatusTypeConverter.ConvertFrom); + } + if (content.Contains("Subnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).Subnet = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet[]) content.GetValueForProperty("Subnet",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).Subnet, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SubnetTypeConverter.ConvertFrom)); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("VMSwitchName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).VMSwitchName = (string) content.GetValueForProperty("VMSwitchName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).VMSwitchName, global::System.Convert.ToString); + } + if (content.Contains("ExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ExtendedLocationType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes?) content.GetValueForProperty("ExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ExtendedLocationType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes.CreateFrom); + } + if (content.Contains("DhcpOptionDnsServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).DhcpOptionDnsServer = (string[]) content.GetValueForProperty("DhcpOptionDnsServer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).DhcpOptionDnsServer, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The logical network resource definition. + [System.ComponentModel.TypeConverter(typeof(LogicalNetworksTypeConverter))] + public partial interface ILogicalNetworks + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworks.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworks.TypeConverter.cs new file mode 100644 index 000000000000..181f780c8090 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworks.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class LogicalNetworksTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return LogicalNetworks.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return LogicalNetworks.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return LogicalNetworks.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworks.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworks.cs new file mode 100644 index 000000000000..4e87f093c699 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworks.cs @@ -0,0 +1,314 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The logical network resource definition. + public partial class LogicalNetworks : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResource(); + + /// The list of DNS servers IP addresses. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string[] DhcpOptionDnsServer { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).DhcpOptionDnsServer; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).DhcpOptionDnsServer = value ?? null /* arrayOf */; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation _extendedLocation; + + /// The extendedLocation of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation ExtendedLocation { get => (this._extendedLocation = this._extendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation()); set => this._extendedLocation = value; } + + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ExtendedLocationName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Name = value ?? null; } + + /// The type of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? ExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Type = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes)""); } + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id; } + + /// The geo-location where the resource lives + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Location = value ; } + + /// Internal Acessors for DhcpOption + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptions Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal.DhcpOption { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).DhcpOption; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).DhcpOption = value; } + + /// Internal Acessors for ExtendedLocation + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal.ExtendedLocation { get => (this._extendedLocation = this._extendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation()); set { {_extendedLocation = value;} } } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal.Status { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).Status = value; } + + /// Internal Acessors for StatusProvisioningStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksInternal.StatusProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).StatusProvisioningStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).StatusProvisioningStatus = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkProperties _property; + + /// Properties under the logical network resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkProperties()); set => this._property = value; } + + /// Provisioning state of the logical network. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).ProvisioningState; } + + /// + /// The status of the operation performed on the logical network [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).ProvisioningStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).ProvisioningStatus = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status)""); } + + /// The ID of the operation performed on the logical network + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningStatusOperationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).ProvisioningStatusOperationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).ProvisioningStatusOperationId = value ?? null; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// LogicalNetwork provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).StatusErrorCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).StatusErrorCode = value ?? null; } + + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).StatusErrorMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).StatusErrorMessage = value ?? null; } + + /// Subnet - list of subnets under the logical network + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet[] Subnet { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).Subnet; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).Subnet = value ?? null /* arrayOf */; } + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData; } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Tag = value ?? null /* model class */; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type; } + + /// name of the network switch to be used for VMs + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string VMSwitchName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).VMSwitchName; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesInternal)Property).VMSwitchName = value ?? null; } + + /// Creates an new instance. + public LogicalNetworks() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__trackedResource), __trackedResource); + await eventListener.AssertObjectIsValid(nameof(__trackedResource), __trackedResource); + } + } + /// The logical network resource definition. + public partial interface ILogicalNetworks : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource + { + /// The list of DNS servers IP addresses. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of DNS servers IP addresses.", + SerializedName = @"dnsServers", + PossibleTypes = new [] { typeof(string) })] + string[] DhcpOptionDnsServer { get; set; } + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string ExtendedLocationName { get; set; } + /// The type of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the extended location.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? ExtendedLocationType { get; set; } + /// Provisioning state of the logical network. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Provisioning state of the logical network.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; } + /// + /// The status of the operation performed on the logical network [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the logical network [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the logical network + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the logical network", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusOperationId { get; set; } + /// LogicalNetwork provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"LogicalNetwork provisioning error code", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorCode { get; set; } + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Descriptive error message", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorMessage { get; set; } + /// Subnet - list of subnets under the logical network + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Subnet - list of subnets under the logical network", + SerializedName = @"subnets", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet[] Subnet { get; set; } + /// name of the network switch to be used for VMs + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"name of the network switch to be used for VMs", + SerializedName = @"vmSwitchName", + PossibleTypes = new [] { typeof(string) })] + string VMSwitchName { get; set; } + + } + /// The logical network resource definition. + internal partial interface ILogicalNetworksInternal : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal + { + /// + /// DhcpOptions contains an array of DNS servers available to VMs deployed in the logical network. Standard DHCP option for + /// a subnet overrides logical network DHCP options. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkPropertiesDhcpOptions DhcpOption { get; set; } + /// The list of DNS servers IP addresses. + string[] DhcpOptionDnsServer { get; set; } + /// The extendedLocation of the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation ExtendedLocation { get; set; } + /// The name of the extended location. + string ExtendedLocationName { get; set; } + /// The type of the extended location. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? ExtendedLocationType { get; set; } + /// Properties under the logical network resource + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkProperties Property { get; set; } + /// Provisioning state of the logical network. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; set; } + /// + /// The status of the operation performed on the logical network [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the logical network + string ProvisioningStatusOperationId { get; set; } + /// The observed state of logical networks + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatus Status { get; set; } + /// LogicalNetwork provisioning error code + string StatusErrorCode { get; set; } + /// Descriptive error message + string StatusErrorMessage { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworkStatusProvisioningStatus StatusProvisioningStatus { get; set; } + /// Subnet - list of subnets under the logical network + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet[] Subnet { get; set; } + /// name of the network switch to be used for VMs + string VMSwitchName { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworks.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworks.json.cs new file mode 100644 index 000000000000..936c03775d05 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworks.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The logical network resource definition. + public partial class LogicalNetworks + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new LogicalNetworks(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal LogicalNetworks(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworkProperties.FromJson(__jsonProperties) : Property;} + {_extendedLocation = If( json?.PropertyT("extendedLocation"), out var __jsonExtendedLocation) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation.FromJson(__jsonExtendedLocation) : ExtendedLocation;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __trackedResource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != this._extendedLocation ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._extendedLocation.ToJson(null,serializationMode) : null, "extendedLocation" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksListResult.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksListResult.PowerShell.cs new file mode 100644 index 000000000000..7d80088ffd3c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksListResult.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(LogicalNetworksListResultTypeConverter))] + public partial class LogicalNetworksListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new LogicalNetworksListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new LogicalNetworksListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal LogicalNetworksListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworksTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal LogicalNetworksListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworksTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(LogicalNetworksListResultTypeConverter))] + public partial interface ILogicalNetworksListResult + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksListResult.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksListResult.TypeConverter.cs new file mode 100644 index 000000000000..72ef04c8aff3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksListResult.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class LogicalNetworksListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return LogicalNetworksListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return LogicalNetworksListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return LogicalNetworksListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksListResult.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksListResult.cs new file mode 100644 index 000000000000..971c9c545d12 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksListResult.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class LogicalNetworksListResult : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksListResult, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks[] _value; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public LogicalNetworksListResult() + { + + } + } + public partial interface ILogicalNetworksListResult : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks[] Value { get; set; } + + } + internal partial interface ILogicalNetworksListResultInternal + + { + string NextLink { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksListResult.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksListResult.json.cs new file mode 100644 index 000000000000..5e1d4502aef2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksListResult.json.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class LogicalNetworksListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new LogicalNetworksListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal LogicalNetworksListResult(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworks.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequest.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequest.PowerShell.cs new file mode 100644 index 000000000000..7188840a0409 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequest.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The logical network resource patch definition. + [System.ComponentModel.TypeConverter(typeof(LogicalNetworksUpdateRequestTypeConverter))] + public partial class LogicalNetworksUpdateRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new LogicalNetworksUpdateRequest(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new LogicalNetworksUpdateRequest(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal LogicalNetworksUpdateRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworksUpdateRequestTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal LogicalNetworksUpdateRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworksUpdateRequestTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The logical network resource patch definition. + [System.ComponentModel.TypeConverter(typeof(LogicalNetworksUpdateRequestTypeConverter))] + public partial interface ILogicalNetworksUpdateRequest + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequest.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequest.TypeConverter.cs new file mode 100644 index 000000000000..d3e5e55cddc7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequest.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class LogicalNetworksUpdateRequestTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return LogicalNetworksUpdateRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return LogicalNetworksUpdateRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return LogicalNetworksUpdateRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequest.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequest.cs new file mode 100644 index 000000000000..01cf438c675d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequest.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The logical network resource patch definition. + public partial class LogicalNetworksUpdateRequest : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequest, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags _tag; + + /// Resource tags + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworksUpdateRequestTags()); set => this._tag = value; } + + /// Creates an new instance. + public LogicalNetworksUpdateRequest() + { + + } + } + /// The logical network resource patch definition. + public partial interface ILogicalNetworksUpdateRequest : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Resource tags + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags Tag { get; set; } + + } + /// The logical network resource patch definition. + internal partial interface ILogicalNetworksUpdateRequestInternal + + { + /// Resource tags + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequest.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequest.json.cs new file mode 100644 index 000000000000..b12079a1d0b5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequest.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The logical network resource patch definition. + public partial class LogicalNetworksUpdateRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new LogicalNetworksUpdateRequest(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal LogicalNetworksUpdateRequest(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworksUpdateRequestTags.FromJson(__jsonTags) : Tag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequestTags.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequestTags.PowerShell.cs new file mode 100644 index 000000000000..b712bf78f667 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequestTags.PowerShell.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Resource tags + [System.ComponentModel.TypeConverter(typeof(LogicalNetworksUpdateRequestTagsTypeConverter))] + public partial class LogicalNetworksUpdateRequestTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new LogicalNetworksUpdateRequestTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new LogicalNetworksUpdateRequestTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal LogicalNetworksUpdateRequestTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal LogicalNetworksUpdateRequestTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Resource tags + [System.ComponentModel.TypeConverter(typeof(LogicalNetworksUpdateRequestTagsTypeConverter))] + public partial interface ILogicalNetworksUpdateRequestTags + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequestTags.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequestTags.TypeConverter.cs new file mode 100644 index 000000000000..3a28021d95ec --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequestTags.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class LogicalNetworksUpdateRequestTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return LogicalNetworksUpdateRequestTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return LogicalNetworksUpdateRequestTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return LogicalNetworksUpdateRequestTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequestTags.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequestTags.cs new file mode 100644 index 000000000000..780467cc78b8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequestTags.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Resource tags + public partial class LogicalNetworksUpdateRequestTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTagsInternal + { + + /// Creates an new instance. + public LogicalNetworksUpdateRequestTags() + { + + } + } + /// Resource tags + public partial interface ILogicalNetworksUpdateRequestTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + + } + /// Resource tags + internal partial interface ILogicalNetworksUpdateRequestTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequestTags.dictionary.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequestTags.dictionary.cs new file mode 100644 index 000000000000..0d74ecbe7c32 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequestTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class LogicalNetworksUpdateRequestTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworksUpdateRequestTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequestTags.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequestTags.json.cs new file mode 100644 index 000000000000..5f4427563b52 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/LogicalNetworksUpdateRequestTags.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Resource tags + public partial class LogicalNetworksUpdateRequestTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new LogicalNetworksUpdateRequestTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + /// + internal LogicalNetworksUpdateRequestTags(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageProperties.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageProperties.PowerShell.cs new file mode 100644 index 000000000000..b26a1767016e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageProperties.PowerShell.cs @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Properties under the marketplace gallery image resource + [System.ComponentModel.TypeConverter(typeof(MarketplaceGalleryImagePropertiesTypeConverter))] + public partial class MarketplaceGalleryImageProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MarketplaceGalleryImageProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MarketplaceGalleryImageProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MarketplaceGalleryImageProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Identifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).Identifier = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier) content.GetValueForProperty("Identifier",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).Identifier, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageIdentifierTypeConverter.ConvertFrom); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).Version = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).Version, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).ContainerId = (string) content.GetValueForProperty("ContainerId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).ContainerId, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).OSType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).OSType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes.CreateFrom); + } + if (content.Contains("CloudInitDataSource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).CloudInitDataSource = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource?) content.GetValueForProperty("CloudInitDataSource",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).CloudInitDataSource, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource.CreateFrom); + } + if (content.Contains("HyperVGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).HyperVGeneration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration?) content.GetValueForProperty("HyperVGeneration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).HyperVGeneration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration.CreateFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("IdentifierPublisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).IdentifierPublisher = (string) content.GetValueForProperty("IdentifierPublisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).IdentifierPublisher, global::System.Convert.ToString); + } + if (content.Contains("IdentifierOffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).IdentifierOffer = (string) content.GetValueForProperty("IdentifierOffer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).IdentifierOffer, global::System.Convert.ToString); + } + if (content.Contains("IdentifierSku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).IdentifierSku = (string) content.GetValueForProperty("IdentifierSku",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).IdentifierSku, global::System.Convert.ToString); + } + if (content.Contains("VersionProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).VersionProperty = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties) content.GetValueForProperty("VersionProperty",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).VersionProperty, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("VersionName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).VersionName = (string) content.GetValueForProperty("VersionName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).VersionName, global::System.Convert.ToString); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusDownloadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StatusDownloadStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus) content.GetValueForProperty("StatusDownloadStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StatusDownloadStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusDownloadStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StatusProgressPercentage = (long?) content.GetValueForProperty("StatusProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StatusProgressPercentage, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("StorageProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StorageProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile) content.GetValueForProperty("StorageProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StorageProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionStorageProfileTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + if (content.Contains("DownloadStatusDownloadSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).DownloadStatusDownloadSizeInMb = (long?) content.GetValueForProperty("DownloadStatusDownloadSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).DownloadStatusDownloadSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StorageProfileOSDiskImage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StorageProfileOSDiskImage = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage) content.GetValueForProperty("StorageProfileOSDiskImage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StorageProfileOSDiskImage, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryDiskImageTypeConverter.ConvertFrom); + } + if (content.Contains("OSDiskImageSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).OSDiskImageSizeInMb = (long?) content.GetValueForProperty("OSDiskImageSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).OSDiskImageSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MarketplaceGalleryImageProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Identifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).Identifier = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier) content.GetValueForProperty("Identifier",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).Identifier, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageIdentifierTypeConverter.ConvertFrom); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).Version = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).Version, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).ContainerId = (string) content.GetValueForProperty("ContainerId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).ContainerId, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).OSType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).OSType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes.CreateFrom); + } + if (content.Contains("CloudInitDataSource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).CloudInitDataSource = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource?) content.GetValueForProperty("CloudInitDataSource",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).CloudInitDataSource, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource.CreateFrom); + } + if (content.Contains("HyperVGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).HyperVGeneration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration?) content.GetValueForProperty("HyperVGeneration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).HyperVGeneration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration.CreateFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("IdentifierPublisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).IdentifierPublisher = (string) content.GetValueForProperty("IdentifierPublisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).IdentifierPublisher, global::System.Convert.ToString); + } + if (content.Contains("IdentifierOffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).IdentifierOffer = (string) content.GetValueForProperty("IdentifierOffer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).IdentifierOffer, global::System.Convert.ToString); + } + if (content.Contains("IdentifierSku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).IdentifierSku = (string) content.GetValueForProperty("IdentifierSku",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).IdentifierSku, global::System.Convert.ToString); + } + if (content.Contains("VersionProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).VersionProperty = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties) content.GetValueForProperty("VersionProperty",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).VersionProperty, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("VersionName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).VersionName = (string) content.GetValueForProperty("VersionName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).VersionName, global::System.Convert.ToString); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusDownloadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StatusDownloadStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus) content.GetValueForProperty("StatusDownloadStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StatusDownloadStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusDownloadStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StatusProgressPercentage = (long?) content.GetValueForProperty("StatusProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StatusProgressPercentage, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("StorageProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StorageProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile) content.GetValueForProperty("StorageProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StorageProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionStorageProfileTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + if (content.Contains("DownloadStatusDownloadSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).DownloadStatusDownloadSizeInMb = (long?) content.GetValueForProperty("DownloadStatusDownloadSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).DownloadStatusDownloadSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StorageProfileOSDiskImage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StorageProfileOSDiskImage = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage) content.GetValueForProperty("StorageProfileOSDiskImage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).StorageProfileOSDiskImage, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryDiskImageTypeConverter.ConvertFrom); + } + if (content.Contains("OSDiskImageSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).OSDiskImageSizeInMb = (long?) content.GetValueForProperty("OSDiskImageSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)this).OSDiskImageSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Properties under the marketplace gallery image resource + [System.ComponentModel.TypeConverter(typeof(MarketplaceGalleryImagePropertiesTypeConverter))] + public partial interface IMarketplaceGalleryImageProperties + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageProperties.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageProperties.TypeConverter.cs new file mode 100644 index 000000000000..2d8a26a2723c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MarketplaceGalleryImagePropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MarketplaceGalleryImageProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MarketplaceGalleryImageProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MarketplaceGalleryImageProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageProperties.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageProperties.cs new file mode 100644 index 000000000000..15ca2f4efd8e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageProperties.cs @@ -0,0 +1,362 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Properties under the marketplace gallery image resource + public partial class MarketplaceGalleryImageProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageProperties, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource? _cloudInitDataSource; + + /// + /// Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource? CloudInitDataSource { get => this._cloudInitDataSource; set => this._cloudInitDataSource = value; } + + /// Backing field for property. + private string _containerId; + + /// + /// Storage ContainerID of the storage container to be used for marketplace gallery image + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ContainerId { get => this._containerId; set => this._containerId = value; } + + /// The downloaded sized of the image in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? DownloadStatusDownloadSizeInMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)Status).DownloadStatusDownloadSizeInMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)Status).DownloadStatusDownloadSizeInMb = value ?? default(long); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration? _hyperVGeneration; + + /// The hypervisor generation of the Virtual Machine [V1, V2] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration? HyperVGeneration { get => this._hyperVGeneration; set => this._hyperVGeneration = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier _identifier; + + /// This is the gallery image definition identifier. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier Identifier { get => (this._identifier = this._identifier ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageIdentifier()); set => this._identifier = value; } + + /// The name of the gallery image definition offer. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentifierOffer { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)Identifier).Offer; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)Identifier).Offer = value ?? null; } + + /// The name of the gallery image definition publisher. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentifierPublisher { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)Identifier).Publisher; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)Identifier).Publisher = value ?? null; } + + /// The name of the gallery image definition SKU. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentifierSku { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)Identifier).Sku; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifierInternal)Identifier).Sku = value ?? null; } + + /// Internal Acessors for Identifier + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal.Identifier { get => (this._identifier = this._identifier ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageIdentifier()); set { {_identifier = value;} } } + + /// Internal Acessors for OSDiskImageSizeInMb + long? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal.OSDiskImageSizeInMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)Version).OSDiskImageSizeInMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)Version).OSDiskImageSizeInMb = value; } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal.Status { get => (this._status = this._status ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatus()); set { {_status = value;} } } + + /// Internal Acessors for StatusDownloadStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal.StatusDownloadStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)Status).DownloadStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)Status).DownloadStatus = value; } + + /// Internal Acessors for StatusProvisioningStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal.StatusProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)Status).ProvisioningStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)Status).ProvisioningStatus = value; } + + /// Internal Acessors for StorageProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal.StorageProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)Version).StorageProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)Version).StorageProfile = value; } + + /// Internal Acessors for StorageProfileOSDiskImage + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal.StorageProfileOSDiskImage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)Version).StorageProfileOSDiskImage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)Version).StorageProfileOSDiskImage = value; } + + /// Internal Acessors for Version + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal.Version { get => (this._version = this._version ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersion()); set { {_version = value;} } } + + /// Internal Acessors for VersionProperty + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal.VersionProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)Version).Property; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)Version).Property = value; } + + /// This property indicates the size of the VHD to be created. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? OSDiskImageSizeInMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)Version).OSDiskImageSizeInMb; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes _oSType; + + /// Operating system type that the gallery image uses [Windows, Linux] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes OSType { get => this._oSType; set => this._oSType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? _provisioningState; + + /// Provisioning state of the marketplace gallery image. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get => this._provisioningState; } + + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)Status).ProvisioningStatusStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)Status).ProvisioningStatusStatus = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status)""); } + + /// The ID of the operation performed on the gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningStatusOperationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)Status).ProvisioningStatusOperationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)Status).ProvisioningStatusOperationId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatus _status; + + /// The observed state of marketplace gallery images + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatus Status { get => (this._status = this._status ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatus()); } + + /// MarketplaceGalleryImage provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)Status).ErrorCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)Status).ErrorCode = value ?? null; } + + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)Status).ErrorMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)Status).ErrorMessage = value ?? null; } + + /// The progress of the operation in percentage + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? StatusProgressPercentage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)Status).ProgressPercentage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)Status).ProgressPercentage = value ?? default(long); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion _version; + + /// + /// Specifies information about the gallery image version that you want to create or update. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion Version { get => (this._version = this._version ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersion()); set => this._version = value; } + + /// This is the version of the gallery image. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string VersionName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)Version).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionInternal)Version).Name = value ?? null; } + + /// Creates an new instance. + public MarketplaceGalleryImageProperties() + { + + } + } + /// Properties under the marketplace gallery image resource + public partial interface IMarketplaceGalleryImageProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// + /// Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure]", + SerializedName = @"cloudInitDataSource", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource? CloudInitDataSource { get; set; } + /// + /// Storage ContainerID of the storage container to be used for marketplace gallery image + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Storage ContainerID of the storage container to be used for marketplace gallery image", + SerializedName = @"containerId", + PossibleTypes = new [] { typeof(string) })] + string ContainerId { get; set; } + /// The downloaded sized of the image in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The downloaded sized of the image in MB", + SerializedName = @"downloadSizeInMB", + PossibleTypes = new [] { typeof(long) })] + long? DownloadStatusDownloadSizeInMb { get; set; } + /// The hypervisor generation of the Virtual Machine [V1, V2] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The hypervisor generation of the Virtual Machine [V1, V2]", + SerializedName = @"hyperVGeneration", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration? HyperVGeneration { get; set; } + /// The name of the gallery image definition offer. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition offer.", + SerializedName = @"offer", + PossibleTypes = new [] { typeof(string) })] + string IdentifierOffer { get; set; } + /// The name of the gallery image definition publisher. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition publisher.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + string IdentifierPublisher { get; set; } + /// The name of the gallery image definition SKU. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition SKU.", + SerializedName = @"sku", + PossibleTypes = new [] { typeof(string) })] + string IdentifierSku { get; set; } + /// This property indicates the size of the VHD to be created. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"This property indicates the size of the VHD to be created.", + SerializedName = @"sizeInMB", + PossibleTypes = new [] { typeof(long) })] + long? OSDiskImageSizeInMb { get; } + /// Operating system type that the gallery image uses [Windows, Linux] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Operating system type that the gallery image uses [Windows, Linux]", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes OSType { get; set; } + /// Provisioning state of the marketplace gallery image. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Provisioning state of the marketplace gallery image.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; } + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the gallery image [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the gallery image", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusOperationId { get; set; } + /// MarketplaceGalleryImage provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"MarketplaceGalleryImage provisioning error code", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorCode { get; set; } + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Descriptive error message", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorMessage { get; set; } + /// The progress of the operation in percentage + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The progress of the operation in percentage", + SerializedName = @"progressPercentage", + PossibleTypes = new [] { typeof(long) })] + long? StatusProgressPercentage { get; set; } + /// This is the version of the gallery image. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"This is the version of the gallery image.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string VersionName { get; set; } + + } + /// Properties under the marketplace gallery image resource + internal partial interface IMarketplaceGalleryImagePropertiesInternal + + { + /// + /// Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource? CloudInitDataSource { get; set; } + /// + /// Storage ContainerID of the storage container to be used for marketplace gallery image + /// + string ContainerId { get; set; } + /// The downloaded sized of the image in MB + long? DownloadStatusDownloadSizeInMb { get; set; } + /// The hypervisor generation of the Virtual Machine [V1, V2] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration? HyperVGeneration { get; set; } + /// This is the gallery image definition identifier. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier Identifier { get; set; } + /// The name of the gallery image definition offer. + string IdentifierOffer { get; set; } + /// The name of the gallery image definition publisher. + string IdentifierPublisher { get; set; } + /// The name of the gallery image definition SKU. + string IdentifierSku { get; set; } + /// This property indicates the size of the VHD to be created. + long? OSDiskImageSizeInMb { get; set; } + /// Operating system type that the gallery image uses [Windows, Linux] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes OSType { get; set; } + /// Provisioning state of the marketplace gallery image. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; set; } + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the gallery image + string ProvisioningStatusOperationId { get; set; } + /// The observed state of marketplace gallery images + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatus Status { get; set; } + /// The download status of the gallery image + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus StatusDownloadStatus { get; set; } + /// MarketplaceGalleryImage provisioning error code + string StatusErrorCode { get; set; } + /// Descriptive error message + string StatusErrorMessage { get; set; } + /// The progress of the operation in percentage + long? StatusProgressPercentage { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus StatusProvisioningStatus { get; set; } + /// This is the storage profile of a Gallery Image Version. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile StorageProfile { get; set; } + /// This is the disk image base class. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage StorageProfileOSDiskImage { get; set; } + /// + /// Specifies information about the gallery image version that you want to create or update. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion Version { get; set; } + /// This is the version of the gallery image. + string VersionName { get; set; } + /// Describes the properties of a gallery image version. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties VersionProperty { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageProperties.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageProperties.json.cs new file mode 100644 index 000000000000..25d190116cdd --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageProperties.json.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Properties under the marketplace gallery image resource + public partial class MarketplaceGalleryImageProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MarketplaceGalleryImageProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal MarketplaceGalleryImageProperties(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_identifier = If( json?.PropertyT("identifier"), out var __jsonIdentifier) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageIdentifier.FromJson(__jsonIdentifier) : Identifier;} + {_version = If( json?.PropertyT("version"), out var __jsonVersion) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersion.FromJson(__jsonVersion) : Version;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatus.FromJson(__jsonStatus) : Status;} + {_containerId = If( json?.PropertyT("containerId"), out var __jsonContainerId) ? (string)__jsonContainerId : (string)ContainerId;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + {_cloudInitDataSource = If( json?.PropertyT("cloudInitDataSource"), out var __jsonCloudInitDataSource) ? (string)__jsonCloudInitDataSource : (string)CloudInitDataSource;} + {_hyperVGeneration = If( json?.PropertyT("hyperVGeneration"), out var __jsonHyperVGeneration) ? (string)__jsonHyperVGeneration : (string)HyperVGeneration;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._identifier ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._identifier.ToJson(null,serializationMode) : null, "identifier" ,container.Add ); + AddIf( null != this._version ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._version.ToJson(null,serializationMode) : null, "version" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._status ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._status.ToJson(null,serializationMode) : null, "status" ,container.Add ); + } + AddIf( null != (((object)this._containerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._containerId.ToString()) : null, "containerId" ,container.Add ); + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + AddIf( null != (((object)this._cloudInitDataSource)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._cloudInitDataSource.ToString()) : null, "cloudInitDataSource" ,container.Add ); + AddIf( null != (((object)this._hyperVGeneration)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._hyperVGeneration.ToString()) : null, "hyperVGeneration" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatus.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatus.PowerShell.cs new file mode 100644 index 000000000000..0662ddf4f5e3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatus.PowerShell.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The observed state of marketplace gallery images + [System.ComponentModel.TypeConverter(typeof(MarketplaceGalleryImageStatusTypeConverter))] + public partial class MarketplaceGalleryImageStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MarketplaceGalleryImageStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MarketplaceGalleryImageStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MarketplaceGalleryImageStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("DownloadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).DownloadStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus) content.GetValueForProperty("DownloadStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).DownloadStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusDownloadStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ProgressPercentage = (long?) content.GetValueForProperty("ProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ProgressPercentage, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ProvisioningStatusStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ProvisioningStatusStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatusStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ProvisioningStatusStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + if (content.Contains("DownloadStatusDownloadSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).DownloadStatusDownloadSizeInMb = (long?) content.GetValueForProperty("DownloadStatusDownloadSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).DownloadStatusDownloadSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MarketplaceGalleryImageStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("DownloadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).DownloadStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus) content.GetValueForProperty("DownloadStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).DownloadStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusDownloadStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ProgressPercentage = (long?) content.GetValueForProperty("ProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ProgressPercentage, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ProvisioningStatusStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ProvisioningStatusStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatusStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ProvisioningStatusStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + if (content.Contains("DownloadStatusDownloadSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).DownloadStatusDownloadSizeInMb = (long?) content.GetValueForProperty("DownloadStatusDownloadSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal)this).DownloadStatusDownloadSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The observed state of marketplace gallery images + [System.ComponentModel.TypeConverter(typeof(MarketplaceGalleryImageStatusTypeConverter))] + public partial interface IMarketplaceGalleryImageStatus + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatus.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatus.TypeConverter.cs new file mode 100644 index 000000000000..9fe68507b542 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatus.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MarketplaceGalleryImageStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MarketplaceGalleryImageStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MarketplaceGalleryImageStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MarketplaceGalleryImageStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatus.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatus.cs new file mode 100644 index 000000000000..f2b49bb6c26a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatus.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The observed state of marketplace gallery images + public partial class MarketplaceGalleryImageStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatus, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus _downloadStatus; + + /// The download status of the gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus DownloadStatus { get => (this._downloadStatus = this._downloadStatus ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusDownloadStatus()); set => this._downloadStatus = value; } + + /// The downloaded sized of the image in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? DownloadStatusDownloadSizeInMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatusInternal)DownloadStatus).DownloadSizeInMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatusInternal)DownloadStatus).DownloadSizeInMb = value ?? default(long); } + + /// Backing field for property. + private string _errorCode; + + /// MarketplaceGalleryImage provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ErrorCode { get => this._errorCode; set => this._errorCode = value; } + + /// Backing field for property. + private string _errorMessage; + + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ErrorMessage { get => this._errorMessage; set => this._errorMessage = value; } + + /// Internal Acessors for DownloadStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal.DownloadStatus { get => (this._downloadStatus = this._downloadStatus ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusDownloadStatus()); set { {_downloadStatus = value;} } } + + /// Internal Acessors for ProvisioningStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusInternal.ProvisioningStatus { get => (this._provisioningStatus = this._provisioningStatus ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusProvisioningStatus()); set { {_provisioningStatus = value;} } } + + /// Backing field for property. + private long? _progressPercentage; + + /// The progress of the operation in percentage + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public long? ProgressPercentage { get => this._progressPercentage; set => this._progressPercentage = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus _provisioningStatus; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus ProvisioningStatus { get => (this._provisioningStatus = this._provisioningStatus ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusProvisioningStatus()); set => this._provisioningStatus = value; } + + /// The ID of the operation performed on the gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningStatusOperationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatusInternal)ProvisioningStatus).OperationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatusInternal)ProvisioningStatus).OperationId = value ?? null; } + + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatusStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatusInternal)ProvisioningStatus).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatusInternal)ProvisioningStatus).Status = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status)""); } + + /// Creates an new instance. + public MarketplaceGalleryImageStatus() + { + + } + } + /// The observed state of marketplace gallery images + public partial interface IMarketplaceGalleryImageStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The downloaded sized of the image in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The downloaded sized of the image in MB", + SerializedName = @"downloadSizeInMB", + PossibleTypes = new [] { typeof(long) })] + long? DownloadStatusDownloadSizeInMb { get; set; } + /// MarketplaceGalleryImage provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"MarketplaceGalleryImage provisioning error code", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string ErrorCode { get; set; } + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Descriptive error message", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; set; } + /// The progress of the operation in percentage + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The progress of the operation in percentage", + SerializedName = @"progressPercentage", + PossibleTypes = new [] { typeof(long) })] + long? ProgressPercentage { get; set; } + /// The ID of the operation performed on the gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the gallery image", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusOperationId { get; set; } + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the gallery image [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatusStatus { get; set; } + + } + /// The observed state of marketplace gallery images + internal partial interface IMarketplaceGalleryImageStatusInternal + + { + /// The download status of the gallery image + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus DownloadStatus { get; set; } + /// The downloaded sized of the image in MB + long? DownloadStatusDownloadSizeInMb { get; set; } + /// MarketplaceGalleryImage provisioning error code + string ErrorCode { get; set; } + /// Descriptive error message + string ErrorMessage { get; set; } + /// The progress of the operation in percentage + long? ProgressPercentage { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus ProvisioningStatus { get; set; } + /// The ID of the operation performed on the gallery image + string ProvisioningStatusOperationId { get; set; } + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatusStatus { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatus.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatus.json.cs new file mode 100644 index 000000000000..fcb1b900f5a5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatus.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The observed state of marketplace gallery images + public partial class MarketplaceGalleryImageStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MarketplaceGalleryImageStatus(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal MarketplaceGalleryImageStatus(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provisioningStatus = If( json?.PropertyT("provisioningStatus"), out var __jsonProvisioningStatus) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusProvisioningStatus.FromJson(__jsonProvisioningStatus) : ProvisioningStatus;} + {_downloadStatus = If( json?.PropertyT("downloadStatus"), out var __jsonDownloadStatus) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusDownloadStatus.FromJson(__jsonDownloadStatus) : DownloadStatus;} + {_errorCode = If( json?.PropertyT("errorCode"), out var __jsonErrorCode) ? (string)__jsonErrorCode : (string)ErrorCode;} + {_errorMessage = If( json?.PropertyT("errorMessage"), out var __jsonErrorMessage) ? (string)__jsonErrorMessage : (string)ErrorMessage;} + {_progressPercentage = If( json?.PropertyT("progressPercentage"), out var __jsonProgressPercentage) ? (long?)__jsonProgressPercentage : ProgressPercentage;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._provisioningStatus ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._provisioningStatus.ToJson(null,serializationMode) : null, "provisioningStatus" ,container.Add ); + AddIf( null != this._downloadStatus ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._downloadStatus.ToJson(null,serializationMode) : null, "downloadStatus" ,container.Add ); + AddIf( null != (((object)this._errorCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._errorCode.ToString()) : null, "errorCode" ,container.Add ); + AddIf( null != (((object)this._errorMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._errorMessage.ToString()) : null, "errorMessage" ,container.Add ); + AddIf( null != this._progressPercentage ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNumber((long)this._progressPercentage) : null, "progressPercentage" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusDownloadStatus.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusDownloadStatus.PowerShell.cs new file mode 100644 index 000000000000..58d87c6cd642 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusDownloadStatus.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The download status of the gallery image + [System.ComponentModel.TypeConverter(typeof(MarketplaceGalleryImageStatusDownloadStatusTypeConverter))] + public partial class MarketplaceGalleryImageStatusDownloadStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MarketplaceGalleryImageStatusDownloadStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MarketplaceGalleryImageStatusDownloadStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MarketplaceGalleryImageStatusDownloadStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DownloadSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatusInternal)this).DownloadSizeInMb = (long?) content.GetValueForProperty("DownloadSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatusInternal)this).DownloadSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MarketplaceGalleryImageStatusDownloadStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DownloadSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatusInternal)this).DownloadSizeInMb = (long?) content.GetValueForProperty("DownloadSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatusInternal)this).DownloadSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The download status of the gallery image + [System.ComponentModel.TypeConverter(typeof(MarketplaceGalleryImageStatusDownloadStatusTypeConverter))] + public partial interface IMarketplaceGalleryImageStatusDownloadStatus + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusDownloadStatus.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusDownloadStatus.TypeConverter.cs new file mode 100644 index 000000000000..684566177def --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusDownloadStatus.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MarketplaceGalleryImageStatusDownloadStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MarketplaceGalleryImageStatusDownloadStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MarketplaceGalleryImageStatusDownloadStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MarketplaceGalleryImageStatusDownloadStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusDownloadStatus.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusDownloadStatus.cs new file mode 100644 index 000000000000..df028f87923d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusDownloadStatus.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The download status of the gallery image + public partial class MarketplaceGalleryImageStatusDownloadStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatusInternal + { + + /// Backing field for property. + private long? _downloadSizeInMb; + + /// The downloaded sized of the image in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public long? DownloadSizeInMb { get => this._downloadSizeInMb; set => this._downloadSizeInMb = value; } + + /// + /// Creates an new instance. + /// + public MarketplaceGalleryImageStatusDownloadStatus() + { + + } + } + /// The download status of the gallery image + public partial interface IMarketplaceGalleryImageStatusDownloadStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The downloaded sized of the image in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The downloaded sized of the image in MB", + SerializedName = @"downloadSizeInMB", + PossibleTypes = new [] { typeof(long) })] + long? DownloadSizeInMb { get; set; } + + } + /// The download status of the gallery image + internal partial interface IMarketplaceGalleryImageStatusDownloadStatusInternal + + { + /// The downloaded sized of the image in MB + long? DownloadSizeInMb { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusDownloadStatus.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusDownloadStatus.json.cs new file mode 100644 index 000000000000..257c3af536b0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusDownloadStatus.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The download status of the gallery image + public partial class MarketplaceGalleryImageStatusDownloadStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MarketplaceGalleryImageStatusDownloadStatus(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal MarketplaceGalleryImageStatusDownloadStatus(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_downloadSizeInMb = If( json?.PropertyT("downloadSizeInMB"), out var __jsonDownloadSizeInMb) ? (long?)__jsonDownloadSizeInMb : DownloadSizeInMb;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._downloadSizeInMb ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNumber((long)this._downloadSizeInMb) : null, "downloadSizeInMB" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusProvisioningStatus.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusProvisioningStatus.PowerShell.cs new file mode 100644 index 000000000000..81e695b225a7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusProvisioningStatus.PowerShell.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(MarketplaceGalleryImageStatusProvisioningStatusTypeConverter))] + public partial class MarketplaceGalleryImageStatusProvisioningStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MarketplaceGalleryImageStatusProvisioningStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MarketplaceGalleryImageStatusProvisioningStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MarketplaceGalleryImageStatusProvisioningStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatusInternal)this).OperationId = (string) content.GetValueForProperty("OperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatusInternal)this).OperationId, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatusInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatusInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MarketplaceGalleryImageStatusProvisioningStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatusInternal)this).OperationId = (string) content.GetValueForProperty("OperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatusInternal)this).OperationId, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatusInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatusInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(MarketplaceGalleryImageStatusProvisioningStatusTypeConverter))] + public partial interface IMarketplaceGalleryImageStatusProvisioningStatus + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusProvisioningStatus.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusProvisioningStatus.TypeConverter.cs new file mode 100644 index 000000000000..38555410c73f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusProvisioningStatus.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MarketplaceGalleryImageStatusProvisioningStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MarketplaceGalleryImageStatusProvisioningStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MarketplaceGalleryImageStatusProvisioningStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MarketplaceGalleryImageStatusProvisioningStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusProvisioningStatus.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusProvisioningStatus.cs new file mode 100644 index 000000000000..49a0ec81c075 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusProvisioningStatus.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class MarketplaceGalleryImageStatusProvisioningStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatusInternal + { + + /// Backing field for property. + private string _operationId; + + /// The ID of the operation performed on the gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string OperationId { get => this._operationId; set => this._operationId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? _status; + + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? Status { get => this._status; set => this._status = value; } + + /// + /// Creates an new instance. + /// + public MarketplaceGalleryImageStatusProvisioningStatus() + { + + } + } + public partial interface IMarketplaceGalleryImageStatusProvisioningStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The ID of the operation performed on the gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the gallery image", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string OperationId { get; set; } + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the gallery image [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? Status { get; set; } + + } + internal partial interface IMarketplaceGalleryImageStatusProvisioningStatusInternal + + { + /// The ID of the operation performed on the gallery image + string OperationId { get; set; } + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? Status { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusProvisioningStatus.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusProvisioningStatus.json.cs new file mode 100644 index 000000000000..4694b9b3780f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImageStatusProvisioningStatus.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class MarketplaceGalleryImageStatusProvisioningStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MarketplaceGalleryImageStatusProvisioningStatus(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal MarketplaceGalleryImageStatusProvisioningStatus(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_operationId = If( json?.PropertyT("operationId"), out var __jsonOperationId) ? (string)__jsonOperationId : (string)OperationId;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)Status;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._operationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._operationId.ToString()) : null, "operationId" ,container.Add ); + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImages.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImages.PowerShell.cs new file mode 100644 index 000000000000..d6fb8bba3e54 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImages.PowerShell.cs @@ -0,0 +1,458 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The marketplace gallery image resource definition. + [System.ComponentModel.TypeConverter(typeof(MarketplaceGalleryImagesTypeConverter))] + public partial class MarketplaceGalleryImages + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MarketplaceGalleryImages(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MarketplaceGalleryImages(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MarketplaceGalleryImages(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImagePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation) content.GetValueForProperty("ExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ExtendedLocationName = (string) content.GetValueForProperty("ExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("Identifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).Identifier = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier) content.GetValueForProperty("Identifier",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).Identifier, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageIdentifierTypeConverter.ConvertFrom); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).Version = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).Version, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ContainerId = (string) content.GetValueForProperty("ContainerId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ContainerId, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).OSType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).OSType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes.CreateFrom); + } + if (content.Contains("CloudInitDataSource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).CloudInitDataSource = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource?) content.GetValueForProperty("CloudInitDataSource",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).CloudInitDataSource, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource.CreateFrom); + } + if (content.Contains("HyperVGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).HyperVGeneration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration?) content.GetValueForProperty("HyperVGeneration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).HyperVGeneration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration.CreateFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("ExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ExtendedLocationType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes?) content.GetValueForProperty("ExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ExtendedLocationType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes.CreateFrom); + } + if (content.Contains("IdentifierPublisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).IdentifierPublisher = (string) content.GetValueForProperty("IdentifierPublisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).IdentifierPublisher, global::System.Convert.ToString); + } + if (content.Contains("IdentifierOffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).IdentifierOffer = (string) content.GetValueForProperty("IdentifierOffer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).IdentifierOffer, global::System.Convert.ToString); + } + if (content.Contains("IdentifierSku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).IdentifierSku = (string) content.GetValueForProperty("IdentifierSku",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).IdentifierSku, global::System.Convert.ToString); + } + if (content.Contains("VersionProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).VersionProperty = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties) content.GetValueForProperty("VersionProperty",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).VersionProperty, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("VersionName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).VersionName = (string) content.GetValueForProperty("VersionName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).VersionName, global::System.Convert.ToString); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusDownloadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StatusDownloadStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus) content.GetValueForProperty("StatusDownloadStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StatusDownloadStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusDownloadStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StatusProgressPercentage = (long?) content.GetValueForProperty("StatusProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StatusProgressPercentage, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("StorageProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StorageProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile) content.GetValueForProperty("StorageProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StorageProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionStorageProfileTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + if (content.Contains("DownloadStatusDownloadSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).DownloadStatusDownloadSizeInMb = (long?) content.GetValueForProperty("DownloadStatusDownloadSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).DownloadStatusDownloadSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StorageProfileOSDiskImage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StorageProfileOSDiskImage = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage) content.GetValueForProperty("StorageProfileOSDiskImage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StorageProfileOSDiskImage, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryDiskImageTypeConverter.ConvertFrom); + } + if (content.Contains("OSDiskImageSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).OSDiskImageSizeInMb = (long?) content.GetValueForProperty("OSDiskImageSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).OSDiskImageSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MarketplaceGalleryImages(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImagePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation) content.GetValueForProperty("ExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ExtendedLocationName = (string) content.GetValueForProperty("ExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("Identifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).Identifier = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier) content.GetValueForProperty("Identifier",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).Identifier, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageIdentifierTypeConverter.ConvertFrom); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).Version = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).Version, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ContainerId = (string) content.GetValueForProperty("ContainerId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ContainerId, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).OSType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).OSType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes.CreateFrom); + } + if (content.Contains("CloudInitDataSource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).CloudInitDataSource = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource?) content.GetValueForProperty("CloudInitDataSource",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).CloudInitDataSource, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource.CreateFrom); + } + if (content.Contains("HyperVGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).HyperVGeneration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration?) content.GetValueForProperty("HyperVGeneration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).HyperVGeneration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration.CreateFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("ExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ExtendedLocationType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes?) content.GetValueForProperty("ExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ExtendedLocationType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes.CreateFrom); + } + if (content.Contains("IdentifierPublisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).IdentifierPublisher = (string) content.GetValueForProperty("IdentifierPublisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).IdentifierPublisher, global::System.Convert.ToString); + } + if (content.Contains("IdentifierOffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).IdentifierOffer = (string) content.GetValueForProperty("IdentifierOffer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).IdentifierOffer, global::System.Convert.ToString); + } + if (content.Contains("IdentifierSku")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).IdentifierSku = (string) content.GetValueForProperty("IdentifierSku",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).IdentifierSku, global::System.Convert.ToString); + } + if (content.Contains("VersionProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).VersionProperty = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties) content.GetValueForProperty("VersionProperty",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).VersionProperty, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("VersionName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).VersionName = (string) content.GetValueForProperty("VersionName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).VersionName, global::System.Convert.ToString); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusDownloadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StatusDownloadStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus) content.GetValueForProperty("StatusDownloadStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StatusDownloadStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageStatusDownloadStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StatusProgressPercentage = (long?) content.GetValueForProperty("StatusProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StatusProgressPercentage, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("StorageProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StorageProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile) content.GetValueForProperty("StorageProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StorageProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImageVersionStorageProfileTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + if (content.Contains("DownloadStatusDownloadSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).DownloadStatusDownloadSizeInMb = (long?) content.GetValueForProperty("DownloadStatusDownloadSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).DownloadStatusDownloadSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StorageProfileOSDiskImage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StorageProfileOSDiskImage = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage) content.GetValueForProperty("StorageProfileOSDiskImage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).StorageProfileOSDiskImage, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryDiskImageTypeConverter.ConvertFrom); + } + if (content.Contains("OSDiskImageSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).OSDiskImageSizeInMb = (long?) content.GetValueForProperty("OSDiskImageSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal)this).OSDiskImageSizeInMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The marketplace gallery image resource definition. + [System.ComponentModel.TypeConverter(typeof(MarketplaceGalleryImagesTypeConverter))] + public partial interface IMarketplaceGalleryImages + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImages.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImages.TypeConverter.cs new file mode 100644 index 000000000000..6ec43d0222d6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImages.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MarketplaceGalleryImagesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MarketplaceGalleryImages.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MarketplaceGalleryImages.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MarketplaceGalleryImages.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImages.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImages.cs new file mode 100644 index 000000000000..67ff64d64497 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImages.cs @@ -0,0 +1,465 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The marketplace gallery image resource definition. + public partial class MarketplaceGalleryImages : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResource(); + + /// + /// Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource? CloudInitDataSource { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).CloudInitDataSource; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).CloudInitDataSource = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource)""); } + + /// + /// Storage ContainerID of the storage container to be used for marketplace gallery image + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ContainerId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).ContainerId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).ContainerId = value ?? null; } + + /// The downloaded sized of the image in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? DownloadStatusDownloadSizeInMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).DownloadStatusDownloadSizeInMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).DownloadStatusDownloadSizeInMb = value ?? default(long); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation _extendedLocation; + + /// The extendedLocation of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation ExtendedLocation { get => (this._extendedLocation = this._extendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation()); set => this._extendedLocation = value; } + + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ExtendedLocationName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Name = value ?? null; } + + /// The type of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? ExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Type = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes)""); } + + /// The hypervisor generation of the Virtual Machine [V1, V2] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration? HyperVGeneration { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).HyperVGeneration; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).HyperVGeneration = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration)""); } + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id; } + + /// The name of the gallery image definition offer. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentifierOffer { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).IdentifierOffer; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).IdentifierOffer = value ?? null; } + + /// The name of the gallery image definition publisher. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentifierPublisher { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).IdentifierPublisher; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).IdentifierPublisher = value ?? null; } + + /// The name of the gallery image definition SKU. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentifierSku { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).IdentifierSku; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).IdentifierSku = value ?? null; } + + /// The geo-location where the resource lives + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Location = value ; } + + /// Internal Acessors for ExtendedLocation + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal.ExtendedLocation { get => (this._extendedLocation = this._extendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation()); set { {_extendedLocation = value;} } } + + /// Internal Acessors for Identifier + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal.Identifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).Identifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).Identifier = value; } + + /// Internal Acessors for OSDiskImageSizeInMb + long? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal.OSDiskImageSizeInMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).OSDiskImageSizeInMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).OSDiskImageSizeInMb = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal.Status { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).Status = value; } + + /// Internal Acessors for StatusDownloadStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal.StatusDownloadStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).StatusDownloadStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).StatusDownloadStatus = value; } + + /// Internal Acessors for StatusProvisioningStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal.StatusProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).StatusProvisioningStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).StatusProvisioningStatus = value; } + + /// Internal Acessors for StorageProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal.StorageProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).StorageProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).StorageProfile = value; } + + /// Internal Acessors for StorageProfileOSDiskImage + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal.StorageProfileOSDiskImage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).StorageProfileOSDiskImage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).StorageProfileOSDiskImage = value; } + + /// Internal Acessors for Version + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal.Version { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).Version; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).Version = value; } + + /// Internal Acessors for VersionProperty + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesInternal.VersionProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).VersionProperty; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).VersionProperty = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name; } + + /// This property indicates the size of the VHD to be created. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? OSDiskImageSizeInMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).OSDiskImageSizeInMb; } + + /// Operating system type that the gallery image uses [Windows, Linux] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes? OSType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).OSType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).OSType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes)""); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageProperties _property; + + /// Properties under the marketplace gallery image resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageProperties()); set => this._property = value; } + + /// Provisioning state of the marketplace gallery image. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).ProvisioningState; } + + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).ProvisioningStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).ProvisioningStatus = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status)""); } + + /// The ID of the operation performed on the gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningStatusOperationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).ProvisioningStatusOperationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).ProvisioningStatusOperationId = value ?? null; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// MarketplaceGalleryImage provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).StatusErrorCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).StatusErrorCode = value ?? null; } + + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).StatusErrorMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).StatusErrorMessage = value ?? null; } + + /// The progress of the operation in percentage + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? StatusProgressPercentage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).StatusProgressPercentage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).StatusProgressPercentage = value ?? default(long); } + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData; } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Tag = value ?? null /* model class */; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type; } + + /// This is the version of the gallery image. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string VersionName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).VersionName; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagePropertiesInternal)Property).VersionName = value ?? null; } + + /// Creates an new instance. + public MarketplaceGalleryImages() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__trackedResource), __trackedResource); + await eventListener.AssertObjectIsValid(nameof(__trackedResource), __trackedResource); + } + } + /// The marketplace gallery image resource definition. + public partial interface IMarketplaceGalleryImages : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource + { + /// + /// Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure]", + SerializedName = @"cloudInitDataSource", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource? CloudInitDataSource { get; set; } + /// + /// Storage ContainerID of the storage container to be used for marketplace gallery image + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Storage ContainerID of the storage container to be used for marketplace gallery image", + SerializedName = @"containerId", + PossibleTypes = new [] { typeof(string) })] + string ContainerId { get; set; } + /// The downloaded sized of the image in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The downloaded sized of the image in MB", + SerializedName = @"downloadSizeInMB", + PossibleTypes = new [] { typeof(long) })] + long? DownloadStatusDownloadSizeInMb { get; set; } + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string ExtendedLocationName { get; set; } + /// The type of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the extended location.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? ExtendedLocationType { get; set; } + /// The hypervisor generation of the Virtual Machine [V1, V2] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The hypervisor generation of the Virtual Machine [V1, V2]", + SerializedName = @"hyperVGeneration", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration? HyperVGeneration { get; set; } + /// The name of the gallery image definition offer. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition offer.", + SerializedName = @"offer", + PossibleTypes = new [] { typeof(string) })] + string IdentifierOffer { get; set; } + /// The name of the gallery image definition publisher. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition publisher.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + string IdentifierPublisher { get; set; } + /// The name of the gallery image definition SKU. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition SKU.", + SerializedName = @"sku", + PossibleTypes = new [] { typeof(string) })] + string IdentifierSku { get; set; } + /// This property indicates the size of the VHD to be created. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"This property indicates the size of the VHD to be created.", + SerializedName = @"sizeInMB", + PossibleTypes = new [] { typeof(long) })] + long? OSDiskImageSizeInMb { get; } + /// Operating system type that the gallery image uses [Windows, Linux] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Operating system type that the gallery image uses [Windows, Linux]", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes? OSType { get; set; } + /// Provisioning state of the marketplace gallery image. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Provisioning state of the marketplace gallery image.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; } + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the gallery image [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the gallery image", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusOperationId { get; set; } + /// MarketplaceGalleryImage provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"MarketplaceGalleryImage provisioning error code", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorCode { get; set; } + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Descriptive error message", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorMessage { get; set; } + /// The progress of the operation in percentage + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The progress of the operation in percentage", + SerializedName = @"progressPercentage", + PossibleTypes = new [] { typeof(long) })] + long? StatusProgressPercentage { get; set; } + /// This is the version of the gallery image. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"This is the version of the gallery image.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string VersionName { get; set; } + + } + /// The marketplace gallery image resource definition. + internal partial interface IMarketplaceGalleryImagesInternal : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal + { + /// + /// Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource? CloudInitDataSource { get; set; } + /// + /// Storage ContainerID of the storage container to be used for marketplace gallery image + /// + string ContainerId { get; set; } + /// The downloaded sized of the image in MB + long? DownloadStatusDownloadSizeInMb { get; set; } + /// The extendedLocation of the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation ExtendedLocation { get; set; } + /// The name of the extended location. + string ExtendedLocationName { get; set; } + /// The type of the extended location. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? ExtendedLocationType { get; set; } + /// The hypervisor generation of the Virtual Machine [V1, V2] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration? HyperVGeneration { get; set; } + /// This is the gallery image definition identifier. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageIdentifier Identifier { get; set; } + /// The name of the gallery image definition offer. + string IdentifierOffer { get; set; } + /// The name of the gallery image definition publisher. + string IdentifierPublisher { get; set; } + /// The name of the gallery image definition SKU. + string IdentifierSku { get; set; } + /// This property indicates the size of the VHD to be created. + long? OSDiskImageSizeInMb { get; set; } + /// Operating system type that the gallery image uses [Windows, Linux] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes? OSType { get; set; } + /// Properties under the marketplace gallery image resource + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageProperties Property { get; set; } + /// Provisioning state of the marketplace gallery image. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; set; } + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the gallery image + string ProvisioningStatusOperationId { get; set; } + /// The observed state of marketplace gallery images + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatus Status { get; set; } + /// The download status of the gallery image + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusDownloadStatus StatusDownloadStatus { get; set; } + /// MarketplaceGalleryImage provisioning error code + string StatusErrorCode { get; set; } + /// Descriptive error message + string StatusErrorMessage { get; set; } + /// The progress of the operation in percentage + long? StatusProgressPercentage { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImageStatusProvisioningStatus StatusProvisioningStatus { get; set; } + /// This is the storage profile of a Gallery Image Version. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionStorageProfile StorageProfile { get; set; } + /// This is the disk image base class. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryDiskImage StorageProfileOSDiskImage { get; set; } + /// + /// Specifies information about the gallery image version that you want to create or update. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersion Version { get; set; } + /// This is the version of the gallery image. + string VersionName { get; set; } + /// Describes the properties of a gallery image version. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImageVersionProperties VersionProperty { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImages.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImages.json.cs new file mode 100644 index 000000000000..73bf10b47a59 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImages.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The marketplace gallery image resource definition. + public partial class MarketplaceGalleryImages + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MarketplaceGalleryImages(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal MarketplaceGalleryImages(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImageProperties.FromJson(__jsonProperties) : Property;} + {_extendedLocation = If( json?.PropertyT("extendedLocation"), out var __jsonExtendedLocation) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation.FromJson(__jsonExtendedLocation) : ExtendedLocation;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __trackedResource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != this._extendedLocation ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._extendedLocation.ToJson(null,serializationMode) : null, "extendedLocation" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesListResult.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesListResult.PowerShell.cs new file mode 100644 index 000000000000..a0c458614631 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesListResult.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(MarketplaceGalleryImagesListResultTypeConverter))] + public partial class MarketplaceGalleryImagesListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MarketplaceGalleryImagesListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MarketplaceGalleryImagesListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MarketplaceGalleryImagesListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImagesTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MarketplaceGalleryImagesListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImagesTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(MarketplaceGalleryImagesListResultTypeConverter))] + public partial interface IMarketplaceGalleryImagesListResult + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesListResult.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesListResult.TypeConverter.cs new file mode 100644 index 000000000000..8f5b6e934f71 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesListResult.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MarketplaceGalleryImagesListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MarketplaceGalleryImagesListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MarketplaceGalleryImagesListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MarketplaceGalleryImagesListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesListResult.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesListResult.cs new file mode 100644 index 000000000000..efe9e0594fb8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesListResult.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class MarketplaceGalleryImagesListResult : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesListResult, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages[] _value; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public MarketplaceGalleryImagesListResult() + { + + } + } + public partial interface IMarketplaceGalleryImagesListResult : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages[] Value { get; set; } + + } + internal partial interface IMarketplaceGalleryImagesListResultInternal + + { + string NextLink { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesListResult.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesListResult.json.cs new file mode 100644 index 000000000000..91486eeebae3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesListResult.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class MarketplaceGalleryImagesListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MarketplaceGalleryImagesListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal MarketplaceGalleryImagesListResult(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImages.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequest.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequest.PowerShell.cs new file mode 100644 index 000000000000..52bd70899daa --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequest.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The marketplace gallery image resource patch definition. + [System.ComponentModel.TypeConverter(typeof(MarketplaceGalleryImagesUpdateRequestTypeConverter))] + public partial class MarketplaceGalleryImagesUpdateRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MarketplaceGalleryImagesUpdateRequest(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MarketplaceGalleryImagesUpdateRequest(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MarketplaceGalleryImagesUpdateRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImagesUpdateRequestTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MarketplaceGalleryImagesUpdateRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImagesUpdateRequestTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The marketplace gallery image resource patch definition. + [System.ComponentModel.TypeConverter(typeof(MarketplaceGalleryImagesUpdateRequestTypeConverter))] + public partial interface IMarketplaceGalleryImagesUpdateRequest + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequest.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequest.TypeConverter.cs new file mode 100644 index 000000000000..448b0a6be7c2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequest.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MarketplaceGalleryImagesUpdateRequestTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MarketplaceGalleryImagesUpdateRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MarketplaceGalleryImagesUpdateRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MarketplaceGalleryImagesUpdateRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequest.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequest.cs new file mode 100644 index 000000000000..7c629610d8e7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequest.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The marketplace gallery image resource patch definition. + public partial class MarketplaceGalleryImagesUpdateRequest : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequest, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTags _tag; + + /// Resource tags + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImagesUpdateRequestTags()); set => this._tag = value; } + + /// Creates an new instance. + public MarketplaceGalleryImagesUpdateRequest() + { + + } + } + /// The marketplace gallery image resource patch definition. + public partial interface IMarketplaceGalleryImagesUpdateRequest : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Resource tags + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTags) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTags Tag { get; set; } + + } + /// The marketplace gallery image resource patch definition. + internal partial interface IMarketplaceGalleryImagesUpdateRequestInternal + + { + /// Resource tags + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequest.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequest.json.cs new file mode 100644 index 000000000000..a7c209c247d1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequest.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The marketplace gallery image resource patch definition. + public partial class MarketplaceGalleryImagesUpdateRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MarketplaceGalleryImagesUpdateRequest(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal MarketplaceGalleryImagesUpdateRequest(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImagesUpdateRequestTags.FromJson(__jsonTags) : Tag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequestTags.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequestTags.PowerShell.cs new file mode 100644 index 000000000000..cd02ca6a7c6b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequestTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Resource tags + [System.ComponentModel.TypeConverter(typeof(MarketplaceGalleryImagesUpdateRequestTagsTypeConverter))] + public partial class MarketplaceGalleryImagesUpdateRequestTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MarketplaceGalleryImagesUpdateRequestTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MarketplaceGalleryImagesUpdateRequestTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MarketplaceGalleryImagesUpdateRequestTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MarketplaceGalleryImagesUpdateRequestTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Resource tags + [System.ComponentModel.TypeConverter(typeof(MarketplaceGalleryImagesUpdateRequestTagsTypeConverter))] + public partial interface IMarketplaceGalleryImagesUpdateRequestTags + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequestTags.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequestTags.TypeConverter.cs new file mode 100644 index 000000000000..fcad05b15555 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequestTags.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MarketplaceGalleryImagesUpdateRequestTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MarketplaceGalleryImagesUpdateRequestTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MarketplaceGalleryImagesUpdateRequestTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MarketplaceGalleryImagesUpdateRequestTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequestTags.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequestTags.cs new file mode 100644 index 000000000000..9538ddca5568 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequestTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Resource tags + public partial class MarketplaceGalleryImagesUpdateRequestTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTags, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTagsInternal + { + + /// + /// Creates an new instance. + /// + public MarketplaceGalleryImagesUpdateRequestTags() + { + + } + } + /// Resource tags + public partial interface IMarketplaceGalleryImagesUpdateRequestTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + + } + /// Resource tags + internal partial interface IMarketplaceGalleryImagesUpdateRequestTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequestTags.dictionary.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequestTags.dictionary.cs new file mode 100644 index 000000000000..24c9b90465c4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequestTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class MarketplaceGalleryImagesUpdateRequestTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImagesUpdateRequestTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequestTags.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequestTags.json.cs new file mode 100644 index 000000000000..39e05ba1156b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/MarketplaceGalleryImagesUpdateRequestTags.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Resource tags + public partial class MarketplaceGalleryImagesUpdateRequestTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new MarketplaceGalleryImagesUpdateRequestTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + /// + internal MarketplaceGalleryImagesUpdateRequestTags(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceProperties.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceProperties.PowerShell.cs new file mode 100644 index 000000000000..0458abfc4132 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceProperties.PowerShell.cs @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Properties under the network interface resource + [System.ComponentModel.TypeConverter(typeof(NetworkInterfacePropertiesTypeConverter))] + public partial class NetworkInterfaceProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NetworkInterfaceProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NetworkInterfaceProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NetworkInterfaceProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DnsSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).DnsSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettings) content.GetValueForProperty("DnsSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).DnsSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.InterfaceDnsSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceStatusTypeConverter.ConvertFrom); + } + if (content.Contains("IPConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).IPConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration[]) content.GetValueForProperty("IPConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).IPConfiguration, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPConfigurationTypeConverter.ConvertFrom)); + } + if (content.Contains("MacAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).MacAddress = (string) content.GetValueForProperty("MacAddress",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).MacAddress, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("DnsSettingDnsServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).DnsSettingDnsServer = (string[]) content.GetValueForProperty("DnsSettingDnsServer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).DnsSettingDnsServer, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NetworkInterfaceProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DnsSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).DnsSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettings) content.GetValueForProperty("DnsSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).DnsSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.InterfaceDnsSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceStatusTypeConverter.ConvertFrom); + } + if (content.Contains("IPConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).IPConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration[]) content.GetValueForProperty("IPConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).IPConfiguration, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPConfigurationTypeConverter.ConvertFrom)); + } + if (content.Contains("MacAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).MacAddress = (string) content.GetValueForProperty("MacAddress",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).MacAddress, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("DnsSettingDnsServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).DnsSettingDnsServer = (string[]) content.GetValueForProperty("DnsSettingDnsServer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).DnsSettingDnsServer, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Properties under the network interface resource + [System.ComponentModel.TypeConverter(typeof(NetworkInterfacePropertiesTypeConverter))] + public partial interface INetworkInterfaceProperties + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceProperties.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceProperties.TypeConverter.cs new file mode 100644 index 000000000000..b5a140d7be7b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NetworkInterfacePropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NetworkInterfaceProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NetworkInterfaceProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NetworkInterfaceProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceProperties.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceProperties.cs new file mode 100644 index 000000000000..3e8541bfd4d3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceProperties.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Properties under the network interface resource + public partial class NetworkInterfaceProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceProperties, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettings _dnsSetting; + + /// DNS Settings for the interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettings DnsSetting { get => (this._dnsSetting = this._dnsSetting ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.InterfaceDnsSettings()); set => this._dnsSetting = value; } + + /// List of DNS server IP Addresses for the interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string[] DnsSettingDnsServer { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettingsInternal)DnsSetting).DnsServer; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettingsInternal)DnsSetting).DnsServer = value ?? null /* arrayOf */; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration[] _iPConfiguration; + + /// IPConfigurations - A list of IPConfigurations of the network interface. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration[] IPConfiguration { get => this._iPConfiguration; set => this._iPConfiguration = value; } + + /// Backing field for property. + private string _macAddress; + + /// MacAddress - The MAC address of the network interface. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string MacAddress { get => this._macAddress; set => this._macAddress = value; } + + /// Internal Acessors for DnsSetting + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettings Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal.DnsSetting { get => (this._dnsSetting = this._dnsSetting ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.InterfaceDnsSettings()); set { {_dnsSetting = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal.Status { get => (this._status = this._status ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceStatus()); set { {_status = value;} } } + + /// Internal Acessors for StatusProvisioningStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal.StatusProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)Status).ProvisioningStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)Status).ProvisioningStatus = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? _provisioningState; + + /// Provisioning state of the network interface. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get => this._provisioningState; } + + /// + /// The status of the operation performed on the network interface [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)Status).ProvisioningStatusStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)Status).ProvisioningStatusStatus = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status)""); } + + /// The ID of the operation performed on the network interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningStatusOperationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)Status).ProvisioningStatusOperationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)Status).ProvisioningStatusOperationId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatus _status; + + /// The observed state of network interfaces + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatus Status { get => (this._status = this._status ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceStatus()); } + + /// NetworkInterface provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)Status).ErrorCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)Status).ErrorCode = value ?? null; } + + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)Status).ErrorMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)Status).ErrorMessage = value ?? null; } + + /// Creates an new instance. + public NetworkInterfaceProperties() + { + + } + } + /// Properties under the network interface resource + public partial interface INetworkInterfaceProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// List of DNS server IP Addresses for the interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of DNS server IP Addresses for the interface", + SerializedName = @"dnsServers", + PossibleTypes = new [] { typeof(string) })] + string[] DnsSettingDnsServer { get; set; } + /// IPConfigurations - A list of IPConfigurations of the network interface. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"IPConfigurations - A list of IPConfigurations of the network interface.", + SerializedName = @"ipConfigurations", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration[] IPConfiguration { get; set; } + /// MacAddress - The MAC address of the network interface. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"MacAddress - The MAC address of the network interface.", + SerializedName = @"macAddress", + PossibleTypes = new [] { typeof(string) })] + string MacAddress { get; set; } + /// Provisioning state of the network interface. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Provisioning state of the network interface.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; } + /// + /// The status of the operation performed on the network interface [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the network interface [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the network interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the network interface", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusOperationId { get; set; } + /// NetworkInterface provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"NetworkInterface provisioning error code", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorCode { get; set; } + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Descriptive error message", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorMessage { get; set; } + + } + /// Properties under the network interface resource + internal partial interface INetworkInterfacePropertiesInternal + + { + /// DNS Settings for the interface + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettings DnsSetting { get; set; } + /// List of DNS server IP Addresses for the interface + string[] DnsSettingDnsServer { get; set; } + /// IPConfigurations - A list of IPConfigurations of the network interface. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration[] IPConfiguration { get; set; } + /// MacAddress - The MAC address of the network interface. + string MacAddress { get; set; } + /// Provisioning state of the network interface. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; set; } + /// + /// The status of the operation performed on the network interface [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the network interface + string ProvisioningStatusOperationId { get; set; } + /// The observed state of network interfaces + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatus Status { get; set; } + /// NetworkInterface provisioning error code + string StatusErrorCode { get; set; } + /// Descriptive error message + string StatusErrorMessage { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus StatusProvisioningStatus { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceProperties.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceProperties.json.cs new file mode 100644 index 000000000000..69a0a13b31ab --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceProperties.json.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Properties under the network interface resource + public partial class NetworkInterfaceProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new NetworkInterfaceProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal NetworkInterfaceProperties(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_dnsSetting = If( json?.PropertyT("dnsSettings"), out var __jsonDnsSettings) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.InterfaceDnsSettings.FromJson(__jsonDnsSettings) : DnsSetting;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceStatus.FromJson(__jsonStatus) : Status;} + {_iPConfiguration = If( json?.PropertyT("ipConfigurations"), out var __jsonIPConfigurations) ? If( __jsonIPConfigurations as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPConfiguration.FromJson(__u) )) ))() : null : IPConfiguration;} + {_macAddress = If( json?.PropertyT("macAddress"), out var __jsonMacAddress) ? (string)__jsonMacAddress : (string)MacAddress;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._dnsSetting ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._dnsSetting.ToJson(null,serializationMode) : null, "dnsSettings" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._status ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._status.ToJson(null,serializationMode) : null, "status" ,container.Add ); + } + if (null != this._iPConfiguration) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._iPConfiguration ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("ipConfigurations",__w); + } + AddIf( null != (((object)this._macAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._macAddress.ToString()) : null, "macAddress" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatus.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatus.PowerShell.cs new file mode 100644 index 000000000000..9f30a5ae92ea --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatus.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The observed state of network interfaces + [System.ComponentModel.TypeConverter(typeof(NetworkInterfaceStatusTypeConverter))] + public partial class NetworkInterfaceStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NetworkInterfaceStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NetworkInterfaceStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NetworkInterfaceStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)this).ProvisioningStatusStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatusStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)this).ProvisioningStatusStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NetworkInterfaceStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)this).ProvisioningStatusStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatusStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)this).ProvisioningStatusStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The observed state of network interfaces + [System.ComponentModel.TypeConverter(typeof(NetworkInterfaceStatusTypeConverter))] + public partial interface INetworkInterfaceStatus + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatus.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatus.TypeConverter.cs new file mode 100644 index 000000000000..9fd688ddd4f8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatus.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NetworkInterfaceStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NetworkInterfaceStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NetworkInterfaceStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NetworkInterfaceStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatus.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatus.cs new file mode 100644 index 000000000000..b6ebe7449523 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatus.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The observed state of network interfaces + public partial class NetworkInterfaceStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatus, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal + { + + /// Backing field for property. + private string _errorCode; + + /// NetworkInterface provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ErrorCode { get => this._errorCode; set => this._errorCode = value; } + + /// Backing field for property. + private string _errorMessage; + + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ErrorMessage { get => this._errorMessage; set => this._errorMessage = value; } + + /// Internal Acessors for ProvisioningStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusInternal.ProvisioningStatus { get => (this._provisioningStatus = this._provisioningStatus ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceStatusProvisioningStatus()); set { {_provisioningStatus = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus _provisioningStatus; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus ProvisioningStatus { get => (this._provisioningStatus = this._provisioningStatus ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceStatusProvisioningStatus()); set => this._provisioningStatus = value; } + + /// The ID of the operation performed on the network interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningStatusOperationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatusInternal)ProvisioningStatus).OperationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatusInternal)ProvisioningStatus).OperationId = value ?? null; } + + /// + /// The status of the operation performed on the network interface [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatusStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatusInternal)ProvisioningStatus).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatusInternal)ProvisioningStatus).Status = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status)""); } + + /// Creates an new instance. + public NetworkInterfaceStatus() + { + + } + } + /// The observed state of network interfaces + public partial interface INetworkInterfaceStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// NetworkInterface provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"NetworkInterface provisioning error code", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string ErrorCode { get; set; } + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Descriptive error message", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; set; } + /// The ID of the operation performed on the network interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the network interface", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusOperationId { get; set; } + /// + /// The status of the operation performed on the network interface [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the network interface [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatusStatus { get; set; } + + } + /// The observed state of network interfaces + internal partial interface INetworkInterfaceStatusInternal + + { + /// NetworkInterface provisioning error code + string ErrorCode { get; set; } + /// Descriptive error message + string ErrorMessage { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus ProvisioningStatus { get; set; } + /// The ID of the operation performed on the network interface + string ProvisioningStatusOperationId { get; set; } + /// + /// The status of the operation performed on the network interface [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatusStatus { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatus.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatus.json.cs new file mode 100644 index 000000000000..6faf9a79b167 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatus.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The observed state of network interfaces + public partial class NetworkInterfaceStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new NetworkInterfaceStatus(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal NetworkInterfaceStatus(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provisioningStatus = If( json?.PropertyT("provisioningStatus"), out var __jsonProvisioningStatus) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceStatusProvisioningStatus.FromJson(__jsonProvisioningStatus) : ProvisioningStatus;} + {_errorCode = If( json?.PropertyT("errorCode"), out var __jsonErrorCode) ? (string)__jsonErrorCode : (string)ErrorCode;} + {_errorMessage = If( json?.PropertyT("errorMessage"), out var __jsonErrorMessage) ? (string)__jsonErrorMessage : (string)ErrorMessage;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._provisioningStatus ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._provisioningStatus.ToJson(null,serializationMode) : null, "provisioningStatus" ,container.Add ); + AddIf( null != (((object)this._errorCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._errorCode.ToString()) : null, "errorCode" ,container.Add ); + AddIf( null != (((object)this._errorMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._errorMessage.ToString()) : null, "errorMessage" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatusProvisioningStatus.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatusProvisioningStatus.PowerShell.cs new file mode 100644 index 000000000000..855f6fd59ed5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatusProvisioningStatus.PowerShell.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(NetworkInterfaceStatusProvisioningStatusTypeConverter))] + public partial class NetworkInterfaceStatusProvisioningStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NetworkInterfaceStatusProvisioningStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NetworkInterfaceStatusProvisioningStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NetworkInterfaceStatusProvisioningStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatusInternal)this).OperationId = (string) content.GetValueForProperty("OperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatusInternal)this).OperationId, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatusInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatusInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NetworkInterfaceStatusProvisioningStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatusInternal)this).OperationId = (string) content.GetValueForProperty("OperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatusInternal)this).OperationId, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatusInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatusInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(NetworkInterfaceStatusProvisioningStatusTypeConverter))] + public partial interface INetworkInterfaceStatusProvisioningStatus + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatusProvisioningStatus.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatusProvisioningStatus.TypeConverter.cs new file mode 100644 index 000000000000..3367c0031736 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatusProvisioningStatus.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NetworkInterfaceStatusProvisioningStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NetworkInterfaceStatusProvisioningStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NetworkInterfaceStatusProvisioningStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NetworkInterfaceStatusProvisioningStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatusProvisioningStatus.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatusProvisioningStatus.cs new file mode 100644 index 000000000000..041d3e15f9cd --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatusProvisioningStatus.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class NetworkInterfaceStatusProvisioningStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatusInternal + { + + /// Backing field for property. + private string _operationId; + + /// The ID of the operation performed on the network interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string OperationId { get => this._operationId; set => this._operationId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? _status; + + /// + /// The status of the operation performed on the network interface [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? Status { get => this._status; set => this._status = value; } + + /// + /// Creates an new instance. + /// + public NetworkInterfaceStatusProvisioningStatus() + { + + } + } + public partial interface INetworkInterfaceStatusProvisioningStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The ID of the operation performed on the network interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the network interface", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string OperationId { get; set; } + /// + /// The status of the operation performed on the network interface [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the network interface [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? Status { get; set; } + + } + internal partial interface INetworkInterfaceStatusProvisioningStatusInternal + + { + /// The ID of the operation performed on the network interface + string OperationId { get; set; } + /// + /// The status of the operation performed on the network interface [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? Status { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatusProvisioningStatus.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatusProvisioningStatus.json.cs new file mode 100644 index 000000000000..bb7e74f1351a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaceStatusProvisioningStatus.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class NetworkInterfaceStatusProvisioningStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new NetworkInterfaceStatusProvisioningStatus(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal NetworkInterfaceStatusProvisioningStatus(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_operationId = If( json?.PropertyT("operationId"), out var __jsonOperationId) ? (string)__jsonOperationId : (string)OperationId;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)Status;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._operationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._operationId.ToString()) : null, "operationId" ,container.Add ); + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaces.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaces.PowerShell.cs new file mode 100644 index 000000000000..8115d95a870f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaces.PowerShell.cs @@ -0,0 +1,354 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The network interface resource definition. + [System.ComponentModel.TypeConverter(typeof(NetworkInterfacesTypeConverter))] + public partial class NetworkInterfaces + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NetworkInterfaces(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NetworkInterfaces(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NetworkInterfaces(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfacePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation) content.GetValueForProperty("ExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ExtendedLocationName = (string) content.GetValueForProperty("ExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("DnsSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).DnsSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettings) content.GetValueForProperty("DnsSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).DnsSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.InterfaceDnsSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceStatusTypeConverter.ConvertFrom); + } + if (content.Contains("IPConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).IPConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration[]) content.GetValueForProperty("IPConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).IPConfiguration, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPConfigurationTypeConverter.ConvertFrom)); + } + if (content.Contains("MacAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).MacAddress = (string) content.GetValueForProperty("MacAddress",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).MacAddress, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("ExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ExtendedLocationType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes?) content.GetValueForProperty("ExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ExtendedLocationType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes.CreateFrom); + } + if (content.Contains("DnsSettingDnsServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).DnsSettingDnsServer = (string[]) content.GetValueForProperty("DnsSettingDnsServer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).DnsSettingDnsServer, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NetworkInterfaces(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfacePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation) content.GetValueForProperty("ExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ExtendedLocationName = (string) content.GetValueForProperty("ExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("DnsSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).DnsSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettings) content.GetValueForProperty("DnsSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).DnsSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.InterfaceDnsSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceStatusTypeConverter.ConvertFrom); + } + if (content.Contains("IPConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).IPConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration[]) content.GetValueForProperty("IPConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).IPConfiguration, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPConfigurationTypeConverter.ConvertFrom)); + } + if (content.Contains("MacAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).MacAddress = (string) content.GetValueForProperty("MacAddress",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).MacAddress, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("ExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ExtendedLocationType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes?) content.GetValueForProperty("ExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ExtendedLocationType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes.CreateFrom); + } + if (content.Contains("DnsSettingDnsServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).DnsSettingDnsServer = (string[]) content.GetValueForProperty("DnsSettingDnsServer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).DnsSettingDnsServer, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The network interface resource definition. + [System.ComponentModel.TypeConverter(typeof(NetworkInterfacesTypeConverter))] + public partial interface INetworkInterfaces + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaces.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaces.TypeConverter.cs new file mode 100644 index 000000000000..2067c11d0ff4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaces.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NetworkInterfacesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NetworkInterfaces.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NetworkInterfaces.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NetworkInterfaces.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaces.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaces.cs new file mode 100644 index 000000000000..3b0c5161183c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaces.cs @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The network interface resource definition. + public partial class NetworkInterfaces : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResource(); + + /// List of DNS server IP Addresses for the interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string[] DnsSettingDnsServer { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).DnsSettingDnsServer; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).DnsSettingDnsServer = value ?? null /* arrayOf */; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation _extendedLocation; + + /// The extendedLocation of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation ExtendedLocation { get => (this._extendedLocation = this._extendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation()); set => this._extendedLocation = value; } + + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ExtendedLocationName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Name = value ?? null; } + + /// The type of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? ExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Type = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes)""); } + + /// IPConfigurations - A list of IPConfigurations of the network interface. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration[] IPConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).IPConfiguration; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).IPConfiguration = value ?? null /* arrayOf */; } + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id; } + + /// The geo-location where the resource lives + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Location = value ; } + + /// MacAddress - The MAC address of the network interface. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string MacAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).MacAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).MacAddress = value ?? null; } + + /// Internal Acessors for DnsSetting + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettings Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal.DnsSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).DnsSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).DnsSetting = value; } + + /// Internal Acessors for ExtendedLocation + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal.ExtendedLocation { get => (this._extendedLocation = this._extendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation()); set { {_extendedLocation = value;} } } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal.Status { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).Status = value; } + + /// Internal Acessors for StatusProvisioningStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesInternal.StatusProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).StatusProvisioningStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).StatusProvisioningStatus = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceProperties _property; + + /// Properties under the network interface resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceProperties()); set => this._property = value; } + + /// Provisioning state of the network interface. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).ProvisioningState; } + + /// + /// The status of the operation performed on the network interface [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).ProvisioningStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).ProvisioningStatus = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status)""); } + + /// The ID of the operation performed on the network interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningStatusOperationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).ProvisioningStatusOperationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).ProvisioningStatusOperationId = value ?? null; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// NetworkInterface provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).StatusErrorCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).StatusErrorCode = value ?? null; } + + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).StatusErrorMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacePropertiesInternal)Property).StatusErrorMessage = value ?? null; } + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData; } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Tag = value ?? null /* model class */; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type; } + + /// Creates an new instance. + public NetworkInterfaces() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__trackedResource), __trackedResource); + await eventListener.AssertObjectIsValid(nameof(__trackedResource), __trackedResource); + } + } + /// The network interface resource definition. + public partial interface INetworkInterfaces : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource + { + /// List of DNS server IP Addresses for the interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of DNS server IP Addresses for the interface", + SerializedName = @"dnsServers", + PossibleTypes = new [] { typeof(string) })] + string[] DnsSettingDnsServer { get; set; } + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string ExtendedLocationName { get; set; } + /// The type of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the extended location.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? ExtendedLocationType { get; set; } + /// IPConfigurations - A list of IPConfigurations of the network interface. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"IPConfigurations - A list of IPConfigurations of the network interface.", + SerializedName = @"ipConfigurations", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration[] IPConfiguration { get; set; } + /// MacAddress - The MAC address of the network interface. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"MacAddress - The MAC address of the network interface.", + SerializedName = @"macAddress", + PossibleTypes = new [] { typeof(string) })] + string MacAddress { get; set; } + /// Provisioning state of the network interface. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Provisioning state of the network interface.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; } + /// + /// The status of the operation performed on the network interface [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the network interface [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the network interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the network interface", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusOperationId { get; set; } + /// NetworkInterface provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"NetworkInterface provisioning error code", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorCode { get; set; } + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Descriptive error message", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorMessage { get; set; } + + } + /// The network interface resource definition. + internal partial interface INetworkInterfacesInternal : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal + { + /// DNS Settings for the interface + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInterfaceDnsSettings DnsSetting { get; set; } + /// List of DNS server IP Addresses for the interface + string[] DnsSettingDnsServer { get; set; } + /// The extendedLocation of the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation ExtendedLocation { get; set; } + /// The name of the extended location. + string ExtendedLocationName { get; set; } + /// The type of the extended location. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? ExtendedLocationType { get; set; } + /// IPConfigurations - A list of IPConfigurations of the network interface. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration[] IPConfiguration { get; set; } + /// MacAddress - The MAC address of the network interface. + string MacAddress { get; set; } + /// Properties under the network interface resource + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceProperties Property { get; set; } + /// Provisioning state of the network interface. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; set; } + /// + /// The status of the operation performed on the network interface [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the network interface + string ProvisioningStatusOperationId { get; set; } + /// The observed state of network interfaces + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatus Status { get; set; } + /// NetworkInterface provisioning error code + string StatusErrorCode { get; set; } + /// Descriptive error message + string StatusErrorMessage { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaceStatusProvisioningStatus StatusProvisioningStatus { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaces.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaces.json.cs new file mode 100644 index 000000000000..90b418077670 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfaces.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The network interface resource definition. + public partial class NetworkInterfaces + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new NetworkInterfaces(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal NetworkInterfaces(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaceProperties.FromJson(__jsonProperties) : Property;} + {_extendedLocation = If( json?.PropertyT("extendedLocation"), out var __jsonExtendedLocation) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation.FromJson(__jsonExtendedLocation) : ExtendedLocation;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __trackedResource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != this._extendedLocation ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._extendedLocation.ToJson(null,serializationMode) : null, "extendedLocation" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesListResult.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesListResult.PowerShell.cs new file mode 100644 index 000000000000..415e716a2baa --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesListResult.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(NetworkInterfacesListResultTypeConverter))] + public partial class NetworkInterfacesListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NetworkInterfacesListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NetworkInterfacesListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NetworkInterfacesListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfacesTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NetworkInterfacesListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfacesTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(NetworkInterfacesListResultTypeConverter))] + public partial interface INetworkInterfacesListResult + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesListResult.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesListResult.TypeConverter.cs new file mode 100644 index 000000000000..fed17b742f26 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesListResult.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NetworkInterfacesListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NetworkInterfacesListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NetworkInterfacesListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NetworkInterfacesListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesListResult.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesListResult.cs new file mode 100644 index 000000000000..71d72e598371 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesListResult.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class NetworkInterfacesListResult : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesListResult, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces[] _value; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public NetworkInterfacesListResult() + { + + } + } + public partial interface INetworkInterfacesListResult : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces[] Value { get; set; } + + } + internal partial interface INetworkInterfacesListResultInternal + + { + string NextLink { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesListResult.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesListResult.json.cs new file mode 100644 index 000000000000..f5d3c0c1d19f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesListResult.json.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class NetworkInterfacesListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new NetworkInterfacesListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal NetworkInterfacesListResult(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaces.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequest.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequest.PowerShell.cs new file mode 100644 index 000000000000..868f04e626d8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequest.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The network interface resource patch definition. + [System.ComponentModel.TypeConverter(typeof(NetworkInterfacesUpdateRequestTypeConverter))] + public partial class NetworkInterfacesUpdateRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NetworkInterfacesUpdateRequest(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NetworkInterfacesUpdateRequest(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NetworkInterfacesUpdateRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfacesUpdateRequestTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NetworkInterfacesUpdateRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfacesUpdateRequestTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The network interface resource patch definition. + [System.ComponentModel.TypeConverter(typeof(NetworkInterfacesUpdateRequestTypeConverter))] + public partial interface INetworkInterfacesUpdateRequest + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequest.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequest.TypeConverter.cs new file mode 100644 index 000000000000..f8a370c8ebe6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequest.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NetworkInterfacesUpdateRequestTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NetworkInterfacesUpdateRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NetworkInterfacesUpdateRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NetworkInterfacesUpdateRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequest.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequest.cs new file mode 100644 index 000000000000..8797664bbf73 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequest.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The network interface resource patch definition. + public partial class NetworkInterfacesUpdateRequest : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequest, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags _tag; + + /// Resource tags + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfacesUpdateRequestTags()); set => this._tag = value; } + + /// Creates an new instance. + public NetworkInterfacesUpdateRequest() + { + + } + } + /// The network interface resource patch definition. + public partial interface INetworkInterfacesUpdateRequest : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Resource tags + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags Tag { get; set; } + + } + /// The network interface resource patch definition. + internal partial interface INetworkInterfacesUpdateRequestInternal + + { + /// Resource tags + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequest.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequest.json.cs new file mode 100644 index 000000000000..d9fbad0872bd --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequest.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The network interface resource patch definition. + public partial class NetworkInterfacesUpdateRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new NetworkInterfacesUpdateRequest(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal NetworkInterfacesUpdateRequest(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfacesUpdateRequestTags.FromJson(__jsonTags) : Tag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequestTags.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequestTags.PowerShell.cs new file mode 100644 index 000000000000..96f06f30d6f5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequestTags.PowerShell.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Resource tags + [System.ComponentModel.TypeConverter(typeof(NetworkInterfacesUpdateRequestTagsTypeConverter))] + public partial class NetworkInterfacesUpdateRequestTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NetworkInterfacesUpdateRequestTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NetworkInterfacesUpdateRequestTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NetworkInterfacesUpdateRequestTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NetworkInterfacesUpdateRequestTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Resource tags + [System.ComponentModel.TypeConverter(typeof(NetworkInterfacesUpdateRequestTagsTypeConverter))] + public partial interface INetworkInterfacesUpdateRequestTags + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequestTags.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequestTags.TypeConverter.cs new file mode 100644 index 000000000000..e34130c8e9f8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequestTags.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NetworkInterfacesUpdateRequestTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NetworkInterfacesUpdateRequestTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NetworkInterfacesUpdateRequestTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NetworkInterfacesUpdateRequestTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequestTags.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequestTags.cs new file mode 100644 index 000000000000..48cd9c52c4c3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequestTags.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Resource tags + public partial class NetworkInterfacesUpdateRequestTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTagsInternal + { + + /// Creates an new instance. + public NetworkInterfacesUpdateRequestTags() + { + + } + } + /// Resource tags + public partial interface INetworkInterfacesUpdateRequestTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + + } + /// Resource tags + internal partial interface INetworkInterfacesUpdateRequestTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequestTags.dictionary.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequestTags.dictionary.cs new file mode 100644 index 000000000000..edeb4323e908 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequestTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class NetworkInterfacesUpdateRequestTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfacesUpdateRequestTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequestTags.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequestTags.json.cs new file mode 100644 index 000000000000..d9ef11cbb36b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkInterfacesUpdateRequestTags.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Resource tags + public partial class NetworkInterfacesUpdateRequestTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new NetworkInterfacesUpdateRequestTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + /// + internal NetworkInterfacesUpdateRequestTags(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdate.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdate.PowerShell.cs new file mode 100644 index 000000000000..f43771d27561 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdate.PowerShell.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// NetworkProfile - describes the network update configuration the virtual machine instance + /// + [System.ComponentModel.TypeConverter(typeof(NetworkProfileUpdateTypeConverter))] + public partial class NetworkProfileUpdate + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NetworkProfileUpdate(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NetworkProfileUpdate(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NetworkProfileUpdate(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateInternal)this).NetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem[]) content.GetValueForProperty("NetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateInternal)this).NetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkProfileUpdateNetworkInterfacesItemTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NetworkProfileUpdate(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateInternal)this).NetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem[]) content.GetValueForProperty("NetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateInternal)this).NetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkProfileUpdateNetworkInterfacesItemTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// NetworkProfile - describes the network update configuration the virtual machine instance + [System.ComponentModel.TypeConverter(typeof(NetworkProfileUpdateTypeConverter))] + public partial interface INetworkProfileUpdate + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdate.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdate.TypeConverter.cs new file mode 100644 index 000000000000..11caaaf33a0e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdate.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NetworkProfileUpdateTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdate ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdate).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NetworkProfileUpdate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NetworkProfileUpdate.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NetworkProfileUpdate.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdate.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdate.cs new file mode 100644 index 000000000000..13ed3c9e9b8e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdate.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// NetworkProfile - describes the network update configuration the virtual machine instance + /// + public partial class NetworkProfileUpdate : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdate, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem[] _networkInterface; + + /// + /// NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem[] NetworkInterface { get => this._networkInterface; set => this._networkInterface = value; } + + /// Creates an new instance. + public NetworkProfileUpdate() + { + + } + } + /// NetworkProfile - describes the network update configuration the virtual machine instance + public partial interface INetworkProfileUpdate : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// + /// NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance", + SerializedName = @"networkInterfaces", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem[] NetworkInterface { get; set; } + + } + /// NetworkProfile - describes the network update configuration the virtual machine instance + internal partial interface INetworkProfileUpdateInternal + + { + /// + /// NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem[] NetworkInterface { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdate.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdate.json.cs new file mode 100644 index 000000000000..94cee9737af9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdate.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// NetworkProfile - describes the network update configuration the virtual machine instance + /// + public partial class NetworkProfileUpdate + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdate. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdate. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new NetworkProfileUpdate(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal NetworkProfileUpdate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_networkInterface = If( json?.PropertyT("networkInterfaces"), out var __jsonNetworkInterfaces) ? If( __jsonNetworkInterfaces as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkProfileUpdateNetworkInterfacesItem.FromJson(__u) )) ))() : null : NetworkInterface;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._networkInterface) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._networkInterface ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("networkInterfaces",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdateNetworkInterfacesItem.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdateNetworkInterfacesItem.PowerShell.cs new file mode 100644 index 000000000000..cc2e79b08409 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdateNetworkInterfacesItem.PowerShell.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(NetworkProfileUpdateNetworkInterfacesItemTypeConverter))] + public partial class NetworkProfileUpdateNetworkInterfacesItem + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NetworkProfileUpdateNetworkInterfacesItem(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NetworkProfileUpdateNetworkInterfacesItem(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NetworkProfileUpdateNetworkInterfacesItem(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItemInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItemInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NetworkProfileUpdateNetworkInterfacesItem(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItemInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItemInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(NetworkProfileUpdateNetworkInterfacesItemTypeConverter))] + public partial interface INetworkProfileUpdateNetworkInterfacesItem + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdateNetworkInterfacesItem.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdateNetworkInterfacesItem.TypeConverter.cs new file mode 100644 index 000000000000..00c619ebb490 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdateNetworkInterfacesItem.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NetworkProfileUpdateNetworkInterfacesItemTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NetworkProfileUpdateNetworkInterfacesItem.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NetworkProfileUpdateNetworkInterfacesItem.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NetworkProfileUpdateNetworkInterfacesItem.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdateNetworkInterfacesItem.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdateNetworkInterfacesItem.cs new file mode 100644 index 000000000000..161d271ae3d0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdateNetworkInterfacesItem.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class NetworkProfileUpdateNetworkInterfacesItem : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItemInternal + { + + /// Backing field for property. + private string _id; + + /// ID - Resource ID of the network interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// + /// Creates an new instance. + /// + public NetworkProfileUpdateNetworkInterfacesItem() + { + + } + } + public partial interface INetworkProfileUpdateNetworkInterfacesItem : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// ID - Resource ID of the network interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ID - Resource ID of the network interface", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + + } + internal partial interface INetworkProfileUpdateNetworkInterfacesItemInternal + + { + /// ID - Resource ID of the network interface + string Id { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdateNetworkInterfacesItem.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdateNetworkInterfacesItem.json.cs new file mode 100644 index 000000000000..c29870a8aefe --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/NetworkProfileUpdateNetworkInterfacesItem.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class NetworkProfileUpdateNetworkInterfacesItem + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new NetworkProfileUpdateNetworkInterfacesItem(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal NetworkProfileUpdateNetworkInterfacesItem(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdate.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdate.PowerShell.cs new file mode 100644 index 000000000000..f42351d7fbce --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdate.PowerShell.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// OsProfile - describes the update configuration of the operating system + [System.ComponentModel.TypeConverter(typeof(OSProfileUpdateTypeConverter))] + public partial class OSProfileUpdate + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OSProfileUpdate(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OSProfileUpdate(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OSProfileUpdate(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("LinuxConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).LinuxConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration) content.GetValueForProperty("LinuxConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).LinuxConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateLinuxConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("WindowsConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).WindowsConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration) content.GetValueForProperty("WindowsConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).WindowsConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateWindowsConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("ComputerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).ComputerName = (string) content.GetValueForProperty("ComputerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).ComputerName, global::System.Convert.ToString); + } + if (content.Contains("LinuxConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).LinuxConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).LinuxConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LinuxConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).LinuxConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).LinuxConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).WindowConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).WindowConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).WindowConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).WindowConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OSProfileUpdate(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("LinuxConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).LinuxConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration) content.GetValueForProperty("LinuxConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).LinuxConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateLinuxConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("WindowsConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).WindowsConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration) content.GetValueForProperty("WindowsConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).WindowsConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateWindowsConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("ComputerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).ComputerName = (string) content.GetValueForProperty("ComputerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).ComputerName, global::System.Convert.ToString); + } + if (content.Contains("LinuxConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).LinuxConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).LinuxConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LinuxConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).LinuxConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).LinuxConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).WindowConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).WindowConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).WindowConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)this).WindowConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// OsProfile - describes the update configuration of the operating system + [System.ComponentModel.TypeConverter(typeof(OSProfileUpdateTypeConverter))] + public partial interface IOSProfileUpdate + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdate.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdate.TypeConverter.cs new file mode 100644 index 000000000000..c3f274d5d5f0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdate.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OSProfileUpdateTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdate ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdate).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OSProfileUpdate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OSProfileUpdate.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OSProfileUpdate.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdate.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdate.cs new file mode 100644 index 000000000000..730380febb6c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdate.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// OsProfile - describes the update configuration of the operating system + public partial class OSProfileUpdate : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdate, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal + { + + /// Backing field for property. + private string _computerName; + + /// ComputerName - name of the computer + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ComputerName { get => this._computerName; set => this._computerName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration _linuxConfiguration; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration LinuxConfiguration { get => (this._linuxConfiguration = this._linuxConfiguration ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateLinuxConfiguration()); set => this._linuxConfiguration = value; } + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? LinuxConfigurationProvisionVMAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfigurationInternal)LinuxConfiguration).ProvisionVMAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfigurationInternal)LinuxConfiguration).ProvisionVMAgent = value ?? default(bool); } + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? LinuxConfigurationProvisionVMConfigAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfigurationInternal)LinuxConfiguration).ProvisionVMConfigAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfigurationInternal)LinuxConfiguration).ProvisionVMConfigAgent = value ?? default(bool); } + + /// Internal Acessors for LinuxConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal.LinuxConfiguration { get => (this._linuxConfiguration = this._linuxConfiguration ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateLinuxConfiguration()); set { {_linuxConfiguration = value;} } } + + /// Internal Acessors for WindowsConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal.WindowsConfiguration { get => (this._windowsConfiguration = this._windowsConfiguration ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateWindowsConfiguration()); set { {_windowsConfiguration = value;} } } + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? WindowConfigurationProvisionVMAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfigurationInternal)WindowsConfiguration).ProvisionVMAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfigurationInternal)WindowsConfiguration).ProvisionVMAgent = value ?? default(bool); } + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? WindowConfigurationProvisionVMConfigAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfigurationInternal)WindowsConfiguration).ProvisionVMConfigAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfigurationInternal)WindowsConfiguration).ProvisionVMConfigAgent = value ?? default(bool); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration _windowsConfiguration; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration WindowsConfiguration { get => (this._windowsConfiguration = this._windowsConfiguration ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateWindowsConfiguration()); set => this._windowsConfiguration = value; } + + /// Creates an new instance. + public OSProfileUpdate() + { + + } + } + /// OsProfile - describes the update configuration of the operating system + public partial interface IOSProfileUpdate : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// ComputerName - name of the computer + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ComputerName - name of the computer", + SerializedName = @"computerName", + PossibleTypes = new [] { typeof(string) })] + string ComputerName { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? LinuxConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? LinuxConfigurationProvisionVMConfigAgent { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? WindowConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? WindowConfigurationProvisionVMConfigAgent { get; set; } + + } + /// OsProfile - describes the update configuration of the operating system + internal partial interface IOSProfileUpdateInternal + + { + /// ComputerName - name of the computer + string ComputerName { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration LinuxConfiguration { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + bool? LinuxConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + bool? LinuxConfigurationProvisionVMConfigAgent { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + bool? WindowConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + bool? WindowConfigurationProvisionVMConfigAgent { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration WindowsConfiguration { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdate.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdate.json.cs new file mode 100644 index 000000000000..9d4b722d55a8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdate.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// OsProfile - describes the update configuration of the operating system + public partial class OSProfileUpdate + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdate. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdate. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new OSProfileUpdate(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal OSProfileUpdate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_linuxConfiguration = If( json?.PropertyT("linuxConfiguration"), out var __jsonLinuxConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateLinuxConfiguration.FromJson(__jsonLinuxConfiguration) : LinuxConfiguration;} + {_windowsConfiguration = If( json?.PropertyT("windowsConfiguration"), out var __jsonWindowsConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateWindowsConfiguration.FromJson(__jsonWindowsConfiguration) : WindowsConfiguration;} + {_computerName = If( json?.PropertyT("computerName"), out var __jsonComputerName) ? (string)__jsonComputerName : (string)ComputerName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._linuxConfiguration ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._linuxConfiguration.ToJson(null,serializationMode) : null, "linuxConfiguration" ,container.Add ); + AddIf( null != this._windowsConfiguration ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._windowsConfiguration.ToJson(null,serializationMode) : null, "windowsConfiguration" ,container.Add ); + AddIf( null != (((object)this._computerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._computerName.ToString()) : null, "computerName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateLinuxConfiguration.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateLinuxConfiguration.PowerShell.cs new file mode 100644 index 000000000000..f3538b192231 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateLinuxConfiguration.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(OSProfileUpdateLinuxConfigurationTypeConverter))] + public partial class OSProfileUpdateLinuxConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OSProfileUpdateLinuxConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OSProfileUpdateLinuxConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OSProfileUpdateLinuxConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfigurationInternal)this).ProvisionVMAgent = (bool?) content.GetValueForProperty("ProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfigurationInternal)this).ProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfigurationInternal)this).ProvisionVMConfigAgent = (bool?) content.GetValueForProperty("ProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfigurationInternal)this).ProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OSProfileUpdateLinuxConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfigurationInternal)this).ProvisionVMAgent = (bool?) content.GetValueForProperty("ProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfigurationInternal)this).ProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfigurationInternal)this).ProvisionVMConfigAgent = (bool?) content.GetValueForProperty("ProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfigurationInternal)this).ProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(OSProfileUpdateLinuxConfigurationTypeConverter))] + public partial interface IOSProfileUpdateLinuxConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateLinuxConfiguration.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateLinuxConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..70b5c81af6f3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateLinuxConfiguration.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OSProfileUpdateLinuxConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OSProfileUpdateLinuxConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OSProfileUpdateLinuxConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OSProfileUpdateLinuxConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateLinuxConfiguration.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateLinuxConfiguration.cs new file mode 100644 index 000000000000..e1bedee2c87c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateLinuxConfiguration.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class OSProfileUpdateLinuxConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfigurationInternal + { + + /// Backing field for property. + private bool? _provisionVMAgent; + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public bool? ProvisionVMAgent { get => this._provisionVMAgent; set => this._provisionVMAgent = value; } + + /// Backing field for property. + private bool? _provisionVMConfigAgent; + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public bool? ProvisionVMConfigAgent { get => this._provisionVMConfigAgent; set => this._provisionVMConfigAgent = value; } + + /// Creates an new instance. + public OSProfileUpdateLinuxConfiguration() + { + + } + } + public partial interface IOSProfileUpdateLinuxConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? ProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? ProvisionVMConfigAgent { get; set; } + + } + internal partial interface IOSProfileUpdateLinuxConfigurationInternal + + { + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + bool? ProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + bool? ProvisionVMConfigAgent { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateLinuxConfiguration.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateLinuxConfiguration.json.cs new file mode 100644 index 000000000000..7f77495cf3bb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateLinuxConfiguration.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class OSProfileUpdateLinuxConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new OSProfileUpdateLinuxConfiguration(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal OSProfileUpdateLinuxConfiguration(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provisionVMAgent = If( json?.PropertyT("provisionVMAgent"), out var __jsonProvisionVMAgent) ? (bool?)__jsonProvisionVMAgent : ProvisionVMAgent;} + {_provisionVMConfigAgent = If( json?.PropertyT("provisionVMConfigAgent"), out var __jsonProvisionVMConfigAgent) ? (bool?)__jsonProvisionVMConfigAgent : ProvisionVMConfigAgent;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._provisionVMAgent ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonBoolean((bool)this._provisionVMAgent) : null, "provisionVMAgent" ,container.Add ); + AddIf( null != this._provisionVMConfigAgent ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonBoolean((bool)this._provisionVMConfigAgent) : null, "provisionVMConfigAgent" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateWindowsConfiguration.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateWindowsConfiguration.PowerShell.cs new file mode 100644 index 000000000000..487f6b1d51e4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateWindowsConfiguration.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(OSProfileUpdateWindowsConfigurationTypeConverter))] + public partial class OSProfileUpdateWindowsConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OSProfileUpdateWindowsConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OSProfileUpdateWindowsConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OSProfileUpdateWindowsConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfigurationInternal)this).ProvisionVMAgent = (bool?) content.GetValueForProperty("ProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfigurationInternal)this).ProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfigurationInternal)this).ProvisionVMConfigAgent = (bool?) content.GetValueForProperty("ProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfigurationInternal)this).ProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OSProfileUpdateWindowsConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfigurationInternal)this).ProvisionVMAgent = (bool?) content.GetValueForProperty("ProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfigurationInternal)this).ProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfigurationInternal)this).ProvisionVMConfigAgent = (bool?) content.GetValueForProperty("ProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfigurationInternal)this).ProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(OSProfileUpdateWindowsConfigurationTypeConverter))] + public partial interface IOSProfileUpdateWindowsConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateWindowsConfiguration.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateWindowsConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..f15c526d4f38 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateWindowsConfiguration.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OSProfileUpdateWindowsConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OSProfileUpdateWindowsConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OSProfileUpdateWindowsConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OSProfileUpdateWindowsConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateWindowsConfiguration.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateWindowsConfiguration.cs new file mode 100644 index 000000000000..4d0f1ecb5a4b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateWindowsConfiguration.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class OSProfileUpdateWindowsConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfigurationInternal + { + + /// Backing field for property. + private bool? _provisionVMAgent; + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public bool? ProvisionVMAgent { get => this._provisionVMAgent; set => this._provisionVMAgent = value; } + + /// Backing field for property. + private bool? _provisionVMConfigAgent; + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public bool? ProvisionVMConfigAgent { get => this._provisionVMConfigAgent; set => this._provisionVMConfigAgent = value; } + + /// Creates an new instance. + public OSProfileUpdateWindowsConfiguration() + { + + } + } + public partial interface IOSProfileUpdateWindowsConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? ProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? ProvisionVMConfigAgent { get; set; } + + } + internal partial interface IOSProfileUpdateWindowsConfigurationInternal + + { + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + bool? ProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + bool? ProvisionVMConfigAgent { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateWindowsConfiguration.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateWindowsConfiguration.json.cs new file mode 100644 index 000000000000..8d4f4154a9fb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/OSProfileUpdateWindowsConfiguration.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class OSProfileUpdateWindowsConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new OSProfileUpdateWindowsConfiguration(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal OSProfileUpdateWindowsConfiguration(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provisionVMAgent = If( json?.PropertyT("provisionVMAgent"), out var __jsonProvisionVMAgent) ? (bool?)__jsonProvisionVMAgent : ProvisionVMAgent;} + {_provisionVMConfigAgent = If( json?.PropertyT("provisionVMConfigAgent"), out var __jsonProvisionVMConfigAgent) ? (bool?)__jsonProvisionVMConfigAgent : ProvisionVMConfigAgent;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._provisionVMAgent ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonBoolean((bool)this._provisionVMAgent) : null, "provisionVMAgent" ,container.Add ); + AddIf( null != this._provisionVMConfigAgent ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonBoolean((bool)this._provisionVMConfigAgent) : null, "provisionVMConfigAgent" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Route.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Route.PowerShell.cs new file mode 100644 index 000000000000..26a2b99786b8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Route.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Route - Route resource. + [System.ComponentModel.TypeConverter(typeof(RouteTypeConverter))] + public partial class Route + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Route(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Route(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Route(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormat) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RoutePropertiesFormatTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("AddressPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteInternal)this).AddressPrefix = (string) content.GetValueForProperty("AddressPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteInternal)this).AddressPrefix, global::System.Convert.ToString); + } + if (content.Contains("NextHopIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteInternal)this).NextHopIPAddress = (string) content.GetValueForProperty("NextHopIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteInternal)this).NextHopIPAddress, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Route(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormat) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RoutePropertiesFormatTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("AddressPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteInternal)this).AddressPrefix = (string) content.GetValueForProperty("AddressPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteInternal)this).AddressPrefix, global::System.Convert.ToString); + } + if (content.Contains("NextHopIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteInternal)this).NextHopIPAddress = (string) content.GetValueForProperty("NextHopIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteInternal)this).NextHopIPAddress, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Route - Route resource. + [System.ComponentModel.TypeConverter(typeof(RouteTypeConverter))] + public partial interface IRoute + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Route.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Route.TypeConverter.cs new file mode 100644 index 000000000000..267e585cf58e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Route.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RouteTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Route.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Route.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Route.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Route.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Route.cs new file mode 100644 index 000000000000..51dd93368d00 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Route.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Route - Route resource. + public partial class Route : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteInternal + { + + /// The destination CIDR to which the route applies. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AddressPrefix { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormatInternal)Property).AddressPrefix; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormatInternal)Property).AddressPrefix = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormat Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RoutePropertiesFormat()); set { {_property = value;} } } + + /// Backing field for property. + private string _name; + + /// Name - name of the subnet + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string NextHopIPAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormatInternal)Property).NextHopIPAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormatInternal)Property).NextHopIPAddress = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormat _property; + + /// Properties of the route. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormat Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RoutePropertiesFormat()); set => this._property = value; } + + /// Creates an new instance. + public Route() + { + + } + } + /// Route - Route resource. + public partial interface IRoute : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The destination CIDR to which the route applies. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The destination CIDR to which the route applies.", + SerializedName = @"addressPrefix", + PossibleTypes = new [] { typeof(string) })] + string AddressPrefix { get; set; } + /// Name - name of the subnet + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Name - name of the subnet", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// + /// The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance.", + SerializedName = @"nextHopIpAddress", + PossibleTypes = new [] { typeof(string) })] + string NextHopIPAddress { get; set; } + + } + /// Route - Route resource. + internal partial interface IRouteInternal + + { + /// The destination CIDR to which the route applies. + string AddressPrefix { get; set; } + /// Name - name of the subnet + string Name { get; set; } + /// + /// The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance. + /// + string NextHopIPAddress { get; set; } + /// Properties of the route. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormat Property { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Route.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Route.json.cs new file mode 100644 index 000000000000..c6b87cab0efb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Route.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Route - Route resource. + public partial class Route + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new Route(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal Route(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RoutePropertiesFormat.FromJson(__jsonProperties) : Property;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RoutePropertiesFormat.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RoutePropertiesFormat.PowerShell.cs new file mode 100644 index 000000000000..ea889f3fa17a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RoutePropertiesFormat.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// RoutePropertiesFormat - Route resource. + [System.ComponentModel.TypeConverter(typeof(RoutePropertiesFormatTypeConverter))] + public partial class RoutePropertiesFormat + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormat DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RoutePropertiesFormat(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormat DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RoutePropertiesFormat(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormat FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RoutePropertiesFormat(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AddressPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormatInternal)this).AddressPrefix = (string) content.GetValueForProperty("AddressPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormatInternal)this).AddressPrefix, global::System.Convert.ToString); + } + if (content.Contains("NextHopIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormatInternal)this).NextHopIPAddress = (string) content.GetValueForProperty("NextHopIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormatInternal)this).NextHopIPAddress, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RoutePropertiesFormat(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AddressPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormatInternal)this).AddressPrefix = (string) content.GetValueForProperty("AddressPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormatInternal)this).AddressPrefix, global::System.Convert.ToString); + } + if (content.Contains("NextHopIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormatInternal)this).NextHopIPAddress = (string) content.GetValueForProperty("NextHopIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormatInternal)this).NextHopIPAddress, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// RoutePropertiesFormat - Route resource. + [System.ComponentModel.TypeConverter(typeof(RoutePropertiesFormatTypeConverter))] + public partial interface IRoutePropertiesFormat + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RoutePropertiesFormat.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RoutePropertiesFormat.TypeConverter.cs new file mode 100644 index 000000000000..9e8997be97f6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RoutePropertiesFormat.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RoutePropertiesFormatTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormat ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormat).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RoutePropertiesFormat.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RoutePropertiesFormat.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RoutePropertiesFormat.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RoutePropertiesFormat.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RoutePropertiesFormat.cs new file mode 100644 index 000000000000..acfc225e3d9f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RoutePropertiesFormat.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// RoutePropertiesFormat - Route resource. + public partial class RoutePropertiesFormat : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormat, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormatInternal + { + + /// Backing field for property. + private string _addressPrefix; + + /// The destination CIDR to which the route applies. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string AddressPrefix { get => this._addressPrefix; set => this._addressPrefix = value; } + + /// Backing field for property. + private string _nextHopIPAddress; + + /// + /// The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string NextHopIPAddress { get => this._nextHopIPAddress; set => this._nextHopIPAddress = value; } + + /// Creates an new instance. + public RoutePropertiesFormat() + { + + } + } + /// RoutePropertiesFormat - Route resource. + public partial interface IRoutePropertiesFormat : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The destination CIDR to which the route applies. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The destination CIDR to which the route applies.", + SerializedName = @"addressPrefix", + PossibleTypes = new [] { typeof(string) })] + string AddressPrefix { get; set; } + /// + /// The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance.", + SerializedName = @"nextHopIpAddress", + PossibleTypes = new [] { typeof(string) })] + string NextHopIPAddress { get; set; } + + } + /// RoutePropertiesFormat - Route resource. + internal partial interface IRoutePropertiesFormatInternal + + { + /// The destination CIDR to which the route applies. + string AddressPrefix { get; set; } + /// + /// The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance. + /// + string NextHopIPAddress { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RoutePropertiesFormat.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RoutePropertiesFormat.json.cs new file mode 100644 index 000000000000..ba1e447bb208 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RoutePropertiesFormat.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// RoutePropertiesFormat - Route resource. + public partial class RoutePropertiesFormat + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormat. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormat. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoutePropertiesFormat FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new RoutePropertiesFormat(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal RoutePropertiesFormat(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_addressPrefix = If( json?.PropertyT("addressPrefix"), out var __jsonAddressPrefix) ? (string)__jsonAddressPrefix : (string)AddressPrefix;} + {_nextHopIPAddress = If( json?.PropertyT("nextHopIpAddress"), out var __jsonNextHopIPAddress) ? (string)__jsonNextHopIPAddress : (string)NextHopIPAddress;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._addressPrefix)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._addressPrefix.ToString()) : null, "addressPrefix" ,container.Add ); + AddIf( null != (((object)this._nextHopIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._nextHopIPAddress.ToString()) : null, "nextHopIpAddress" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTable.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTable.PowerShell.cs new file mode 100644 index 000000000000..1d0e8e5da4de --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTable.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Route table resource. + [System.ComponentModel.TypeConverter(typeof(RouteTableTypeConverter))] + public partial class RouteTable + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTable DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RouteTable(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTable DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RouteTable(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTable FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RouteTable(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTablePropertiesFormatTypeConverter.ConvertFrom); + } + if (content.Contains("Etag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)this).Etag = (string) content.GetValueForProperty("Etag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)this).Etag, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Route")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)this).Route = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute[]) content.GetValueForProperty("Route",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)this).Route, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RouteTable(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTablePropertiesFormatTypeConverter.ConvertFrom); + } + if (content.Contains("Etag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)this).Etag = (string) content.GetValueForProperty("Etag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)this).Etag, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Route")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)this).Route = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute[]) content.GetValueForProperty("Route",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)this).Route, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Route table resource. + [System.ComponentModel.TypeConverter(typeof(RouteTableTypeConverter))] + public partial interface IRouteTable + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTable.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTable.TypeConverter.cs new file mode 100644 index 000000000000..b461037b8dc2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTable.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RouteTableTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTable ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTable).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RouteTable.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RouteTable.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RouteTable.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTable.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTable.cs new file mode 100644 index 000000000000..d85715a7092a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTable.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Route table resource. + public partial class RouteTable : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal + { + + /// Backing field for property. + private string _etag; + + /// A unique read-only string that changes whenever the resource is updated. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Etag { get => this._etag; } + + /// Internal Acessors for Etag + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal.Etag { get => this._etag; set { {_etag = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTablePropertiesFormat()); set { {_property = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// Resource name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat _property; + + /// Properties of the route table. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTablePropertiesFormat()); set => this._property = value; } + + /// Collection of routes contained within a route table. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute[] Route { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormatInternal)Property).Route; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormatInternal)Property).Route = value ?? null /* arrayOf */; } + + /// Backing field for property. + private string _type; + + /// Resource type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public RouteTable() + { + + } + } + /// Route table resource. + public partial interface IRouteTable : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// A unique read-only string that changes whenever the resource is updated. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A unique read-only string that changes whenever the resource is updated.", + SerializedName = @"etag", + PossibleTypes = new [] { typeof(string) })] + string Etag { get; } + /// Resource name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Resource name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// Collection of routes contained within a route table. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Collection of routes contained within a route table.", + SerializedName = @"routes", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute[] Route { get; set; } + /// Resource type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Resource type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// Route table resource. + internal partial interface IRouteTableInternal + + { + /// A unique read-only string that changes whenever the resource is updated. + string Etag { get; set; } + /// Resource name. + string Name { get; set; } + /// Properties of the route table. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat Property { get; set; } + /// Collection of routes contained within a route table. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute[] Route { get; set; } + /// Resource type. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTable.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTable.json.cs new file mode 100644 index 000000000000..9953572ee27f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTable.json.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Route table resource. + public partial class RouteTable + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTable. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTable. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTable FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new RouteTable(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal RouteTable(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTablePropertiesFormat.FromJson(__jsonProperties) : Property;} + {_etag = If( json?.PropertyT("etag"), out var __jsonEtag) ? (string)__jsonEtag : (string)Etag;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._etag)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._etag.ToString()) : null, "etag" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTablePropertiesFormat.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTablePropertiesFormat.PowerShell.cs new file mode 100644 index 000000000000..1d44931e96e0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTablePropertiesFormat.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// RouteTablePropertiesFormat - Route Table resource. + [System.ComponentModel.TypeConverter(typeof(RouteTablePropertiesFormatTypeConverter))] + public partial class RouteTablePropertiesFormat + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RouteTablePropertiesFormat(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RouteTablePropertiesFormat(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RouteTablePropertiesFormat(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Route")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormatInternal)this).Route = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute[]) content.GetValueForProperty("Route",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormatInternal)this).Route, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RouteTablePropertiesFormat(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Route")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormatInternal)this).Route = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute[]) content.GetValueForProperty("Route",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormatInternal)this).Route, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// RouteTablePropertiesFormat - Route Table resource. + [System.ComponentModel.TypeConverter(typeof(RouteTablePropertiesFormatTypeConverter))] + public partial interface IRouteTablePropertiesFormat + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTablePropertiesFormat.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTablePropertiesFormat.TypeConverter.cs new file mode 100644 index 000000000000..cb604e9e9985 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTablePropertiesFormat.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RouteTablePropertiesFormatTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RouteTablePropertiesFormat.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RouteTablePropertiesFormat.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RouteTablePropertiesFormat.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTablePropertiesFormat.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTablePropertiesFormat.cs new file mode 100644 index 000000000000..ed88ca9bfb0b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTablePropertiesFormat.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// RouteTablePropertiesFormat - Route Table resource. + public partial class RouteTablePropertiesFormat : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormatInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute[] _route; + + /// Collection of routes contained within a route table. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute[] Route { get => this._route; set => this._route = value; } + + /// Creates an new instance. + public RouteTablePropertiesFormat() + { + + } + } + /// RouteTablePropertiesFormat - Route Table resource. + public partial interface IRouteTablePropertiesFormat : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Collection of routes contained within a route table. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Collection of routes contained within a route table.", + SerializedName = @"routes", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute[] Route { get; set; } + + } + /// RouteTablePropertiesFormat - Route Table resource. + internal partial interface IRouteTablePropertiesFormatInternal + + { + /// Collection of routes contained within a route table. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute[] Route { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTablePropertiesFormat.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTablePropertiesFormat.json.cs new file mode 100644 index 000000000000..a21c6f7d9b4a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/RouteTablePropertiesFormat.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// RouteTablePropertiesFormat - Route Table resource. + public partial class RouteTablePropertiesFormat + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new RouteTablePropertiesFormat(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal RouteTablePropertiesFormat(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_route = If( json?.PropertyT("routes"), out var __jsonRoutes) ? If( __jsonRoutes as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.Route.FromJson(__u) )) ))() : null : Route;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._route) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._route ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("routes",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshConfiguration.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshConfiguration.PowerShell.cs new file mode 100644 index 000000000000..2e3d316ab380 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshConfiguration.PowerShell.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// SSH configuration for Linux based VMs running on Azure + [System.ComponentModel.TypeConverter(typeof(SshConfigurationTypeConverter))] + public partial class SshConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SshConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SshConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SshConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfigurationInternal)this).PublicKey = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfigurationInternal)this).PublicKey, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshPublicKeyTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SshConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfigurationInternal)this).PublicKey = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfigurationInternal)this).PublicKey, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshPublicKeyTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// SSH configuration for Linux based VMs running on Azure + [System.ComponentModel.TypeConverter(typeof(SshConfigurationTypeConverter))] + public partial interface ISshConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshConfiguration.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..713b70ceca95 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshConfiguration.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SshConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SshConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SshConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SshConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshConfiguration.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshConfiguration.cs new file mode 100644 index 000000000000..fc0a4755151c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshConfiguration.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// SSH configuration for Linux based VMs running on Azure + public partial class SshConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfigurationInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] _publicKey; + + /// The list of SSH public keys used to authenticate with linux based VMs. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] PublicKey { get => this._publicKey; set => this._publicKey = value; } + + /// Creates an new instance. + public SshConfiguration() + { + + } + } + /// SSH configuration for Linux based VMs running on Azure + public partial interface ISshConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The list of SSH public keys used to authenticate with linux based VMs. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of SSH public keys used to authenticate with linux based VMs.", + SerializedName = @"publicKeys", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] PublicKey { get; set; } + + } + /// SSH configuration for Linux based VMs running on Azure + internal partial interface ISshConfigurationInternal + + { + /// The list of SSH public keys used to authenticate with linux based VMs. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] PublicKey { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshConfiguration.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshConfiguration.json.cs new file mode 100644 index 000000000000..12cc247c5df6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshConfiguration.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// SSH configuration for Linux based VMs running on Azure + public partial class SshConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new SshConfiguration(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal SshConfiguration(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_publicKey = If( json?.PropertyT("publicKeys"), out var __jsonPublicKeys) ? If( __jsonPublicKeys as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshPublicKey.FromJson(__u) )) ))() : null : PublicKey;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._publicKey) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._publicKey ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("publicKeys",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshPublicKey.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshPublicKey.PowerShell.cs new file mode 100644 index 000000000000..31005e040c04 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshPublicKey.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// Contains information about SSH certificate public key and the path on the Linux VM where the public key is placed. + /// + [System.ComponentModel.TypeConverter(typeof(SshPublicKeyTypeConverter))] + public partial class SshPublicKey + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SshPublicKey(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SshPublicKey(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SshPublicKey(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Path")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKeyInternal)this).Path = (string) content.GetValueForProperty("Path",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKeyInternal)this).Path, global::System.Convert.ToString); + } + if (content.Contains("KeyData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKeyInternal)this).KeyData = (string) content.GetValueForProperty("KeyData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKeyInternal)this).KeyData, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SshPublicKey(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Path")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKeyInternal)this).Path = (string) content.GetValueForProperty("Path",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKeyInternal)this).Path, global::System.Convert.ToString); + } + if (content.Contains("KeyData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKeyInternal)this).KeyData = (string) content.GetValueForProperty("KeyData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKeyInternal)this).KeyData, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Contains information about SSH certificate public key and the path on the Linux VM where the public key is placed. + [System.ComponentModel.TypeConverter(typeof(SshPublicKeyTypeConverter))] + public partial interface ISshPublicKey + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshPublicKey.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshPublicKey.TypeConverter.cs new file mode 100644 index 000000000000..fb113813b604 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshPublicKey.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SshPublicKeyTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SshPublicKey.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SshPublicKey.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SshPublicKey.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshPublicKey.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshPublicKey.cs new file mode 100644 index 000000000000..f980f72c820a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshPublicKey.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// Contains information about SSH certificate public key and the path on the Linux VM where the public key is placed. + /// + public partial class SshPublicKey : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKeyInternal + { + + /// Backing field for property. + private string _keyData; + + /// + /// SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in + /// ssh-rsa format.

For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + ///
+ [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string KeyData { get => this._keyData; set => this._keyData = value; } + + /// Backing field for property. + private string _path; + + /// + /// Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key + /// is appended to the file. Example: /home/user/.ssh/authorized_keys + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Path { get => this._path; set => this._path = value; } + + /// Creates an new instance. + public SshPublicKey() + { + + } + } + /// Contains information about SSH certificate public key and the path on the Linux VM where the public key is placed. + public partial interface ISshPublicKey : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// + /// SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in + /// ssh-rsa format.

For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + ///
+ [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format.

For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed).", + SerializedName = @"keyData", + PossibleTypes = new [] { typeof(string) })] + string KeyData { get; set; } + /// + /// Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key + /// is appended to the file. Example: /home/user/.ssh/authorized_keys + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file. Example: /home/user/.ssh/authorized_keys", + SerializedName = @"path", + PossibleTypes = new [] { typeof(string) })] + string Path { get; set; } + + } + /// Contains information about SSH certificate public key and the path on the Linux VM where the public key is placed. + internal partial interface ISshPublicKeyInternal + + { + /// + /// SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in + /// ssh-rsa format.

For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + ///
+ string KeyData { get; set; } + /// + /// Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key + /// is appended to the file. Example: /home/user/.ssh/authorized_keys + /// + string Path { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshPublicKey.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshPublicKey.json.cs new file mode 100644 index 000000000000..d163f3c1c524 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SshPublicKey.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// Contains information about SSH certificate public key and the path on the Linux VM where the public key is placed. + /// + public partial class SshPublicKey + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new SshPublicKey(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal SshPublicKey(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_path = If( json?.PropertyT("path"), out var __jsonPath) ? (string)__jsonPath : (string)Path;} + {_keyData = If( json?.PropertyT("keyData"), out var __jsonKeyData) ? (string)__jsonKeyData : (string)KeyData;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._path)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._path.ToString()) : null, "path" ,container.Add ); + AddIf( null != (((object)this._keyData)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._keyData.ToString()) : null, "keyData" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerProperties.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerProperties.PowerShell.cs new file mode 100644 index 000000000000..db628c50de69 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerProperties.PowerShell.cs @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Properties under the storage container resource + [System.ComponentModel.TypeConverter(typeof(StorageContainerPropertiesTypeConverter))] + public partial class StorageContainerProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StorageContainerProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StorageContainerProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StorageContainerProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerStatusTypeConverter.ConvertFrom); + } + if (content.Contains("Path")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).Path = (string) content.GetValueForProperty("Path",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).Path, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusAvailableSizeMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).StatusAvailableSizeMb = (long?) content.GetValueForProperty("StatusAvailableSizeMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).StatusAvailableSizeMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusContainerSizeMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).StatusContainerSizeMb = (long?) content.GetValueForProperty("StatusContainerSizeMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).StatusContainerSizeMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StorageContainerProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerStatusTypeConverter.ConvertFrom); + } + if (content.Contains("Path")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).Path = (string) content.GetValueForProperty("Path",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).Path, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusAvailableSizeMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).StatusAvailableSizeMb = (long?) content.GetValueForProperty("StatusAvailableSizeMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).StatusAvailableSizeMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusContainerSizeMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).StatusContainerSizeMb = (long?) content.GetValueForProperty("StatusContainerSizeMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).StatusContainerSizeMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Properties under the storage container resource + [System.ComponentModel.TypeConverter(typeof(StorageContainerPropertiesTypeConverter))] + public partial interface IStorageContainerProperties + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerProperties.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerProperties.TypeConverter.cs new file mode 100644 index 000000000000..c169038c7060 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StorageContainerPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StorageContainerProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StorageContainerProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StorageContainerProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerProperties.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerProperties.cs new file mode 100644 index 000000000000..a16ccb5cb432 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerProperties.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Properties under the storage container resource + public partial class StorageContainerProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerProperties, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal + { + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal.Status { get => (this._status = this._status ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerStatus()); set { {_status = value;} } } + + /// Internal Acessors for StatusProvisioningStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal.StatusProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)Status).ProvisioningStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)Status).ProvisioningStatus = value; } + + /// Backing field for property. + private string _path; + + /// Path of the storage container on the disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Path { get => this._path; set => this._path = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? _provisioningState; + + /// Provisioning state of the storage container. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get => this._provisioningState; } + + /// + /// The status of the operation performed on the storage container [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)Status).ProvisioningStatusStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)Status).ProvisioningStatusStatus = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status)""); } + + /// The ID of the operation performed on the storage container + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningStatusOperationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)Status).ProvisioningStatusOperationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)Status).ProvisioningStatusOperationId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatus _status; + + /// The observed state of storage containers + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatus Status { get => (this._status = this._status ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerStatus()); } + + /// Amount of space available on the disk in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? StatusAvailableSizeMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)Status).AvailableSizeMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)Status).AvailableSizeMb = value ?? default(long); } + + /// Total size of the disk in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? StatusContainerSizeMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)Status).ContainerSizeMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)Status).ContainerSizeMb = value ?? default(long); } + + /// StorageContainer provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)Status).ErrorCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)Status).ErrorCode = value ?? null; } + + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)Status).ErrorMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)Status).ErrorMessage = value ?? null; } + + /// Creates an new instance. + public StorageContainerProperties() + { + + } + } + /// Properties under the storage container resource + public partial interface IStorageContainerProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Path of the storage container on the disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of the storage container on the disk", + SerializedName = @"path", + PossibleTypes = new [] { typeof(string) })] + string Path { get; set; } + /// Provisioning state of the storage container. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Provisioning state of the storage container.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; } + /// + /// The status of the operation performed on the storage container [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the storage container [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the storage container + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the storage container", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusOperationId { get; set; } + /// Amount of space available on the disk in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Amount of space available on the disk in MB", + SerializedName = @"availableSizeMB", + PossibleTypes = new [] { typeof(long) })] + long? StatusAvailableSizeMb { get; set; } + /// Total size of the disk in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Total size of the disk in MB", + SerializedName = @"containerSizeMB", + PossibleTypes = new [] { typeof(long) })] + long? StatusContainerSizeMb { get; set; } + /// StorageContainer provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"StorageContainer provisioning error code", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorCode { get; set; } + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Descriptive error message", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorMessage { get; set; } + + } + /// Properties under the storage container resource + internal partial interface IStorageContainerPropertiesInternal + + { + /// Path of the storage container on the disk + string Path { get; set; } + /// Provisioning state of the storage container. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; set; } + /// + /// The status of the operation performed on the storage container [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the storage container + string ProvisioningStatusOperationId { get; set; } + /// The observed state of storage containers + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatus Status { get; set; } + /// Amount of space available on the disk in MB + long? StatusAvailableSizeMb { get; set; } + /// Total size of the disk in MB + long? StatusContainerSizeMb { get; set; } + /// StorageContainer provisioning error code + string StatusErrorCode { get; set; } + /// Descriptive error message + string StatusErrorMessage { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus StatusProvisioningStatus { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerProperties.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerProperties.json.cs new file mode 100644 index 000000000000..fb5cb8d58e89 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerProperties.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Properties under the storage container resource + public partial class StorageContainerProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new StorageContainerProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal StorageContainerProperties(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerStatus.FromJson(__jsonStatus) : Status;} + {_path = If( json?.PropertyT("path"), out var __jsonPath) ? (string)__jsonPath : (string)Path;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._status ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._status.ToJson(null,serializationMode) : null, "status" ,container.Add ); + } + AddIf( null != (((object)this._path)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._path.ToString()) : null, "path" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatus.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatus.PowerShell.cs new file mode 100644 index 000000000000..12bfacc55bf5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatus.PowerShell.cs @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The observed state of storage containers + [System.ComponentModel.TypeConverter(typeof(StorageContainerStatusTypeConverter))] + public partial class StorageContainerStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StorageContainerStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StorageContainerStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StorageContainerStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("AvailableSizeMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).AvailableSizeMb = (long?) content.GetValueForProperty("AvailableSizeMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).AvailableSizeMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ContainerSizeMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ContainerSizeMb = (long?) content.GetValueForProperty("ContainerSizeMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ContainerSizeMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ProvisioningStatusStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ProvisioningStatusStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatusStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ProvisioningStatusStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StorageContainerStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("AvailableSizeMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).AvailableSizeMb = (long?) content.GetValueForProperty("AvailableSizeMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).AvailableSizeMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ContainerSizeMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ContainerSizeMb = (long?) content.GetValueForProperty("ContainerSizeMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ContainerSizeMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ProvisioningStatusStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ProvisioningStatusStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatusStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ProvisioningStatusStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The observed state of storage containers + [System.ComponentModel.TypeConverter(typeof(StorageContainerStatusTypeConverter))] + public partial interface IStorageContainerStatus + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatus.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatus.TypeConverter.cs new file mode 100644 index 000000000000..e6669f9d1303 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatus.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StorageContainerStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StorageContainerStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StorageContainerStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StorageContainerStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatus.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatus.cs new file mode 100644 index 000000000000..3386a6208a35 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatus.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The observed state of storage containers + public partial class StorageContainerStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatus, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal + { + + /// Backing field for property. + private long? _availableSizeMb; + + /// Amount of space available on the disk in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public long? AvailableSizeMb { get => this._availableSizeMb; set => this._availableSizeMb = value; } + + /// Backing field for property. + private long? _containerSizeMb; + + /// Total size of the disk in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public long? ContainerSizeMb { get => this._containerSizeMb; set => this._containerSizeMb = value; } + + /// Backing field for property. + private string _errorCode; + + /// StorageContainer provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ErrorCode { get => this._errorCode; set => this._errorCode = value; } + + /// Backing field for property. + private string _errorMessage; + + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ErrorMessage { get => this._errorMessage; set => this._errorMessage = value; } + + /// Internal Acessors for ProvisioningStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusInternal.ProvisioningStatus { get => (this._provisioningStatus = this._provisioningStatus ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerStatusProvisioningStatus()); set { {_provisioningStatus = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus _provisioningStatus; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus ProvisioningStatus { get => (this._provisioningStatus = this._provisioningStatus ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerStatusProvisioningStatus()); set => this._provisioningStatus = value; } + + /// The ID of the operation performed on the storage container + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningStatusOperationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatusInternal)ProvisioningStatus).OperationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatusInternal)ProvisioningStatus).OperationId = value ?? null; } + + /// + /// The status of the operation performed on the storage container [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatusStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatusInternal)ProvisioningStatus).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatusInternal)ProvisioningStatus).Status = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status)""); } + + /// Creates an new instance. + public StorageContainerStatus() + { + + } + } + /// The observed state of storage containers + public partial interface IStorageContainerStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Amount of space available on the disk in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Amount of space available on the disk in MB", + SerializedName = @"availableSizeMB", + PossibleTypes = new [] { typeof(long) })] + long? AvailableSizeMb { get; set; } + /// Total size of the disk in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Total size of the disk in MB", + SerializedName = @"containerSizeMB", + PossibleTypes = new [] { typeof(long) })] + long? ContainerSizeMb { get; set; } + /// StorageContainer provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"StorageContainer provisioning error code", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string ErrorCode { get; set; } + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Descriptive error message", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; set; } + /// The ID of the operation performed on the storage container + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the storage container", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusOperationId { get; set; } + /// + /// The status of the operation performed on the storage container [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the storage container [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatusStatus { get; set; } + + } + /// The observed state of storage containers + internal partial interface IStorageContainerStatusInternal + + { + /// Amount of space available on the disk in MB + long? AvailableSizeMb { get; set; } + /// Total size of the disk in MB + long? ContainerSizeMb { get; set; } + /// StorageContainer provisioning error code + string ErrorCode { get; set; } + /// Descriptive error message + string ErrorMessage { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus ProvisioningStatus { get; set; } + /// The ID of the operation performed on the storage container + string ProvisioningStatusOperationId { get; set; } + /// + /// The status of the operation performed on the storage container [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatusStatus { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatus.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatus.json.cs new file mode 100644 index 000000000000..60c1e249ea9a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatus.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The observed state of storage containers + public partial class StorageContainerStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new StorageContainerStatus(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal StorageContainerStatus(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provisioningStatus = If( json?.PropertyT("provisioningStatus"), out var __jsonProvisioningStatus) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerStatusProvisioningStatus.FromJson(__jsonProvisioningStatus) : ProvisioningStatus;} + {_errorCode = If( json?.PropertyT("errorCode"), out var __jsonErrorCode) ? (string)__jsonErrorCode : (string)ErrorCode;} + {_errorMessage = If( json?.PropertyT("errorMessage"), out var __jsonErrorMessage) ? (string)__jsonErrorMessage : (string)ErrorMessage;} + {_availableSizeMb = If( json?.PropertyT("availableSizeMB"), out var __jsonAvailableSizeMb) ? (long?)__jsonAvailableSizeMb : AvailableSizeMb;} + {_containerSizeMb = If( json?.PropertyT("containerSizeMB"), out var __jsonContainerSizeMb) ? (long?)__jsonContainerSizeMb : ContainerSizeMb;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._provisioningStatus ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._provisioningStatus.ToJson(null,serializationMode) : null, "provisioningStatus" ,container.Add ); + AddIf( null != (((object)this._errorCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._errorCode.ToString()) : null, "errorCode" ,container.Add ); + AddIf( null != (((object)this._errorMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._errorMessage.ToString()) : null, "errorMessage" ,container.Add ); + AddIf( null != this._availableSizeMb ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNumber((long)this._availableSizeMb) : null, "availableSizeMB" ,container.Add ); + AddIf( null != this._containerSizeMb ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNumber((long)this._containerSizeMb) : null, "containerSizeMB" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatusProvisioningStatus.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatusProvisioningStatus.PowerShell.cs new file mode 100644 index 000000000000..b18ccd510ac3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatusProvisioningStatus.PowerShell.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(StorageContainerStatusProvisioningStatusTypeConverter))] + public partial class StorageContainerStatusProvisioningStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StorageContainerStatusProvisioningStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StorageContainerStatusProvisioningStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StorageContainerStatusProvisioningStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatusInternal)this).OperationId = (string) content.GetValueForProperty("OperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatusInternal)this).OperationId, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatusInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatusInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StorageContainerStatusProvisioningStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatusInternal)this).OperationId = (string) content.GetValueForProperty("OperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatusInternal)this).OperationId, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatusInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatusInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(StorageContainerStatusProvisioningStatusTypeConverter))] + public partial interface IStorageContainerStatusProvisioningStatus + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatusProvisioningStatus.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatusProvisioningStatus.TypeConverter.cs new file mode 100644 index 000000000000..c590f72b94df --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatusProvisioningStatus.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StorageContainerStatusProvisioningStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StorageContainerStatusProvisioningStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StorageContainerStatusProvisioningStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StorageContainerStatusProvisioningStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatusProvisioningStatus.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatusProvisioningStatus.cs new file mode 100644 index 000000000000..1a0db957132c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatusProvisioningStatus.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class StorageContainerStatusProvisioningStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatusInternal + { + + /// Backing field for property. + private string _operationId; + + /// The ID of the operation performed on the storage container + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string OperationId { get => this._operationId; set => this._operationId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? _status; + + /// + /// The status of the operation performed on the storage container [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? Status { get => this._status; set => this._status = value; } + + /// + /// Creates an new instance. + /// + public StorageContainerStatusProvisioningStatus() + { + + } + } + public partial interface IStorageContainerStatusProvisioningStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The ID of the operation performed on the storage container + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the storage container", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string OperationId { get; set; } + /// + /// The status of the operation performed on the storage container [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the storage container [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? Status { get; set; } + + } + internal partial interface IStorageContainerStatusProvisioningStatusInternal + + { + /// The ID of the operation performed on the storage container + string OperationId { get; set; } + /// + /// The status of the operation performed on the storage container [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? Status { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatusProvisioningStatus.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatusProvisioningStatus.json.cs new file mode 100644 index 000000000000..e96158458350 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainerStatusProvisioningStatus.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class StorageContainerStatusProvisioningStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new StorageContainerStatusProvisioningStatus(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal StorageContainerStatusProvisioningStatus(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_operationId = If( json?.PropertyT("operationId"), out var __jsonOperationId) ? (string)__jsonOperationId : (string)OperationId;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)Status;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._operationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._operationId.ToString()) : null, "operationId" ,container.Add ); + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainers.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainers.PowerShell.cs new file mode 100644 index 000000000000..36d0acca20a9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainers.PowerShell.cs @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The storage container resource definition. + [System.ComponentModel.TypeConverter(typeof(StorageContainersTypeConverter))] + public partial class StorageContainers + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StorageContainers(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StorageContainers(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StorageContainers(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation) content.GetValueForProperty("ExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ExtendedLocationName = (string) content.GetValueForProperty("ExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerStatusTypeConverter.ConvertFrom); + } + if (content.Contains("Path")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).Path = (string) content.GetValueForProperty("Path",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).Path, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("ExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ExtendedLocationType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes?) content.GetValueForProperty("ExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ExtendedLocationType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes.CreateFrom); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusAvailableSizeMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).StatusAvailableSizeMb = (long?) content.GetValueForProperty("StatusAvailableSizeMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).StatusAvailableSizeMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusContainerSizeMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).StatusContainerSizeMb = (long?) content.GetValueForProperty("StatusContainerSizeMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).StatusContainerSizeMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StorageContainers(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation) content.GetValueForProperty("ExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ExtendedLocationName = (string) content.GetValueForProperty("ExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerStatusTypeConverter.ConvertFrom); + } + if (content.Contains("Path")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).Path = (string) content.GetValueForProperty("Path",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).Path, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("ExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ExtendedLocationType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes?) content.GetValueForProperty("ExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ExtendedLocationType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes.CreateFrom); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusAvailableSizeMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).StatusAvailableSizeMb = (long?) content.GetValueForProperty("StatusAvailableSizeMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).StatusAvailableSizeMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StatusContainerSizeMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).StatusContainerSizeMb = (long?) content.GetValueForProperty("StatusContainerSizeMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).StatusContainerSizeMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The storage container resource definition. + [System.ComponentModel.TypeConverter(typeof(StorageContainersTypeConverter))] + public partial interface IStorageContainers + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainers.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainers.TypeConverter.cs new file mode 100644 index 000000000000..5e42413fd073 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainers.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StorageContainersTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StorageContainers.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StorageContainers.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StorageContainers.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainers.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainers.cs new file mode 100644 index 000000000000..98b074e1b2e2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainers.cs @@ -0,0 +1,306 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The storage container resource definition. + public partial class StorageContainers : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResource(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation _extendedLocation; + + /// The extendedLocation of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation ExtendedLocation { get => (this._extendedLocation = this._extendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation()); set => this._extendedLocation = value; } + + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ExtendedLocationName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Name = value ?? null; } + + /// The type of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? ExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Type = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes)""); } + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id; } + + /// The geo-location where the resource lives + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Location = value ; } + + /// Internal Acessors for ExtendedLocation + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal.ExtendedLocation { get => (this._extendedLocation = this._extendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation()); set { {_extendedLocation = value;} } } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal.Status { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)Property).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)Property).Status = value; } + + /// Internal Acessors for StatusProvisioningStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersInternal.StatusProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)Property).StatusProvisioningStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)Property).StatusProvisioningStatus = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name; } + + /// Path of the storage container on the disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string Path { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)Property).Path; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)Property).Path = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerProperties _property; + + /// Properties under the storage container resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerProperties()); set => this._property = value; } + + /// Provisioning state of the storage container. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)Property).ProvisioningState; } + + /// + /// The status of the operation performed on the storage container [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)Property).ProvisioningStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)Property).ProvisioningStatus = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status)""); } + + /// The ID of the operation performed on the storage container + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningStatusOperationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)Property).ProvisioningStatusOperationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)Property).ProvisioningStatusOperationId = value ?? null; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// Amount of space available on the disk in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? StatusAvailableSizeMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)Property).StatusAvailableSizeMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)Property).StatusAvailableSizeMb = value ?? default(long); } + + /// Total size of the disk in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? StatusContainerSizeMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)Property).StatusContainerSizeMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)Property).StatusContainerSizeMb = value ?? default(long); } + + /// StorageContainer provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)Property).StatusErrorCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)Property).StatusErrorCode = value ?? null; } + + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)Property).StatusErrorMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerPropertiesInternal)Property).StatusErrorMessage = value ?? null; } + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData; } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Tag = value ?? null /* model class */; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type; } + + /// Creates an new instance. + public StorageContainers() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__trackedResource), __trackedResource); + await eventListener.AssertObjectIsValid(nameof(__trackedResource), __trackedResource); + } + } + /// The storage container resource definition. + public partial interface IStorageContainers : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource + { + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string ExtendedLocationName { get; set; } + /// The type of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the extended location.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? ExtendedLocationType { get; set; } + /// Path of the storage container on the disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Path of the storage container on the disk", + SerializedName = @"path", + PossibleTypes = new [] { typeof(string) })] + string Path { get; set; } + /// Provisioning state of the storage container. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Provisioning state of the storage container.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; } + /// + /// The status of the operation performed on the storage container [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the storage container [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the storage container + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the storage container", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusOperationId { get; set; } + /// Amount of space available on the disk in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Amount of space available on the disk in MB", + SerializedName = @"availableSizeMB", + PossibleTypes = new [] { typeof(long) })] + long? StatusAvailableSizeMb { get; set; } + /// Total size of the disk in MB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Total size of the disk in MB", + SerializedName = @"containerSizeMB", + PossibleTypes = new [] { typeof(long) })] + long? StatusContainerSizeMb { get; set; } + /// StorageContainer provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"StorageContainer provisioning error code", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorCode { get; set; } + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Descriptive error message", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorMessage { get; set; } + + } + /// The storage container resource definition. + internal partial interface IStorageContainersInternal : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal + { + /// The extendedLocation of the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation ExtendedLocation { get; set; } + /// The name of the extended location. + string ExtendedLocationName { get; set; } + /// The type of the extended location. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? ExtendedLocationType { get; set; } + /// Path of the storage container on the disk + string Path { get; set; } + /// Properties under the storage container resource + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerProperties Property { get; set; } + /// Provisioning state of the storage container. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; set; } + /// + /// The status of the operation performed on the storage container [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the storage container + string ProvisioningStatusOperationId { get; set; } + /// The observed state of storage containers + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatus Status { get; set; } + /// Amount of space available on the disk in MB + long? StatusAvailableSizeMb { get; set; } + /// Total size of the disk in MB + long? StatusContainerSizeMb { get; set; } + /// StorageContainer provisioning error code + string StatusErrorCode { get; set; } + /// Descriptive error message + string StatusErrorMessage { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainerStatusProvisioningStatus StatusProvisioningStatus { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainers.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainers.json.cs new file mode 100644 index 000000000000..c5066bd37c15 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainers.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The storage container resource definition. + public partial class StorageContainers + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new StorageContainers(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal StorageContainers(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainerProperties.FromJson(__jsonProperties) : Property;} + {_extendedLocation = If( json?.PropertyT("extendedLocation"), out var __jsonExtendedLocation) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation.FromJson(__jsonExtendedLocation) : ExtendedLocation;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __trackedResource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != this._extendedLocation ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._extendedLocation.ToJson(null,serializationMode) : null, "extendedLocation" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersListResult.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersListResult.PowerShell.cs new file mode 100644 index 000000000000..be3dd22abdb0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersListResult.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(StorageContainersListResultTypeConverter))] + public partial class StorageContainersListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StorageContainersListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StorageContainersListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StorageContainersListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainersTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StorageContainersListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainersTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(StorageContainersListResultTypeConverter))] + public partial interface IStorageContainersListResult + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersListResult.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersListResult.TypeConverter.cs new file mode 100644 index 000000000000..0df633717886 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersListResult.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StorageContainersListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StorageContainersListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StorageContainersListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StorageContainersListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersListResult.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersListResult.cs new file mode 100644 index 000000000000..58db8a488866 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersListResult.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class StorageContainersListResult : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersListResult, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers[] _value; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public StorageContainersListResult() + { + + } + } + public partial interface IStorageContainersListResult : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers[] Value { get; set; } + + } + internal partial interface IStorageContainersListResultInternal + + { + string NextLink { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersListResult.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersListResult.json.cs new file mode 100644 index 000000000000..1837af397014 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersListResult.json.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class StorageContainersListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new StorageContainersListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal StorageContainersListResult(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainers.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequest.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequest.PowerShell.cs new file mode 100644 index 000000000000..216416daa4c1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequest.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The storage container resource patch definition. + [System.ComponentModel.TypeConverter(typeof(StorageContainersUpdateRequestTypeConverter))] + public partial class StorageContainersUpdateRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StorageContainersUpdateRequest(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StorageContainersUpdateRequest(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StorageContainersUpdateRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainersUpdateRequestTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StorageContainersUpdateRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainersUpdateRequestTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The storage container resource patch definition. + [System.ComponentModel.TypeConverter(typeof(StorageContainersUpdateRequestTypeConverter))] + public partial interface IStorageContainersUpdateRequest + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequest.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequest.TypeConverter.cs new file mode 100644 index 000000000000..f68e66b9b680 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequest.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StorageContainersUpdateRequestTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StorageContainersUpdateRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StorageContainersUpdateRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StorageContainersUpdateRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequest.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequest.cs new file mode 100644 index 000000000000..8679a463235d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequest.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The storage container resource patch definition. + public partial class StorageContainersUpdateRequest : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequest, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags _tag; + + /// Resource tags + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainersUpdateRequestTags()); set => this._tag = value; } + + /// Creates an new instance. + public StorageContainersUpdateRequest() + { + + } + } + /// The storage container resource patch definition. + public partial interface IStorageContainersUpdateRequest : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Resource tags + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags Tag { get; set; } + + } + /// The storage container resource patch definition. + internal partial interface IStorageContainersUpdateRequestInternal + + { + /// Resource tags + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequest.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequest.json.cs new file mode 100644 index 000000000000..b72653a840d3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequest.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The storage container resource patch definition. + public partial class StorageContainersUpdateRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new StorageContainersUpdateRequest(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal StorageContainersUpdateRequest(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainersUpdateRequestTags.FromJson(__jsonTags) : Tag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequestTags.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequestTags.PowerShell.cs new file mode 100644 index 000000000000..1a3728fbbda1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequestTags.PowerShell.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Resource tags + [System.ComponentModel.TypeConverter(typeof(StorageContainersUpdateRequestTagsTypeConverter))] + public partial class StorageContainersUpdateRequestTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StorageContainersUpdateRequestTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StorageContainersUpdateRequestTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StorageContainersUpdateRequestTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StorageContainersUpdateRequestTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Resource tags + [System.ComponentModel.TypeConverter(typeof(StorageContainersUpdateRequestTagsTypeConverter))] + public partial interface IStorageContainersUpdateRequestTags + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequestTags.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequestTags.TypeConverter.cs new file mode 100644 index 000000000000..8828cbcffb64 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequestTags.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StorageContainersUpdateRequestTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StorageContainersUpdateRequestTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StorageContainersUpdateRequestTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StorageContainersUpdateRequestTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequestTags.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequestTags.cs new file mode 100644 index 000000000000..412e7ac3cbda --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequestTags.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Resource tags + public partial class StorageContainersUpdateRequestTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTagsInternal + { + + /// Creates an new instance. + public StorageContainersUpdateRequestTags() + { + + } + } + /// Resource tags + public partial interface IStorageContainersUpdateRequestTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + + } + /// Resource tags + internal partial interface IStorageContainersUpdateRequestTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequestTags.dictionary.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequestTags.dictionary.cs new file mode 100644 index 000000000000..863f15052f96 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequestTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class StorageContainersUpdateRequestTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainersUpdateRequestTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequestTags.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequestTags.json.cs new file mode 100644 index 000000000000..3e67b61f8e32 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageContainersUpdateRequestTags.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Resource tags + public partial class StorageContainersUpdateRequestTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new StorageContainersUpdateRequestTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + /// + internal StorageContainersUpdateRequestTags(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdate.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdate.PowerShell.cs new file mode 100644 index 000000000000..2df109571c66 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdate.PowerShell.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(StorageProfileUpdateTypeConverter))] + public partial class StorageProfileUpdate + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StorageProfileUpdate(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StorageProfileUpdate(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StorageProfileUpdate(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DataDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateInternal)this).DataDisk = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem[]) content.GetValueForProperty("DataDisk",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateInternal)this).DataDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageProfileUpdateDataDisksItemTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StorageProfileUpdate(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DataDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateInternal)this).DataDisk = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem[]) content.GetValueForProperty("DataDisk",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateInternal)this).DataDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageProfileUpdateDataDisksItemTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(StorageProfileUpdateTypeConverter))] + public partial interface IStorageProfileUpdate + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdate.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdate.TypeConverter.cs new file mode 100644 index 000000000000..8d4641b3d145 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdate.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StorageProfileUpdateTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdate ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdate).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StorageProfileUpdate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StorageProfileUpdate.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StorageProfileUpdate.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdate.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdate.cs new file mode 100644 index 000000000000..d6d03543bfcd --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdate.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class StorageProfileUpdate : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdate, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem[] _dataDisk; + + /// adds data disks to the virtual machine instance for the update call + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem[] DataDisk { get => this._dataDisk; set => this._dataDisk = value; } + + /// Creates an new instance. + public StorageProfileUpdate() + { + + } + } + public partial interface IStorageProfileUpdate : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// adds data disks to the virtual machine instance for the update call + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"adds data disks to the virtual machine instance for the update call", + SerializedName = @"dataDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem[] DataDisk { get; set; } + + } + internal partial interface IStorageProfileUpdateInternal + + { + /// adds data disks to the virtual machine instance for the update call + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem[] DataDisk { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdate.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdate.json.cs new file mode 100644 index 000000000000..97a671ccb171 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdate.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class StorageProfileUpdate + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdate. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdate. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new StorageProfileUpdate(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal StorageProfileUpdate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_dataDisk = If( json?.PropertyT("dataDisks"), out var __jsonDataDisks) ? If( __jsonDataDisks as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageProfileUpdateDataDisksItem.FromJson(__u) )) ))() : null : DataDisk;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._dataDisk) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._dataDisk ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("dataDisks",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdateDataDisksItem.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdateDataDisksItem.PowerShell.cs new file mode 100644 index 000000000000..8ef5108ff453 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdateDataDisksItem.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(StorageProfileUpdateDataDisksItemTypeConverter))] + public partial class StorageProfileUpdateDataDisksItem + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StorageProfileUpdateDataDisksItem(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StorageProfileUpdateDataDisksItem(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StorageProfileUpdateDataDisksItem(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItemInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItemInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StorageProfileUpdateDataDisksItem(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItemInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItemInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(StorageProfileUpdateDataDisksItemTypeConverter))] + public partial interface IStorageProfileUpdateDataDisksItem + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdateDataDisksItem.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdateDataDisksItem.TypeConverter.cs new file mode 100644 index 000000000000..9e549e1d948d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdateDataDisksItem.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StorageProfileUpdateDataDisksItemTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StorageProfileUpdateDataDisksItem.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StorageProfileUpdateDataDisksItem.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StorageProfileUpdateDataDisksItem.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdateDataDisksItem.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdateDataDisksItem.cs new file mode 100644 index 000000000000..0faaa93a0ece --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdateDataDisksItem.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class StorageProfileUpdateDataDisksItem : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItemInternal + { + + /// Backing field for property. + private string _id; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// Creates an new instance. + public StorageProfileUpdateDataDisksItem() + { + + } + } + public partial interface IStorageProfileUpdateDataDisksItem : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + + } + internal partial interface IStorageProfileUpdateDataDisksItemInternal + + { + string Id { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdateDataDisksItem.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdateDataDisksItem.json.cs new file mode 100644 index 000000000000..d4d56161c924 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/StorageProfileUpdateDataDisksItem.json.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class StorageProfileUpdateDataDisksItem + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new StorageProfileUpdateDataDisksItem(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal StorageProfileUpdateDataDisksItem(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Subnet.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Subnet.PowerShell.cs new file mode 100644 index 000000000000..8595810e35b6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Subnet.PowerShell.cs @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(SubnetTypeConverter))] + public partial class Subnet + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Subnet(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Subnet(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Subnet(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormat) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SubnetPropertiesFormatTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("RouteTable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).RouteTable = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTable) content.GetValueForProperty("RouteTable",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).RouteTable, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTableTypeConverter.ConvertFrom); + } + if (content.Contains("AddressPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).AddressPrefix = (string) content.GetValueForProperty("AddressPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).AddressPrefix, global::System.Convert.ToString); + } + if (content.Contains("AddressPrefixes")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).AddressPrefixes = (string[]) content.GetValueForProperty("AddressPrefixes",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).AddressPrefixes, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("IPAllocationMethod")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).IPAllocationMethod = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum?) content.GetValueForProperty("IPAllocationMethod",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).IPAllocationMethod, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum.CreateFrom); + } + if (content.Contains("IPConfigurationReference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).IPConfigurationReference = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem[]) content.GetValueForProperty("IPConfigurationReference",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).IPConfigurationReference, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SubnetPropertiesFormatIPConfigurationReferencesItemTypeConverter.ConvertFrom)); + } + if (content.Contains("IPPool")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).IPPool = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool[]) content.GetValueForProperty("IPPool",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).IPPool, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPPoolTypeConverter.ConvertFrom)); + } + if (content.Contains("Vlan")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).Vlan = (int?) content.GetValueForProperty("Vlan",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).Vlan, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RouteTableEtag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).RouteTableEtag = (string) content.GetValueForProperty("RouteTableEtag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).RouteTableEtag, global::System.Convert.ToString); + } + if (content.Contains("RouteTableName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).RouteTableName = (string) content.GetValueForProperty("RouteTableName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).RouteTableName, global::System.Convert.ToString); + } + if (content.Contains("RouteTableType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).RouteTableType = (string) content.GetValueForProperty("RouteTableType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).RouteTableType, global::System.Convert.ToString); + } + if (content.Contains("RouteTableProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).RouteTableProperty = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat) content.GetValueForProperty("RouteTableProperty",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).RouteTableProperty, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTablePropertiesFormatTypeConverter.ConvertFrom); + } + if (content.Contains("Route")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).Route = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute[]) content.GetValueForProperty("Route",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).Route, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Subnet(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormat) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SubnetPropertiesFormatTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("RouteTable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).RouteTable = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTable) content.GetValueForProperty("RouteTable",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).RouteTable, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTableTypeConverter.ConvertFrom); + } + if (content.Contains("AddressPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).AddressPrefix = (string) content.GetValueForProperty("AddressPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).AddressPrefix, global::System.Convert.ToString); + } + if (content.Contains("AddressPrefixes")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).AddressPrefixes = (string[]) content.GetValueForProperty("AddressPrefixes",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).AddressPrefixes, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("IPAllocationMethod")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).IPAllocationMethod = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum?) content.GetValueForProperty("IPAllocationMethod",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).IPAllocationMethod, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum.CreateFrom); + } + if (content.Contains("IPConfigurationReference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).IPConfigurationReference = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem[]) content.GetValueForProperty("IPConfigurationReference",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).IPConfigurationReference, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SubnetPropertiesFormatIPConfigurationReferencesItemTypeConverter.ConvertFrom)); + } + if (content.Contains("IPPool")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).IPPool = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool[]) content.GetValueForProperty("IPPool",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).IPPool, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPPoolTypeConverter.ConvertFrom)); + } + if (content.Contains("Vlan")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).Vlan = (int?) content.GetValueForProperty("Vlan",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).Vlan, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RouteTableEtag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).RouteTableEtag = (string) content.GetValueForProperty("RouteTableEtag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).RouteTableEtag, global::System.Convert.ToString); + } + if (content.Contains("RouteTableName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).RouteTableName = (string) content.GetValueForProperty("RouteTableName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).RouteTableName, global::System.Convert.ToString); + } + if (content.Contains("RouteTableType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).RouteTableType = (string) content.GetValueForProperty("RouteTableType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).RouteTableType, global::System.Convert.ToString); + } + if (content.Contains("RouteTableProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).RouteTableProperty = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat) content.GetValueForProperty("RouteTableProperty",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).RouteTableProperty, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTablePropertiesFormatTypeConverter.ConvertFrom); + } + if (content.Contains("Route")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).Route = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute[]) content.GetValueForProperty("Route",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal)this).Route, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(SubnetTypeConverter))] + public partial interface ISubnet + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Subnet.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Subnet.TypeConverter.cs new file mode 100644 index 000000000000..b30803b112bb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Subnet.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SubnetTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Subnet.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Subnet.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Subnet.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Subnet.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Subnet.cs new file mode 100644 index 000000000000..e4564047ebba --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Subnet.cs @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class Subnet : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal + { + + /// The address prefix for the subnet: Cidr for this subnet - IPv4, IPv6. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string AddressPrefix { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).AddressPrefix; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).AddressPrefix = value ?? null; } + + /// List of address prefixes for the subnet. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string[] AddressPrefixes { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).AddressPrefixes; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).AddressPrefixes = value ?? null /* arrayOf */; } + + /// + /// IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic' + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum? IPAllocationMethod { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).IPAllocationMethod; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).IPAllocationMethod = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum)""); } + + /// IPConfigurationReferences - list of IPConfigurationReferences + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem[] IPConfigurationReference { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).IPConfigurationReference; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).IPConfigurationReference = value ?? null /* arrayOf */; } + + /// network associated pool of IP Addresses + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool[] IPPool { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).IPPool; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).IPPool = value ?? null /* arrayOf */; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormat Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SubnetPropertiesFormat()); set { {_property = value;} } } + + /// Internal Acessors for RouteTable + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal.RouteTable { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).RouteTable; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).RouteTable = value; } + + /// Internal Acessors for RouteTableEtag + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal.RouteTableEtag { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).RouteTableEtag; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).RouteTableEtag = value; } + + /// Internal Acessors for RouteTableName + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal.RouteTableName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).RouteTableName; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).RouteTableName = value; } + + /// Internal Acessors for RouteTableProperty + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal.RouteTableProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).RouteTableProperty; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).RouteTableProperty = value; } + + /// Internal Acessors for RouteTableType + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetInternal.RouteTableType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).RouteTableType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).RouteTableType = value; } + + /// Backing field for property. + private string _name; + + /// + /// Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormat _property; + + /// Properties of the subnet. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormat Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SubnetPropertiesFormat()); set => this._property = value; } + + /// Collection of routes contained within a route table. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute[] Route { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).Route; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).Route = value ?? null /* arrayOf */; } + + /// A unique read-only string that changes whenever the resource is updated. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string RouteTableEtag { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).RouteTableEtag; } + + /// Resource name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string RouteTableName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).RouteTableName; } + + /// Resource type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string RouteTableType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).RouteTableType; } + + /// Vlan to use for the subnet + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public int? Vlan { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).Vlan; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)Property).Vlan = value ?? default(int); } + + /// Creates an new instance. + public Subnet() + { + + } + } + public partial interface ISubnet : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The address prefix for the subnet: Cidr for this subnet - IPv4, IPv6. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The address prefix for the subnet: Cidr for this subnet - IPv4, IPv6.", + SerializedName = @"addressPrefix", + PossibleTypes = new [] { typeof(string) })] + string AddressPrefix { get; set; } + /// List of address prefixes for the subnet. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of address prefixes for the subnet.", + SerializedName = @"addressPrefixes", + PossibleTypes = new [] { typeof(string) })] + string[] AddressPrefixes { get; set; } + /// + /// IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic' + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic'", + SerializedName = @"ipAllocationMethod", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum? IPAllocationMethod { get; set; } + /// IPConfigurationReferences - list of IPConfigurationReferences + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"IPConfigurationReferences - list of IPConfigurationReferences", + SerializedName = @"ipConfigurationReferences", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem[] IPConfigurationReference { get; set; } + /// network associated pool of IP Addresses + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"network associated pool of IP Addresses", + SerializedName = @"ipPools", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool[] IPPool { get; set; } + /// + /// Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Name - The name of the resource that is unique within a resource group. This name can be used to access the resource.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Collection of routes contained within a route table. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Collection of routes contained within a route table.", + SerializedName = @"routes", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute[] Route { get; set; } + /// A unique read-only string that changes whenever the resource is updated. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A unique read-only string that changes whenever the resource is updated.", + SerializedName = @"etag", + PossibleTypes = new [] { typeof(string) })] + string RouteTableEtag { get; } + /// Resource name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Resource name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string RouteTableName { get; } + /// Resource type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Resource type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string RouteTableType { get; } + /// Vlan to use for the subnet + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Vlan to use for the subnet", + SerializedName = @"vlan", + PossibleTypes = new [] { typeof(int) })] + int? Vlan { get; set; } + + } + internal partial interface ISubnetInternal + + { + /// The address prefix for the subnet: Cidr for this subnet - IPv4, IPv6. + string AddressPrefix { get; set; } + /// List of address prefixes for the subnet. + string[] AddressPrefixes { get; set; } + /// + /// IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic' + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum? IPAllocationMethod { get; set; } + /// IPConfigurationReferences - list of IPConfigurationReferences + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem[] IPConfigurationReference { get; set; } + /// network associated pool of IP Addresses + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool[] IPPool { get; set; } + /// + /// Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + /// + string Name { get; set; } + /// Properties of the subnet. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormat Property { get; set; } + /// Collection of routes contained within a route table. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute[] Route { get; set; } + /// Route table resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTable RouteTable { get; set; } + /// A unique read-only string that changes whenever the resource is updated. + string RouteTableEtag { get; set; } + /// Resource name. + string RouteTableName { get; set; } + /// Properties of the route table. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat RouteTableProperty { get; set; } + /// Resource type. + string RouteTableType { get; set; } + /// Vlan to use for the subnet + int? Vlan { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Subnet.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Subnet.json.cs new file mode 100644 index 000000000000..54821ea7ae17 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/Subnet.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class Subnet + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new Subnet(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal Subnet(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SubnetPropertiesFormat.FromJson(__jsonProperties) : Property;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormat.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormat.PowerShell.cs new file mode 100644 index 000000000000..ea1b4f08fe11 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormat.PowerShell.cs @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Properties of the subnet. + [System.ComponentModel.TypeConverter(typeof(SubnetPropertiesFormatTypeConverter))] + public partial class SubnetPropertiesFormat + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormat DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SubnetPropertiesFormat(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormat DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SubnetPropertiesFormat(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormat FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SubnetPropertiesFormat(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RouteTable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).RouteTable = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTable) content.GetValueForProperty("RouteTable",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).RouteTable, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTableTypeConverter.ConvertFrom); + } + if (content.Contains("AddressPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).AddressPrefix = (string) content.GetValueForProperty("AddressPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).AddressPrefix, global::System.Convert.ToString); + } + if (content.Contains("AddressPrefixes")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).AddressPrefixes = (string[]) content.GetValueForProperty("AddressPrefixes",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).AddressPrefixes, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("IPAllocationMethod")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).IPAllocationMethod = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum?) content.GetValueForProperty("IPAllocationMethod",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).IPAllocationMethod, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum.CreateFrom); + } + if (content.Contains("IPConfigurationReference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).IPConfigurationReference = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem[]) content.GetValueForProperty("IPConfigurationReference",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).IPConfigurationReference, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SubnetPropertiesFormatIPConfigurationReferencesItemTypeConverter.ConvertFrom)); + } + if (content.Contains("IPPool")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).IPPool = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool[]) content.GetValueForProperty("IPPool",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).IPPool, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPPoolTypeConverter.ConvertFrom)); + } + if (content.Contains("Vlan")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).Vlan = (int?) content.GetValueForProperty("Vlan",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).Vlan, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RouteTableEtag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).RouteTableEtag = (string) content.GetValueForProperty("RouteTableEtag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).RouteTableEtag, global::System.Convert.ToString); + } + if (content.Contains("RouteTableName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).RouteTableName = (string) content.GetValueForProperty("RouteTableName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).RouteTableName, global::System.Convert.ToString); + } + if (content.Contains("RouteTableType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).RouteTableType = (string) content.GetValueForProperty("RouteTableType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).RouteTableType, global::System.Convert.ToString); + } + if (content.Contains("RouteTableProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).RouteTableProperty = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat) content.GetValueForProperty("RouteTableProperty",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).RouteTableProperty, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTablePropertiesFormatTypeConverter.ConvertFrom); + } + if (content.Contains("Route")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).Route = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute[]) content.GetValueForProperty("Route",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).Route, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SubnetPropertiesFormat(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RouteTable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).RouteTable = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTable) content.GetValueForProperty("RouteTable",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).RouteTable, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTableTypeConverter.ConvertFrom); + } + if (content.Contains("AddressPrefix")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).AddressPrefix = (string) content.GetValueForProperty("AddressPrefix",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).AddressPrefix, global::System.Convert.ToString); + } + if (content.Contains("AddressPrefixes")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).AddressPrefixes = (string[]) content.GetValueForProperty("AddressPrefixes",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).AddressPrefixes, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("IPAllocationMethod")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).IPAllocationMethod = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum?) content.GetValueForProperty("IPAllocationMethod",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).IPAllocationMethod, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum.CreateFrom); + } + if (content.Contains("IPConfigurationReference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).IPConfigurationReference = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem[]) content.GetValueForProperty("IPConfigurationReference",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).IPConfigurationReference, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SubnetPropertiesFormatIPConfigurationReferencesItemTypeConverter.ConvertFrom)); + } + if (content.Contains("IPPool")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).IPPool = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool[]) content.GetValueForProperty("IPPool",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).IPPool, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPPoolTypeConverter.ConvertFrom)); + } + if (content.Contains("Vlan")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).Vlan = (int?) content.GetValueForProperty("Vlan",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).Vlan, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RouteTableEtag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).RouteTableEtag = (string) content.GetValueForProperty("RouteTableEtag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).RouteTableEtag, global::System.Convert.ToString); + } + if (content.Contains("RouteTableName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).RouteTableName = (string) content.GetValueForProperty("RouteTableName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).RouteTableName, global::System.Convert.ToString); + } + if (content.Contains("RouteTableType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).RouteTableType = (string) content.GetValueForProperty("RouteTableType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).RouteTableType, global::System.Convert.ToString); + } + if (content.Contains("RouteTableProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).RouteTableProperty = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat) content.GetValueForProperty("RouteTableProperty",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).RouteTableProperty, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTablePropertiesFormatTypeConverter.ConvertFrom); + } + if (content.Contains("Route")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).Route = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute[]) content.GetValueForProperty("Route",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal)this).Route, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Properties of the subnet. + [System.ComponentModel.TypeConverter(typeof(SubnetPropertiesFormatTypeConverter))] + public partial interface ISubnetPropertiesFormat + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormat.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormat.TypeConverter.cs new file mode 100644 index 000000000000..8aa071618c81 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormat.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SubnetPropertiesFormatTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormat ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormat).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SubnetPropertiesFormat.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SubnetPropertiesFormat.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SubnetPropertiesFormat.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormat.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormat.cs new file mode 100644 index 000000000000..7ecf02b3f876 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormat.cs @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Properties of the subnet. + public partial class SubnetPropertiesFormat : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormat, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal + { + + /// Backing field for property. + private string _addressPrefix; + + /// The address prefix for the subnet: Cidr for this subnet - IPv4, IPv6. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string AddressPrefix { get => this._addressPrefix; set => this._addressPrefix = value; } + + /// Backing field for property. + private string[] _addressPrefixes; + + /// List of address prefixes for the subnet. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string[] AddressPrefixes { get => this._addressPrefixes; set => this._addressPrefixes = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum? _iPAllocationMethod; + + /// + /// IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic' + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum? IPAllocationMethod { get => this._iPAllocationMethod; set => this._iPAllocationMethod = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem[] _iPConfigurationReference; + + /// IPConfigurationReferences - list of IPConfigurationReferences + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem[] IPConfigurationReference { get => this._iPConfigurationReference; set => this._iPConfigurationReference = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool[] _iPPool; + + /// network associated pool of IP Addresses + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool[] IPPool { get => this._iPPool; set => this._iPPool = value; } + + /// Internal Acessors for RouteTable + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal.RouteTable { get => (this._routeTable = this._routeTable ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTable()); set { {_routeTable = value;} } } + + /// Internal Acessors for RouteTableEtag + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal.RouteTableEtag { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)RouteTable).Etag; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)RouteTable).Etag = value; } + + /// Internal Acessors for RouteTableName + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal.RouteTableName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)RouteTable).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)RouteTable).Name = value; } + + /// Internal Acessors for RouteTableProperty + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal.RouteTableProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)RouteTable).Property; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)RouteTable).Property = value; } + + /// Internal Acessors for RouteTableType + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatInternal.RouteTableType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)RouteTable).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)RouteTable).Type = value; } + + /// Collection of routes contained within a route table. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute[] Route { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)RouteTable).Route; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)RouteTable).Route = value ?? null /* arrayOf */; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTable _routeTable; + + /// Route table resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTable RouteTable { get => (this._routeTable = this._routeTable ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTable()); set => this._routeTable = value; } + + /// A unique read-only string that changes whenever the resource is updated. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string RouteTableEtag { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)RouteTable).Etag; } + + /// Resource name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string RouteTableName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)RouteTable).Name; } + + /// Resource type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string RouteTableType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTableInternal)RouteTable).Type; } + + /// Backing field for property. + private int? _vlan; + + /// Vlan to use for the subnet + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public int? Vlan { get => this._vlan; set => this._vlan = value; } + + /// Creates an new instance. + public SubnetPropertiesFormat() + { + + } + } + /// Properties of the subnet. + public partial interface ISubnetPropertiesFormat : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The address prefix for the subnet: Cidr for this subnet - IPv4, IPv6. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The address prefix for the subnet: Cidr for this subnet - IPv4, IPv6.", + SerializedName = @"addressPrefix", + PossibleTypes = new [] { typeof(string) })] + string AddressPrefix { get; set; } + /// List of address prefixes for the subnet. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of address prefixes for the subnet.", + SerializedName = @"addressPrefixes", + PossibleTypes = new [] { typeof(string) })] + string[] AddressPrefixes { get; set; } + /// + /// IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic' + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic'", + SerializedName = @"ipAllocationMethod", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum? IPAllocationMethod { get; set; } + /// IPConfigurationReferences - list of IPConfigurationReferences + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"IPConfigurationReferences - list of IPConfigurationReferences", + SerializedName = @"ipConfigurationReferences", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem[] IPConfigurationReference { get; set; } + /// network associated pool of IP Addresses + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"network associated pool of IP Addresses", + SerializedName = @"ipPools", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool[] IPPool { get; set; } + /// Collection of routes contained within a route table. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Collection of routes contained within a route table.", + SerializedName = @"routes", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute[] Route { get; set; } + /// A unique read-only string that changes whenever the resource is updated. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A unique read-only string that changes whenever the resource is updated.", + SerializedName = @"etag", + PossibleTypes = new [] { typeof(string) })] + string RouteTableEtag { get; } + /// Resource name. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Resource name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string RouteTableName { get; } + /// Resource type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Resource type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string RouteTableType { get; } + /// Vlan to use for the subnet + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Vlan to use for the subnet", + SerializedName = @"vlan", + PossibleTypes = new [] { typeof(int) })] + int? Vlan { get; set; } + + } + /// Properties of the subnet. + internal partial interface ISubnetPropertiesFormatInternal + + { + /// The address prefix for the subnet: Cidr for this subnet - IPv4, IPv6. + string AddressPrefix { get; set; } + /// List of address prefixes for the subnet. + string[] AddressPrefixes { get; set; } + /// + /// IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic' + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum? IPAllocationMethod { get; set; } + /// IPConfigurationReferences - list of IPConfigurationReferences + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem[] IPConfigurationReference { get; set; } + /// network associated pool of IP Addresses + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool[] IPPool { get; set; } + /// Collection of routes contained within a route table. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRoute[] Route { get; set; } + /// Route table resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTable RouteTable { get; set; } + /// A unique read-only string that changes whenever the resource is updated. + string RouteTableEtag { get; set; } + /// Resource name. + string RouteTableName { get; set; } + /// Properties of the route table. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IRouteTablePropertiesFormat RouteTableProperty { get; set; } + /// Resource type. + string RouteTableType { get; set; } + /// Vlan to use for the subnet + int? Vlan { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormat.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormat.json.cs new file mode 100644 index 000000000000..c90b430fffba --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormat.json.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Properties of the subnet. + public partial class SubnetPropertiesFormat + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormat. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormat. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormat FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new SubnetPropertiesFormat(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal SubnetPropertiesFormat(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_routeTable = If( json?.PropertyT("routeTable"), out var __jsonRouteTable) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.RouteTable.FromJson(__jsonRouteTable) : RouteTable;} + {_addressPrefix = If( json?.PropertyT("addressPrefix"), out var __jsonAddressPrefix) ? (string)__jsonAddressPrefix : (string)AddressPrefix;} + {_addressPrefixes = If( json?.PropertyT("addressPrefixes"), out var __jsonAddressPrefixes) ? If( __jsonAddressPrefixes as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : AddressPrefixes;} + {_iPAllocationMethod = If( json?.PropertyT("ipAllocationMethod"), out var __jsonIPAllocationMethod) ? (string)__jsonIPAllocationMethod : (string)IPAllocationMethod;} + {_iPConfigurationReference = If( json?.PropertyT("ipConfigurationReferences"), out var __jsonIPConfigurationReferences) ? If( __jsonIPConfigurationReferences as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SubnetPropertiesFormatIPConfigurationReferencesItem.FromJson(__p) )) ))() : null : IPConfigurationReference;} + {_iPPool = If( json?.PropertyT("ipPools"), out var __jsonIPPools) ? If( __jsonIPPools as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __l) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__l, (__k)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPPool) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IPPool.FromJson(__k) )) ))() : null : IPPool;} + {_vlan = If( json?.PropertyT("vlan"), out var __jsonVlan) ? (int?)__jsonVlan : Vlan;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._routeTable ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._routeTable.ToJson(null,serializationMode) : null, "routeTable" ,container.Add ); + AddIf( null != (((object)this._addressPrefix)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._addressPrefix.ToString()) : null, "addressPrefix" ,container.Add ); + if (null != this._addressPrefixes) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._addressPrefixes ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("addressPrefixes",__w); + } + AddIf( null != (((object)this._iPAllocationMethod)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._iPAllocationMethod.ToString()) : null, "ipAllocationMethod" ,container.Add ); + if (null != this._iPConfigurationReference) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __s in this._iPConfigurationReference ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("ipConfigurationReferences",__r); + } + if (null != this._iPPool) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __n in this._iPPool ) + { + AddIf(__n?.ToJson(null, serializationMode) ,__m.Add); + } + container.Add("ipPools",__m); + } + AddIf( null != this._vlan ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNumber((int)this._vlan) : null, "vlan" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormatIPConfigurationReferencesItem.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormatIPConfigurationReferencesItem.PowerShell.cs new file mode 100644 index 000000000000..0be00c4784e4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormatIPConfigurationReferencesItem.PowerShell.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// IPConfigurationReference - Describes a IPConfiguration under the virtual network + /// + [System.ComponentModel.TypeConverter(typeof(SubnetPropertiesFormatIPConfigurationReferencesItemTypeConverter))] + public partial class SubnetPropertiesFormatIPConfigurationReferencesItem + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SubnetPropertiesFormatIPConfigurationReferencesItem(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SubnetPropertiesFormatIPConfigurationReferencesItem(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SubnetPropertiesFormatIPConfigurationReferencesItem(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItemInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItemInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SubnetPropertiesFormatIPConfigurationReferencesItem(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItemInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItemInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// IPConfigurationReference - Describes a IPConfiguration under the virtual network + [System.ComponentModel.TypeConverter(typeof(SubnetPropertiesFormatIPConfigurationReferencesItemTypeConverter))] + public partial interface ISubnetPropertiesFormatIPConfigurationReferencesItem + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormatIPConfigurationReferencesItem.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormatIPConfigurationReferencesItem.TypeConverter.cs new file mode 100644 index 000000000000..66b5950ce248 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormatIPConfigurationReferencesItem.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SubnetPropertiesFormatIPConfigurationReferencesItemTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a + /// type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SubnetPropertiesFormatIPConfigurationReferencesItem.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SubnetPropertiesFormatIPConfigurationReferencesItem.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SubnetPropertiesFormatIPConfigurationReferencesItem.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormatIPConfigurationReferencesItem.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormatIPConfigurationReferencesItem.cs new file mode 100644 index 000000000000..904971dbbb53 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormatIPConfigurationReferencesItem.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// IPConfigurationReference - Describes a IPConfiguration under the virtual network + /// + public partial class SubnetPropertiesFormatIPConfigurationReferencesItem : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItemInternal + { + + /// Backing field for property. + private string _id; + + /// IPConfigurationID + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// + /// Creates an new instance. + /// + public SubnetPropertiesFormatIPConfigurationReferencesItem() + { + + } + } + /// IPConfigurationReference - Describes a IPConfiguration under the virtual network + public partial interface ISubnetPropertiesFormatIPConfigurationReferencesItem : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// IPConfigurationID + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"IPConfigurationID", + SerializedName = @"ID", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + + } + /// IPConfigurationReference - Describes a IPConfiguration under the virtual network + internal partial interface ISubnetPropertiesFormatIPConfigurationReferencesItemInternal + + { + /// IPConfigurationID + string Id { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormatIPConfigurationReferencesItem.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormatIPConfigurationReferencesItem.json.cs new file mode 100644 index 000000000000..988b86e77a1c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/SubnetPropertiesFormatIPConfigurationReferencesItem.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// IPConfigurationReference - Describes a IPConfiguration under the virtual network + /// + public partial class SubnetPropertiesFormatIPConfigurationReferencesItem + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnetPropertiesFormatIPConfigurationReferencesItem FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new SubnetPropertiesFormatIPConfigurationReferencesItem(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal SubnetPropertiesFormatIPConfigurationReferencesItem(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("ID"), out var __jsonId) ? (string)__jsonId : (string)Id;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._id.ToString()) : null, "ID" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskProperties.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskProperties.PowerShell.cs new file mode 100644 index 000000000000..267f9e643dc6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskProperties.PowerShell.cs @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Properties under the virtual hard disk resource + [System.ComponentModel.TypeConverter(typeof(VirtualHardDiskPropertiesTypeConverter))] + public partial class VirtualHardDiskProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualHardDiskProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualHardDiskProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualHardDiskProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskStatusTypeConverter.ConvertFrom); + } + if (content.Contains("BlockSizeByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).BlockSizeByte = (int?) content.GetValueForProperty("BlockSizeByte",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).BlockSizeByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("DiskSizeGb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).DiskSizeGb = (long?) content.GetValueForProperty("DiskSizeGb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).DiskSizeGb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("Dynamic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).Dynamic = (bool?) content.GetValueForProperty("Dynamic",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).Dynamic, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LogicalSectorByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).LogicalSectorByte = (int?) content.GetValueForProperty("LogicalSectorByte",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).LogicalSectorByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PhysicalSectorByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).PhysicalSectorByte = (int?) content.GetValueForProperty("PhysicalSectorByte",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).PhysicalSectorByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("HyperVGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).HyperVGeneration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration?) content.GetValueForProperty("HyperVGeneration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).HyperVGeneration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration.CreateFrom); + } + if (content.Contains("DiskFileFormat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).DiskFileFormat = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat?) content.GetValueForProperty("DiskFileFormat",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).DiskFileFormat, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat.CreateFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("ContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).ContainerId = (string) content.GetValueForProperty("ContainerId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).ContainerId, global::System.Convert.ToString); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualHardDiskProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskStatusTypeConverter.ConvertFrom); + } + if (content.Contains("BlockSizeByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).BlockSizeByte = (int?) content.GetValueForProperty("BlockSizeByte",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).BlockSizeByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("DiskSizeGb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).DiskSizeGb = (long?) content.GetValueForProperty("DiskSizeGb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).DiskSizeGb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("Dynamic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).Dynamic = (bool?) content.GetValueForProperty("Dynamic",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).Dynamic, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LogicalSectorByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).LogicalSectorByte = (int?) content.GetValueForProperty("LogicalSectorByte",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).LogicalSectorByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PhysicalSectorByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).PhysicalSectorByte = (int?) content.GetValueForProperty("PhysicalSectorByte",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).PhysicalSectorByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("HyperVGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).HyperVGeneration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration?) content.GetValueForProperty("HyperVGeneration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).HyperVGeneration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration.CreateFrom); + } + if (content.Contains("DiskFileFormat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).DiskFileFormat = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat?) content.GetValueForProperty("DiskFileFormat",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).DiskFileFormat, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat.CreateFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("ContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).ContainerId = (string) content.GetValueForProperty("ContainerId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).ContainerId, global::System.Convert.ToString); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Properties under the virtual hard disk resource + [System.ComponentModel.TypeConverter(typeof(VirtualHardDiskPropertiesTypeConverter))] + public partial interface IVirtualHardDiskProperties + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskProperties.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskProperties.TypeConverter.cs new file mode 100644 index 000000000000..12b91ad0f70d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualHardDiskPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualHardDiskProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualHardDiskProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualHardDiskProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskProperties.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskProperties.cs new file mode 100644 index 000000000000..8daecff04993 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskProperties.cs @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Properties under the virtual hard disk resource + public partial class VirtualHardDiskProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskProperties, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal + { + + /// Backing field for property. + private int? _blockSizeByte; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public int? BlockSizeByte { get => this._blockSizeByte; set => this._blockSizeByte = value; } + + /// Backing field for property. + private string _containerId; + + /// Storage ContainerID of the storage container to be used for VHD + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ContainerId { get => this._containerId; set => this._containerId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat? _diskFileFormat; + + /// The format of the actual VHD file [vhd, vhdx] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat? DiskFileFormat { get => this._diskFileFormat; set => this._diskFileFormat = value; } + + /// Backing field for property. + private long? _diskSizeGb; + + /// Size of the disk in GB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public long? DiskSizeGb { get => this._diskSizeGb; set => this._diskSizeGb = value; } + + /// Backing field for property. + private bool? _dynamic; + + /// Boolean for enabling dynamic sizing on the virtual hard disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public bool? Dynamic { get => this._dynamic; set => this._dynamic = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration? _hyperVGeneration; + + /// The hypervisor generation of the Virtual Machine [V1, V2] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration? HyperVGeneration { get => this._hyperVGeneration; set => this._hyperVGeneration = value; } + + /// Backing field for property. + private int? _logicalSectorByte; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public int? LogicalSectorByte { get => this._logicalSectorByte; set => this._logicalSectorByte = value; } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal.Status { get => (this._status = this._status ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskStatus()); set { {_status = value;} } } + + /// Internal Acessors for StatusProvisioningStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal.StatusProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)Status).ProvisioningStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)Status).ProvisioningStatus = value; } + + /// Backing field for property. + private int? _physicalSectorByte; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public int? PhysicalSectorByte { get => this._physicalSectorByte; set => this._physicalSectorByte = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? _provisioningState; + + /// Provisioning state of the virtual hard disk. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get => this._provisioningState; } + + /// + /// The status of the operation performed on the virtual hard disk [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)Status).ProvisioningStatusStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)Status).ProvisioningStatusStatus = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status)""); } + + /// The ID of the operation performed on the virtual hard disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningStatusOperationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)Status).ProvisioningStatusOperationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)Status).ProvisioningStatusOperationId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatus _status; + + /// The observed state of virtual hard disks + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatus Status { get => (this._status = this._status ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskStatus()); } + + /// VirtualHardDisk provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)Status).ErrorCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)Status).ErrorCode = value ?? null; } + + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)Status).ErrorMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)Status).ErrorMessage = value ?? null; } + + /// Creates an new instance. + public VirtualHardDiskProperties() + { + + } + } + /// Properties under the virtual hard disk resource + public partial interface IVirtualHardDiskProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"blockSizeBytes", + PossibleTypes = new [] { typeof(int) })] + int? BlockSizeByte { get; set; } + /// Storage ContainerID of the storage container to be used for VHD + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Storage ContainerID of the storage container to be used for VHD", + SerializedName = @"containerId", + PossibleTypes = new [] { typeof(string) })] + string ContainerId { get; set; } + /// The format of the actual VHD file [vhd, vhdx] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The format of the actual VHD file [vhd, vhdx]", + SerializedName = @"diskFileFormat", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat? DiskFileFormat { get; set; } + /// Size of the disk in GB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Size of the disk in GB", + SerializedName = @"diskSizeGB", + PossibleTypes = new [] { typeof(long) })] + long? DiskSizeGb { get; set; } + /// Boolean for enabling dynamic sizing on the virtual hard disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Boolean for enabling dynamic sizing on the virtual hard disk", + SerializedName = @"dynamic", + PossibleTypes = new [] { typeof(bool) })] + bool? Dynamic { get; set; } + /// The hypervisor generation of the Virtual Machine [V1, V2] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The hypervisor generation of the Virtual Machine [V1, V2]", + SerializedName = @"hyperVGeneration", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration? HyperVGeneration { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"logicalSectorBytes", + PossibleTypes = new [] { typeof(int) })] + int? LogicalSectorByte { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"physicalSectorBytes", + PossibleTypes = new [] { typeof(int) })] + int? PhysicalSectorByte { get; set; } + /// Provisioning state of the virtual hard disk. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Provisioning state of the virtual hard disk.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; } + /// + /// The status of the operation performed on the virtual hard disk [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the virtual hard disk [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the virtual hard disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the virtual hard disk", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusOperationId { get; set; } + /// VirtualHardDisk provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VirtualHardDisk provisioning error code", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorCode { get; set; } + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Descriptive error message", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorMessage { get; set; } + + } + /// Properties under the virtual hard disk resource + internal partial interface IVirtualHardDiskPropertiesInternal + + { + int? BlockSizeByte { get; set; } + /// Storage ContainerID of the storage container to be used for VHD + string ContainerId { get; set; } + /// The format of the actual VHD file [vhd, vhdx] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat? DiskFileFormat { get; set; } + /// Size of the disk in GB + long? DiskSizeGb { get; set; } + /// Boolean for enabling dynamic sizing on the virtual hard disk + bool? Dynamic { get; set; } + /// The hypervisor generation of the Virtual Machine [V1, V2] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration? HyperVGeneration { get; set; } + + int? LogicalSectorByte { get; set; } + + int? PhysicalSectorByte { get; set; } + /// Provisioning state of the virtual hard disk. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; set; } + /// + /// The status of the operation performed on the virtual hard disk [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the virtual hard disk + string ProvisioningStatusOperationId { get; set; } + /// The observed state of virtual hard disks + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatus Status { get; set; } + /// VirtualHardDisk provisioning error code + string StatusErrorCode { get; set; } + /// Descriptive error message + string StatusErrorMessage { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus StatusProvisioningStatus { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskProperties.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskProperties.json.cs new file mode 100644 index 000000000000..1390f98b2d63 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskProperties.json.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Properties under the virtual hard disk resource + public partial class VirtualHardDiskProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualHardDiskProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._status ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._status.ToJson(null,serializationMode) : null, "status" ,container.Add ); + } + AddIf( null != this._blockSizeByte ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNumber((int)this._blockSizeByte) : null, "blockSizeBytes" ,container.Add ); + AddIf( null != this._diskSizeGb ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNumber((long)this._diskSizeGb) : null, "diskSizeGB" ,container.Add ); + AddIf( null != this._dynamic ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonBoolean((bool)this._dynamic) : null, "dynamic" ,container.Add ); + AddIf( null != this._logicalSectorByte ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNumber((int)this._logicalSectorByte) : null, "logicalSectorBytes" ,container.Add ); + AddIf( null != this._physicalSectorByte ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNumber((int)this._physicalSectorByte) : null, "physicalSectorBytes" ,container.Add ); + AddIf( null != (((object)this._hyperVGeneration)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._hyperVGeneration.ToString()) : null, "hyperVGeneration" ,container.Add ); + AddIf( null != (((object)this._diskFileFormat)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._diskFileFormat.ToString()) : null, "diskFileFormat" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + AddIf( null != (((object)this._containerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._containerId.ToString()) : null, "containerId" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualHardDiskProperties(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskStatus.FromJson(__jsonStatus) : Status;} + {_blockSizeByte = If( json?.PropertyT("blockSizeBytes"), out var __jsonBlockSizeBytes) ? (int?)__jsonBlockSizeBytes : BlockSizeByte;} + {_diskSizeGb = If( json?.PropertyT("diskSizeGB"), out var __jsonDiskSizeGb) ? (long?)__jsonDiskSizeGb : DiskSizeGb;} + {_dynamic = If( json?.PropertyT("dynamic"), out var __jsonDynamic) ? (bool?)__jsonDynamic : Dynamic;} + {_logicalSectorByte = If( json?.PropertyT("logicalSectorBytes"), out var __jsonLogicalSectorBytes) ? (int?)__jsonLogicalSectorBytes : LogicalSectorByte;} + {_physicalSectorByte = If( json?.PropertyT("physicalSectorBytes"), out var __jsonPhysicalSectorBytes) ? (int?)__jsonPhysicalSectorBytes : PhysicalSectorByte;} + {_hyperVGeneration = If( json?.PropertyT("hyperVGeneration"), out var __jsonHyperVGeneration) ? (string)__jsonHyperVGeneration : (string)HyperVGeneration;} + {_diskFileFormat = If( json?.PropertyT("diskFileFormat"), out var __jsonDiskFileFormat) ? (string)__jsonDiskFileFormat : (string)DiskFileFormat;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + {_containerId = If( json?.PropertyT("containerId"), out var __jsonContainerId) ? (string)__jsonContainerId : (string)ContainerId;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatus.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatus.PowerShell.cs new file mode 100644 index 000000000000..f4b65255c1b3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatus.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The observed state of virtual hard disks + [System.ComponentModel.TypeConverter(typeof(VirtualHardDiskStatusTypeConverter))] + public partial class VirtualHardDiskStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualHardDiskStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualHardDiskStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualHardDiskStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)this).ProvisioningStatusStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatusStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)this).ProvisioningStatusStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualHardDiskStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatusStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)this).ProvisioningStatusStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatusStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)this).ProvisioningStatusStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// The observed state of virtual hard disks + [System.ComponentModel.TypeConverter(typeof(VirtualHardDiskStatusTypeConverter))] + public partial interface IVirtualHardDiskStatus + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatus.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatus.TypeConverter.cs new file mode 100644 index 000000000000..2e6317ad6f72 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatus.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualHardDiskStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualHardDiskStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualHardDiskStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualHardDiskStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatus.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatus.cs new file mode 100644 index 000000000000..cb21984383cf --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatus.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The observed state of virtual hard disks + public partial class VirtualHardDiskStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatus, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal + { + + /// Backing field for property. + private string _errorCode; + + /// VirtualHardDisk provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ErrorCode { get => this._errorCode; set => this._errorCode = value; } + + /// Backing field for property. + private string _errorMessage; + + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ErrorMessage { get => this._errorMessage; set => this._errorMessage = value; } + + /// Internal Acessors for ProvisioningStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusInternal.ProvisioningStatus { get => (this._provisioningStatus = this._provisioningStatus ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskStatusProvisioningStatus()); set { {_provisioningStatus = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus _provisioningStatus; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus ProvisioningStatus { get => (this._provisioningStatus = this._provisioningStatus ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskStatusProvisioningStatus()); set => this._provisioningStatus = value; } + + /// The ID of the operation performed on the virtual hard disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningStatusOperationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatusInternal)ProvisioningStatus).OperationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatusInternal)ProvisioningStatus).OperationId = value ?? null; } + + /// + /// The status of the operation performed on the virtual hard disk [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatusStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatusInternal)ProvisioningStatus).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatusInternal)ProvisioningStatus).Status = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status)""); } + + /// Creates an new instance. + public VirtualHardDiskStatus() + { + + } + } + /// The observed state of virtual hard disks + public partial interface IVirtualHardDiskStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// VirtualHardDisk provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VirtualHardDisk provisioning error code", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string ErrorCode { get; set; } + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Descriptive error message", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; set; } + /// The ID of the operation performed on the virtual hard disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the virtual hard disk", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusOperationId { get; set; } + /// + /// The status of the operation performed on the virtual hard disk [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the virtual hard disk [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatusStatus { get; set; } + + } + /// The observed state of virtual hard disks + internal partial interface IVirtualHardDiskStatusInternal + + { + /// VirtualHardDisk provisioning error code + string ErrorCode { get; set; } + /// Descriptive error message + string ErrorMessage { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus ProvisioningStatus { get; set; } + /// The ID of the operation performed on the virtual hard disk + string ProvisioningStatusOperationId { get; set; } + /// + /// The status of the operation performed on the virtual hard disk [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatusStatus { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatus.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatus.json.cs new file mode 100644 index 000000000000..fbcc3db3b1b8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatus.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The observed state of virtual hard disks + public partial class VirtualHardDiskStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualHardDiskStatus(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._provisioningStatus ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._provisioningStatus.ToJson(null,serializationMode) : null, "provisioningStatus" ,container.Add ); + AddIf( null != (((object)this._errorCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._errorCode.ToString()) : null, "errorCode" ,container.Add ); + AddIf( null != (((object)this._errorMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._errorMessage.ToString()) : null, "errorMessage" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualHardDiskStatus(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provisioningStatus = If( json?.PropertyT("provisioningStatus"), out var __jsonProvisioningStatus) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskStatusProvisioningStatus.FromJson(__jsonProvisioningStatus) : ProvisioningStatus;} + {_errorCode = If( json?.PropertyT("errorCode"), out var __jsonErrorCode) ? (string)__jsonErrorCode : (string)ErrorCode;} + {_errorMessage = If( json?.PropertyT("errorMessage"), out var __jsonErrorMessage) ? (string)__jsonErrorMessage : (string)ErrorMessage;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatusProvisioningStatus.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatusProvisioningStatus.PowerShell.cs new file mode 100644 index 000000000000..f633ff8b6946 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatusProvisioningStatus.PowerShell.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(VirtualHardDiskStatusProvisioningStatusTypeConverter))] + public partial class VirtualHardDiskStatusProvisioningStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualHardDiskStatusProvisioningStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualHardDiskStatusProvisioningStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualHardDiskStatusProvisioningStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatusInternal)this).OperationId = (string) content.GetValueForProperty("OperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatusInternal)this).OperationId, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatusInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatusInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualHardDiskStatusProvisioningStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatusInternal)this).OperationId = (string) content.GetValueForProperty("OperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatusInternal)this).OperationId, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatusInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatusInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + AfterDeserializePSObject(content); + } + } + [System.ComponentModel.TypeConverter(typeof(VirtualHardDiskStatusProvisioningStatusTypeConverter))] + public partial interface IVirtualHardDiskStatusProvisioningStatus + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatusProvisioningStatus.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatusProvisioningStatus.TypeConverter.cs new file mode 100644 index 000000000000..34d2598641ef --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatusProvisioningStatus.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualHardDiskStatusProvisioningStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualHardDiskStatusProvisioningStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualHardDiskStatusProvisioningStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualHardDiskStatusProvisioningStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatusProvisioningStatus.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatusProvisioningStatus.cs new file mode 100644 index 000000000000..10f84b644703 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatusProvisioningStatus.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class VirtualHardDiskStatusProvisioningStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatusInternal + { + + /// Backing field for property. + private string _operationId; + + /// The ID of the operation performed on the virtual hard disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string OperationId { get => this._operationId; set => this._operationId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? _status; + + /// + /// The status of the operation performed on the virtual hard disk [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? Status { get => this._status; set => this._status = value; } + + /// Creates an new instance. + public VirtualHardDiskStatusProvisioningStatus() + { + + } + } + public partial interface IVirtualHardDiskStatusProvisioningStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The ID of the operation performed on the virtual hard disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the virtual hard disk", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string OperationId { get; set; } + /// + /// The status of the operation performed on the virtual hard disk [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the virtual hard disk [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? Status { get; set; } + + } + internal partial interface IVirtualHardDiskStatusProvisioningStatusInternal + + { + /// The ID of the operation performed on the virtual hard disk + string OperationId { get; set; } + /// + /// The status of the operation performed on the virtual hard disk [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? Status { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatusProvisioningStatus.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatusProvisioningStatus.json.cs new file mode 100644 index 000000000000..21a9b3630ba9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDiskStatusProvisioningStatus.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class VirtualHardDiskStatusProvisioningStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualHardDiskStatusProvisioningStatus(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._operationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._operationId.ToString()) : null, "operationId" ,container.Add ); + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualHardDiskStatusProvisioningStatus(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_operationId = If( json?.PropertyT("operationId"), out var __jsonOperationId) ? (string)__jsonOperationId : (string)OperationId;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)Status;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisks.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisks.PowerShell.cs new file mode 100644 index 000000000000..8b6901301875 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisks.PowerShell.cs @@ -0,0 +1,384 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The virtual hard disk resource definition. + [System.ComponentModel.TypeConverter(typeof(VirtualHardDisksTypeConverter))] + public partial class VirtualHardDisks + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualHardDisks(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualHardDisks(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualHardDisks(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation) content.GetValueForProperty("ExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ExtendedLocationName = (string) content.GetValueForProperty("ExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskStatusTypeConverter.ConvertFrom); + } + if (content.Contains("BlockSizeByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).BlockSizeByte = (int?) content.GetValueForProperty("BlockSizeByte",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).BlockSizeByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("DiskSizeGb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).DiskSizeGb = (long?) content.GetValueForProperty("DiskSizeGb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).DiskSizeGb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("Dynamic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).Dynamic = (bool?) content.GetValueForProperty("Dynamic",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).Dynamic, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LogicalSectorByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).LogicalSectorByte = (int?) content.GetValueForProperty("LogicalSectorByte",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).LogicalSectorByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PhysicalSectorByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).PhysicalSectorByte = (int?) content.GetValueForProperty("PhysicalSectorByte",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).PhysicalSectorByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("HyperVGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).HyperVGeneration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration?) content.GetValueForProperty("HyperVGeneration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).HyperVGeneration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration.CreateFrom); + } + if (content.Contains("DiskFileFormat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).DiskFileFormat = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat?) content.GetValueForProperty("DiskFileFormat",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).DiskFileFormat, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat.CreateFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("ContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ContainerId = (string) content.GetValueForProperty("ContainerId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ContainerId, global::System.Convert.ToString); + } + if (content.Contains("ExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ExtendedLocationType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes?) content.GetValueForProperty("ExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ExtendedLocationType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes.CreateFrom); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualHardDisks(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation) content.GetValueForProperty("ExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ExtendedLocationName = (string) content.GetValueForProperty("ExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskStatusTypeConverter.ConvertFrom); + } + if (content.Contains("BlockSizeByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).BlockSizeByte = (int?) content.GetValueForProperty("BlockSizeByte",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).BlockSizeByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("DiskSizeGb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).DiskSizeGb = (long?) content.GetValueForProperty("DiskSizeGb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).DiskSizeGb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("Dynamic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).Dynamic = (bool?) content.GetValueForProperty("Dynamic",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).Dynamic, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LogicalSectorByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).LogicalSectorByte = (int?) content.GetValueForProperty("LogicalSectorByte",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).LogicalSectorByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PhysicalSectorByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).PhysicalSectorByte = (int?) content.GetValueForProperty("PhysicalSectorByte",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).PhysicalSectorByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("HyperVGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).HyperVGeneration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration?) content.GetValueForProperty("HyperVGeneration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).HyperVGeneration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration.CreateFrom); + } + if (content.Contains("DiskFileFormat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).DiskFileFormat = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat?) content.GetValueForProperty("DiskFileFormat",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).DiskFileFormat, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat.CreateFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("ContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ContainerId = (string) content.GetValueForProperty("ContainerId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ContainerId, global::System.Convert.ToString); + } + if (content.Contains("ExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ExtendedLocationType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes?) content.GetValueForProperty("ExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ExtendedLocationType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes.CreateFrom); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// The virtual hard disk resource definition. + [System.ComponentModel.TypeConverter(typeof(VirtualHardDisksTypeConverter))] + public partial interface IVirtualHardDisks + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisks.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisks.TypeConverter.cs new file mode 100644 index 000000000000..0fa9e185c141 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisks.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualHardDisksTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualHardDisks.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualHardDisks.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualHardDisks.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisks.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisks.cs new file mode 100644 index 000000000000..4a5de3766b98 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisks.cs @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The virtual hard disk resource definition. + public partial class VirtualHardDisks : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResource(); + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public int? BlockSizeByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).BlockSizeByte; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).BlockSizeByte = value ?? default(int); } + + /// Storage ContainerID of the storage container to be used for VHD + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ContainerId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).ContainerId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).ContainerId = value ?? null; } + + /// The format of the actual VHD file [vhd, vhdx] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat? DiskFileFormat { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).DiskFileFormat; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).DiskFileFormat = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat)""); } + + /// Size of the disk in GB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? DiskSizeGb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).DiskSizeGb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).DiskSizeGb = value ?? default(long); } + + /// Boolean for enabling dynamic sizing on the virtual hard disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? Dynamic { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).Dynamic; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).Dynamic = value ?? default(bool); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation _extendedLocation; + + /// The extendedLocation of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation ExtendedLocation { get => (this._extendedLocation = this._extendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation()); set => this._extendedLocation = value; } + + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ExtendedLocationName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Name = value ?? null; } + + /// The type of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? ExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Type = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes)""); } + + /// The hypervisor generation of the Virtual Machine [V1, V2] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration? HyperVGeneration { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).HyperVGeneration; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).HyperVGeneration = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration)""); } + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id; } + + /// The geo-location where the resource lives + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Location = value ; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public int? LogicalSectorByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).LogicalSectorByte; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).LogicalSectorByte = value ?? default(int); } + + /// Internal Acessors for ExtendedLocation + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal.ExtendedLocation { get => (this._extendedLocation = this._extendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation()); set { {_extendedLocation = value;} } } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal.Status { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).Status = value; } + + /// Internal Acessors for StatusProvisioningStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksInternal.StatusProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).StatusProvisioningStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).StatusProvisioningStatus = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Name; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public int? PhysicalSectorByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).PhysicalSectorByte; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).PhysicalSectorByte = value ?? default(int); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskProperties _property; + + /// Properties under the virtual hard disk resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskProperties()); set => this._property = value; } + + /// Provisioning state of the virtual hard disk. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).ProvisioningState; } + + /// + /// The status of the operation performed on the virtual hard disk [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).ProvisioningStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).ProvisioningStatus = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status)""); } + + /// The ID of the operation performed on the virtual hard disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningStatusOperationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).ProvisioningStatusOperationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).ProvisioningStatusOperationId = value ?? null; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// VirtualHardDisk provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).StatusErrorCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).StatusErrorCode = value ?? null; } + + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).StatusErrorMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskPropertiesInternal)Property).StatusErrorMessage = value ?? null; } + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemData; } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataCreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).SystemDataLastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)__trackedResource).Tag = value ?? null /* model class */; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__trackedResource).Type; } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__trackedResource), __trackedResource); + await eventListener.AssertObjectIsValid(nameof(__trackedResource), __trackedResource); + } + + /// Creates an new instance. + public VirtualHardDisks() + { + + } + } + /// The virtual hard disk resource definition. + public partial interface IVirtualHardDisks : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource + { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"blockSizeBytes", + PossibleTypes = new [] { typeof(int) })] + int? BlockSizeByte { get; set; } + /// Storage ContainerID of the storage container to be used for VHD + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Storage ContainerID of the storage container to be used for VHD", + SerializedName = @"containerId", + PossibleTypes = new [] { typeof(string) })] + string ContainerId { get; set; } + /// The format of the actual VHD file [vhd, vhdx] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The format of the actual VHD file [vhd, vhdx]", + SerializedName = @"diskFileFormat", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat? DiskFileFormat { get; set; } + /// Size of the disk in GB + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Size of the disk in GB", + SerializedName = @"diskSizeGB", + PossibleTypes = new [] { typeof(long) })] + long? DiskSizeGb { get; set; } + /// Boolean for enabling dynamic sizing on the virtual hard disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Boolean for enabling dynamic sizing on the virtual hard disk", + SerializedName = @"dynamic", + PossibleTypes = new [] { typeof(bool) })] + bool? Dynamic { get; set; } + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string ExtendedLocationName { get; set; } + /// The type of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the extended location.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? ExtendedLocationType { get; set; } + /// The hypervisor generation of the Virtual Machine [V1, V2] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The hypervisor generation of the Virtual Machine [V1, V2]", + SerializedName = @"hyperVGeneration", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration? HyperVGeneration { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"logicalSectorBytes", + PossibleTypes = new [] { typeof(int) })] + int? LogicalSectorByte { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"physicalSectorBytes", + PossibleTypes = new [] { typeof(int) })] + int? PhysicalSectorByte { get; set; } + /// Provisioning state of the virtual hard disk. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Provisioning state of the virtual hard disk.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; } + /// + /// The status of the operation performed on the virtual hard disk [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the virtual hard disk [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the virtual hard disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the virtual hard disk", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusOperationId { get; set; } + /// VirtualHardDisk provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VirtualHardDisk provisioning error code", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorCode { get; set; } + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Descriptive error message", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorMessage { get; set; } + + } + /// The virtual hard disk resource definition. + internal partial interface IVirtualHardDisksInternal : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal + { + int? BlockSizeByte { get; set; } + /// Storage ContainerID of the storage container to be used for VHD + string ContainerId { get; set; } + /// The format of the actual VHD file [vhd, vhdx] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat? DiskFileFormat { get; set; } + /// Size of the disk in GB + long? DiskSizeGb { get; set; } + /// Boolean for enabling dynamic sizing on the virtual hard disk + bool? Dynamic { get; set; } + /// The extendedLocation of the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation ExtendedLocation { get; set; } + /// The name of the extended location. + string ExtendedLocationName { get; set; } + /// The type of the extended location. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? ExtendedLocationType { get; set; } + /// The hypervisor generation of the Virtual Machine [V1, V2] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration? HyperVGeneration { get; set; } + + int? LogicalSectorByte { get; set; } + + int? PhysicalSectorByte { get; set; } + /// Properties under the virtual hard disk resource + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskProperties Property { get; set; } + /// Provisioning state of the virtual hard disk. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; set; } + /// + /// The status of the operation performed on the virtual hard disk [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the virtual hard disk + string ProvisioningStatusOperationId { get; set; } + /// The observed state of virtual hard disks + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatus Status { get; set; } + /// VirtualHardDisk provisioning error code + string StatusErrorCode { get; set; } + /// Descriptive error message + string StatusErrorMessage { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDiskStatusProvisioningStatus StatusProvisioningStatus { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisks.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisks.json.cs new file mode 100644 index 000000000000..79fa05ceb000 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisks.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The virtual hard disk resource definition. + public partial class VirtualHardDisks + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualHardDisks(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __trackedResource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != this._extendedLocation ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._extendedLocation.ToJson(null,serializationMode) : null, "extendedLocation" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualHardDisks(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDiskProperties.FromJson(__jsonProperties) : Property;} + {_extendedLocation = If( json?.PropertyT("extendedLocation"), out var __jsonExtendedLocation) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation.FromJson(__jsonExtendedLocation) : ExtendedLocation;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksListResult.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksListResult.PowerShell.cs new file mode 100644 index 000000000000..dc6cdd94e6ae --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksListResult.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(VirtualHardDisksListResultTypeConverter))] + public partial class VirtualHardDisksListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualHardDisksListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualHardDisksListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualHardDisksListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisksTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualHardDisksListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisksTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + [System.ComponentModel.TypeConverter(typeof(VirtualHardDisksListResultTypeConverter))] + public partial interface IVirtualHardDisksListResult + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksListResult.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksListResult.TypeConverter.cs new file mode 100644 index 000000000000..2a15eaff7b2e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksListResult.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualHardDisksListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualHardDisksListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualHardDisksListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualHardDisksListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksListResult.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksListResult.cs new file mode 100644 index 000000000000..c568a7608f64 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksListResult.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class VirtualHardDisksListResult : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksListResult, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks[] _value; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public VirtualHardDisksListResult() + { + + } + } + public partial interface IVirtualHardDisksListResult : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks[] Value { get; set; } + + } + internal partial interface IVirtualHardDisksListResultInternal + + { + string NextLink { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksListResult.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksListResult.json.cs new file mode 100644 index 000000000000..848336fa8cf1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksListResult.json.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class VirtualHardDisksListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualHardDisksListResult(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualHardDisksListResult(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisks.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequest.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequest.PowerShell.cs new file mode 100644 index 000000000000..04d88da93d3c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequest.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The virtual hard disk resource patch definition. + [System.ComponentModel.TypeConverter(typeof(VirtualHardDisksUpdateRequestTypeConverter))] + public partial class VirtualHardDisksUpdateRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualHardDisksUpdateRequest(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualHardDisksUpdateRequest(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualHardDisksUpdateRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisksUpdateRequestTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualHardDisksUpdateRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisksUpdateRequestTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + } + /// The virtual hard disk resource patch definition. + [System.ComponentModel.TypeConverter(typeof(VirtualHardDisksUpdateRequestTypeConverter))] + public partial interface IVirtualHardDisksUpdateRequest + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequest.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequest.TypeConverter.cs new file mode 100644 index 000000000000..18eca2048834 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequest.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualHardDisksUpdateRequestTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualHardDisksUpdateRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualHardDisksUpdateRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualHardDisksUpdateRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequest.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequest.cs new file mode 100644 index 000000000000..7e820683d8c3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequest.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The virtual hard disk resource patch definition. + public partial class VirtualHardDisksUpdateRequest : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequest, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags _tag; + + /// Resource tags + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisksUpdateRequestTags()); set => this._tag = value; } + + /// Creates an new instance. + public VirtualHardDisksUpdateRequest() + { + + } + } + /// The virtual hard disk resource patch definition. + public partial interface IVirtualHardDisksUpdateRequest : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Resource tags + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags Tag { get; set; } + + } + /// The virtual hard disk resource patch definition. + internal partial interface IVirtualHardDisksUpdateRequestInternal + + { + /// Resource tags + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequest.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequest.json.cs new file mode 100644 index 000000000000..1e12f3f62193 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequest.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The virtual hard disk resource patch definition. + public partial class VirtualHardDisksUpdateRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualHardDisksUpdateRequest(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualHardDisksUpdateRequest(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisksUpdateRequestTags.FromJson(__jsonTags) : Tag;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequestTags.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequestTags.PowerShell.cs new file mode 100644 index 000000000000..6bedc1cdddd6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequestTags.PowerShell.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Resource tags + [System.ComponentModel.TypeConverter(typeof(VirtualHardDisksUpdateRequestTagsTypeConverter))] + public partial class VirtualHardDisksUpdateRequestTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualHardDisksUpdateRequestTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualHardDisksUpdateRequestTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualHardDisksUpdateRequestTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualHardDisksUpdateRequestTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + } + /// Resource tags + [System.ComponentModel.TypeConverter(typeof(VirtualHardDisksUpdateRequestTagsTypeConverter))] + public partial interface IVirtualHardDisksUpdateRequestTags + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequestTags.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequestTags.TypeConverter.cs new file mode 100644 index 000000000000..1a712dd56649 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequestTags.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualHardDisksUpdateRequestTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualHardDisksUpdateRequestTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualHardDisksUpdateRequestTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualHardDisksUpdateRequestTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequestTags.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequestTags.cs new file mode 100644 index 000000000000..e7f69ab13b74 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequestTags.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Resource tags + public partial class VirtualHardDisksUpdateRequestTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTagsInternal + { + + /// Creates an new instance. + public VirtualHardDisksUpdateRequestTags() + { + + } + } + /// Resource tags + public partial interface IVirtualHardDisksUpdateRequestTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + + } + /// Resource tags + internal partial interface IVirtualHardDisksUpdateRequestTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequestTags.dictionary.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequestTags.dictionary.cs new file mode 100644 index 000000000000..fd5640d9cd26 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequestTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class VirtualHardDisksUpdateRequestTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisksUpdateRequestTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequestTags.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequestTags.json.cs new file mode 100644 index 000000000000..083a25c0e956 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualHardDisksUpdateRequestTags.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Resource tags + public partial class VirtualHardDisksUpdateRequestTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualHardDisksUpdateRequestTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + /// + internal VirtualHardDisksUpdateRequestTags(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineConfigAgentInstanceView.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineConfigAgentInstanceView.PowerShell.cs new file mode 100644 index 000000000000..e5904fdf5f7d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineConfigAgentInstanceView.PowerShell.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The instance view of the VM Config Agent running on the virtual machine. + [System.ComponentModel.TypeConverter(typeof(VirtualMachineConfigAgentInstanceViewTypeConverter))] + public partial class VirtualMachineConfigAgentInstanceView + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineConfigAgentInstanceView(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineConfigAgentInstanceView(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineConfigAgentInstanceView(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VMConfigAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceViewInternal)this).VMConfigAgentVersion = (string) content.GetValueForProperty("VMConfigAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceViewInternal)this).VMConfigAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("Statuses")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceViewInternal)this).Statuses = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus[]) content.GetValueForProperty("Statuses",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceViewInternal)this).Statuses, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.InstanceViewStatusTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineConfigAgentInstanceView(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VMConfigAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceViewInternal)this).VMConfigAgentVersion = (string) content.GetValueForProperty("VMConfigAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceViewInternal)this).VMConfigAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("Statuses")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceViewInternal)this).Statuses = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus[]) content.GetValueForProperty("Statuses",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceViewInternal)this).Statuses, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.InstanceViewStatusTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + } + /// The instance view of the VM Config Agent running on the virtual machine. + [System.ComponentModel.TypeConverter(typeof(VirtualMachineConfigAgentInstanceViewTypeConverter))] + public partial interface IVirtualMachineConfigAgentInstanceView + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineConfigAgentInstanceView.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineConfigAgentInstanceView.TypeConverter.cs new file mode 100644 index 000000000000..00ff5f78dce7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineConfigAgentInstanceView.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineConfigAgentInstanceViewTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineConfigAgentInstanceView.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineConfigAgentInstanceView.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineConfigAgentInstanceView.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineConfigAgentInstanceView.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineConfigAgentInstanceView.cs new file mode 100644 index 000000000000..b51496c384e6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineConfigAgentInstanceView.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The instance view of the VM Config Agent running on the virtual machine. + public partial class VirtualMachineConfigAgentInstanceView : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceViewInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus[] _statuses; + + /// The resource status information. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus[] Statuses { get => this._statuses; set => this._statuses = value; } + + /// Backing field for property. + private string _vMConfigAgentVersion; + + /// The VM Config Agent full version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string VMConfigAgentVersion { get => this._vMConfigAgentVersion; set => this._vMConfigAgentVersion = value; } + + /// Creates an new instance. + public VirtualMachineConfigAgentInstanceView() + { + + } + } + /// The instance view of the VM Config Agent running on the virtual machine. + public partial interface IVirtualMachineConfigAgentInstanceView : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The resource status information. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource status information.", + SerializedName = @"statuses", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus[] Statuses { get; set; } + /// The VM Config Agent full version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The VM Config Agent full version.", + SerializedName = @"vmConfigAgentVersion", + PossibleTypes = new [] { typeof(string) })] + string VMConfigAgentVersion { get; set; } + + } + /// The instance view of the VM Config Agent running on the virtual machine. + internal partial interface IVirtualMachineConfigAgentInstanceViewInternal + + { + /// The resource status information. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus[] Statuses { get; set; } + /// The VM Config Agent full version. + string VMConfigAgentVersion { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineConfigAgentInstanceView.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineConfigAgentInstanceView.json.cs new file mode 100644 index 000000000000..ee44fb75314f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineConfigAgentInstanceView.json.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The instance view of the VM Config Agent running on the virtual machine. + public partial class VirtualMachineConfigAgentInstanceView + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualMachineConfigAgentInstanceView(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._vMConfigAgentVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._vMConfigAgentVersion.ToString()) : null, "vmConfigAgentVersion" ,container.Add ); + if (null != this._statuses) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._statuses ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("statuses",__w); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineConfigAgentInstanceView(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_vMConfigAgentVersion = If( json?.PropertyT("vmConfigAgentVersion"), out var __jsonVMConfigAgentVersion) ? (string)__jsonVMConfigAgentVersion : (string)VMConfigAgentVersion;} + {_statuses = If( json?.PropertyT("statuses"), out var __jsonStatuses) ? If( __jsonStatuses as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.InstanceViewStatus.FromJson(__u) )) ))() : null : Statuses;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstance.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstance.PowerShell.cs new file mode 100644 index 000000000000..a36a7cd60b29 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstance.PowerShell.cs @@ -0,0 +1,802 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The virtual machine instance resource definition. + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstanceTypeConverter))] + public partial class VirtualMachineInstance + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineInstance(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineInstance(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineInstance(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation) content.GetValueForProperty("ExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("Identity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IdentityTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ExtendedLocationName = (string) content.GetValueForProperty("ExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("IdentityPrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).IdentityPrincipalId = (string) content.GetValueForProperty("IdentityPrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).IdentityPrincipalId, global::System.Convert.ToString); + } + if (content.Contains("IdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).IdentityTenantId = (string) content.GetValueForProperty("IdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).IdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("HardwareProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HardwareProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfile) content.GetValueForProperty("HardwareProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HardwareProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesHardwareProfileTypeConverter.ConvertFrom); + } + if (content.Contains("NetworkProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).NetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfile) content.GetValueForProperty("NetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).NetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesNetworkProfileTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfile) content.GetValueForProperty("OSProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileTypeConverter.ConvertFrom); + } + if (content.Contains("SecurityProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).SecurityProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfile) content.GetValueForProperty("SecurityProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).SecurityProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesSecurityProfileTypeConverter.ConvertFrom); + } + if (content.Contains("StorageProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StorageProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfile) content.GetValueForProperty("StorageProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StorageProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileTypeConverter.ConvertFrom); + } + if (content.Contains("HttpProxyConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HttpProxyConfig = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfiguration) content.GetValueForProperty("HttpProxyConfig",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HttpProxyConfig, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HttpProxyConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceView")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).InstanceView = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceView) content.GetValueForProperty("InstanceView",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).InstanceView, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceViewTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceStatusTypeConverter.ConvertFrom); + } + if (content.Contains("PropertiesGuestAgentInstallStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).PropertiesGuestAgentInstallStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatus) content.GetValueForProperty("PropertiesGuestAgentInstallStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).PropertiesGuestAgentInstallStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgentInstallStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("ResourceUid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ResourceUid = (string) content.GetValueForProperty("ResourceUid",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ResourceUid, global::System.Convert.ToString); + } + if (content.Contains("GuestAgentInstallStatusVMUuid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).GuestAgentInstallStatusVMUuid = (string) content.GetValueForProperty("GuestAgentInstallStatusVMUuid",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).GuestAgentInstallStatusVMUuid, global::System.Convert.ToString); + } + if (content.Contains("GuestAgentInstallStatusAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).GuestAgentInstallStatusAgentVersion = (string) content.GetValueForProperty("GuestAgentInstallStatusAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).GuestAgentInstallStatusAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("GuestAgentInstallStatusErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).GuestAgentInstallStatusErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[]) content.GetValueForProperty("GuestAgentInstallStatusErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).GuestAgentInstallStatusErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("ExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ExtendedLocationType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes?) content.GetValueForProperty("ExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ExtendedLocationType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes.CreateFrom); + } + if (content.Contains("IdentityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).IdentityType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType?) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).IdentityType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType.CreateFrom); + } + if (content.Contains("HardwareProfileDynamicMemoryConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HardwareProfileDynamicMemoryConfig = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig) content.GetValueForProperty("HardwareProfileDynamicMemoryConfig",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HardwareProfileDynamicMemoryConfig, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigTypeConverter.ConvertFrom); + } + if (content.Contains("HardwareProfileVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HardwareProfileVMSize = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum?) content.GetValueForProperty("HardwareProfileVMSize",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HardwareProfileVMSize, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum.CreateFrom); + } + if (content.Contains("HardwareProfileProcessor")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HardwareProfileProcessor = (int?) content.GetValueForProperty("HardwareProfileProcessor",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HardwareProfileProcessor, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("HardwareProfileMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HardwareProfileMemoryMb = (long?) content.GetValueForProperty("HardwareProfileMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HardwareProfileMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("NetworkProfileNetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).NetworkProfileNetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem[]) content.GetValueForProperty("NetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).NetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItemTypeConverter.ConvertFrom)); + } + if (content.Contains("OSProfileLinuxConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfileLinuxConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration) content.GetValueForProperty("OSProfileLinuxConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfileLinuxConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileLinuxConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileWindowsConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfileWindowsConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration) content.GetValueForProperty("OSProfileWindowsConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfileWindowsConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileWindowsConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileAdminPassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfileAdminPassword = (string) content.GetValueForProperty("OSProfileAdminPassword",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfileAdminPassword, global::System.Convert.ToString); + } + if (content.Contains("OSProfileAdminUsername")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfileAdminUsername = (string) content.GetValueForProperty("OSProfileAdminUsername",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfileAdminUsername, global::System.Convert.ToString); + } + if (content.Contains("OSProfileComputerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfileComputerName = (string) content.GetValueForProperty("OSProfileComputerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfileComputerName, global::System.Convert.ToString); + } + if (content.Contains("SecurityProfileUefiSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).SecurityProfileUefiSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings) content.GetValueForProperty("SecurityProfileUefiSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).SecurityProfileUefiSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesSecurityProfileUefiSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("SecurityProfileEnableTpm")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).SecurityProfileEnableTpm = (bool?) content.GetValueForProperty("SecurityProfileEnableTpm",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).SecurityProfileEnableTpm, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("SecurityProfileSecurityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).SecurityProfileSecurityType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes?) content.GetValueForProperty("SecurityProfileSecurityType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).SecurityProfileSecurityType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes.CreateFrom); + } + if (content.Contains("StorageProfileImageReference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StorageProfileImageReference = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference) content.GetValueForProperty("StorageProfileImageReference",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StorageProfileImageReference, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileImageReferenceTypeConverter.ConvertFrom); + } + if (content.Contains("StorageProfileOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StorageProfileOSDisk = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk) content.GetValueForProperty("StorageProfileOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StorageProfileOSDisk, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileOSDiskTypeConverter.ConvertFrom); + } + if (content.Contains("StorageProfileDataDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StorageProfileDataDisk = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem[]) content.GetValueForProperty("StorageProfileDataDisk",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StorageProfileDataDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileDataDisksItemTypeConverter.ConvertFrom)); + } + if (content.Contains("StorageProfileVMConfigStoragePathId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StorageProfileVMConfigStoragePathId = (string) content.GetValueForProperty("StorageProfileVMConfigStoragePathId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StorageProfileVMConfigStoragePathId, global::System.Convert.ToString); + } + if (content.Contains("HttpProxyConfigHttpProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HttpProxyConfigHttpProxy = (string) content.GetValueForProperty("HttpProxyConfigHttpProxy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HttpProxyConfigHttpProxy, global::System.Convert.ToString); + } + if (content.Contains("HttpProxyConfigHttpsProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HttpProxyConfigHttpsProxy = (string) content.GetValueForProperty("HttpProxyConfigHttpsProxy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HttpProxyConfigHttpsProxy, global::System.Convert.ToString); + } + if (content.Contains("HttpProxyConfigNoProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HttpProxyConfigNoProxy = (string[]) content.GetValueForProperty("HttpProxyConfigNoProxy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HttpProxyConfigNoProxy, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("HttpProxyConfigTrustedCa")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HttpProxyConfigTrustedCa = (string) content.GetValueForProperty("HttpProxyConfigTrustedCa",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HttpProxyConfigTrustedCa, global::System.Convert.ToString); + } + if (content.Contains("InstanceViewVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).InstanceViewVMAgent = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView) content.GetValueForProperty("InstanceViewVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).InstanceViewVMAgent, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineConfigAgentInstanceViewTypeConverter.ConvertFrom); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusPowerState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StatusPowerState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum?) content.GetValueForProperty("StatusPowerState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StatusPowerState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum.CreateFrom); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("PropertiesGuestAgentInstallStatusStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).PropertiesGuestAgentInstallStatusStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes?) content.GetValueForProperty("PropertiesGuestAgentInstallStatusStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).PropertiesGuestAgentInstallStatusStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes.CreateFrom); + } + if (content.Contains("GuestAgentInstallStatusLastStatusChange")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).GuestAgentInstallStatusLastStatusChange = (global::System.DateTime?) content.GetValueForProperty("GuestAgentInstallStatusLastStatusChange",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).GuestAgentInstallStatusLastStatusChange, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("DynamicMemoryConfigMaximumMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).DynamicMemoryConfigMaximumMemoryMb = (long?) content.GetValueForProperty("DynamicMemoryConfigMaximumMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).DynamicMemoryConfigMaximumMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DynamicMemoryConfigMinimumMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).DynamicMemoryConfigMinimumMemoryMb = (long?) content.GetValueForProperty("DynamicMemoryConfigMinimumMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).DynamicMemoryConfigMinimumMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DynamicMemoryConfigTargetMemoryBuffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).DynamicMemoryConfigTargetMemoryBuffer = (int?) content.GetValueForProperty("DynamicMemoryConfigTargetMemoryBuffer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).DynamicMemoryConfigTargetMemoryBuffer, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("LinuxConfigurationSsh")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).LinuxConfigurationSsh = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration) content.GetValueForProperty("LinuxConfigurationSsh",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).LinuxConfigurationSsh, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("LinuxConfigurationDisablePasswordAuthentication")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).LinuxConfigurationDisablePasswordAuthentication = (bool?) content.GetValueForProperty("LinuxConfigurationDisablePasswordAuthentication",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).LinuxConfigurationDisablePasswordAuthentication, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LinuxConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).LinuxConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).LinuxConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LinuxConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).LinuxConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).LinuxConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationSsh")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowConfigurationSsh = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration) content.GetValueForProperty("WindowConfigurationSsh",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowConfigurationSsh, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("WindowConfigurationEnableAutomaticUpdate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowConfigurationEnableAutomaticUpdate = (bool?) content.GetValueForProperty("WindowConfigurationEnableAutomaticUpdate",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowConfigurationEnableAutomaticUpdate, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationTimeZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowConfigurationTimeZone = (string) content.GetValueForProperty("WindowConfigurationTimeZone",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowConfigurationTimeZone, global::System.Convert.ToString); + } + if (content.Contains("WindowConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("UefiSettingSecureBootEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).UefiSettingSecureBootEnabled = (bool?) content.GetValueForProperty("UefiSettingSecureBootEnabled",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).UefiSettingSecureBootEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ImageReferenceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ImageReferenceId = (string) content.GetValueForProperty("ImageReferenceId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ImageReferenceId, global::System.Convert.ToString); + } + if (content.Contains("OSDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSDiskId = (string) content.GetValueForProperty("OSDiskId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSDiskId, global::System.Convert.ToString); + } + if (content.Contains("OSDiskOstype")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSDiskOstype = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes?) content.GetValueForProperty("OSDiskOstype",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSDiskOstype, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes.CreateFrom); + } + if (content.Contains("VMAgentVmconfigAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).VMAgentVmconfigAgentVersion = (string) content.GetValueForProperty("VMAgentVmconfigAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).VMAgentVmconfigAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("VMAgentStatuses")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).VMAgentStatuses = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus[]) content.GetValueForProperty("VMAgentStatuses",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).VMAgentStatuses, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.InstanceViewStatusTypeConverter.ConvertFrom)); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + if (content.Contains("LinuxConfigurationSshPublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).LinuxConfigurationSshPublicKey = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]) content.GetValueForProperty("LinuxConfigurationSshPublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).LinuxConfigurationSshPublicKey, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshPublicKeyTypeConverter.ConvertFrom)); + } + if (content.Contains("WindowsConfigurationSshPublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowsConfigurationSshPublicKey = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]) content.GetValueForProperty("WindowsConfigurationSshPublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowsConfigurationSshPublicKey, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshPublicKeyTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineInstance(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation) content.GetValueForProperty("ExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("Identity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IdentityTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ExtendedLocationName = (string) content.GetValueForProperty("ExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("IdentityPrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).IdentityPrincipalId = (string) content.GetValueForProperty("IdentityPrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).IdentityPrincipalId, global::System.Convert.ToString); + } + if (content.Contains("IdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).IdentityTenantId = (string) content.GetValueForProperty("IdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).IdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("HardwareProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HardwareProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfile) content.GetValueForProperty("HardwareProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HardwareProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesHardwareProfileTypeConverter.ConvertFrom); + } + if (content.Contains("NetworkProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).NetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfile) content.GetValueForProperty("NetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).NetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesNetworkProfileTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfile) content.GetValueForProperty("OSProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileTypeConverter.ConvertFrom); + } + if (content.Contains("SecurityProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).SecurityProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfile) content.GetValueForProperty("SecurityProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).SecurityProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesSecurityProfileTypeConverter.ConvertFrom); + } + if (content.Contains("StorageProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StorageProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfile) content.GetValueForProperty("StorageProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StorageProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileTypeConverter.ConvertFrom); + } + if (content.Contains("HttpProxyConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HttpProxyConfig = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfiguration) content.GetValueForProperty("HttpProxyConfig",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HttpProxyConfig, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HttpProxyConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceView")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).InstanceView = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceView) content.GetValueForProperty("InstanceView",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).InstanceView, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceViewTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceStatusTypeConverter.ConvertFrom); + } + if (content.Contains("PropertiesGuestAgentInstallStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).PropertiesGuestAgentInstallStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatus) content.GetValueForProperty("PropertiesGuestAgentInstallStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).PropertiesGuestAgentInstallStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgentInstallStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("ResourceUid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ResourceUid = (string) content.GetValueForProperty("ResourceUid",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ResourceUid, global::System.Convert.ToString); + } + if (content.Contains("GuestAgentInstallStatusVMUuid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).GuestAgentInstallStatusVMUuid = (string) content.GetValueForProperty("GuestAgentInstallStatusVMUuid",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).GuestAgentInstallStatusVMUuid, global::System.Convert.ToString); + } + if (content.Contains("GuestAgentInstallStatusAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).GuestAgentInstallStatusAgentVersion = (string) content.GetValueForProperty("GuestAgentInstallStatusAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).GuestAgentInstallStatusAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("GuestAgentInstallStatusErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).GuestAgentInstallStatusErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[]) content.GetValueForProperty("GuestAgentInstallStatusErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).GuestAgentInstallStatusErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("ExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ExtendedLocationType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes?) content.GetValueForProperty("ExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ExtendedLocationType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes.CreateFrom); + } + if (content.Contains("IdentityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).IdentityType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType?) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).IdentityType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType.CreateFrom); + } + if (content.Contains("HardwareProfileDynamicMemoryConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HardwareProfileDynamicMemoryConfig = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig) content.GetValueForProperty("HardwareProfileDynamicMemoryConfig",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HardwareProfileDynamicMemoryConfig, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigTypeConverter.ConvertFrom); + } + if (content.Contains("HardwareProfileVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HardwareProfileVMSize = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum?) content.GetValueForProperty("HardwareProfileVMSize",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HardwareProfileVMSize, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum.CreateFrom); + } + if (content.Contains("HardwareProfileProcessor")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HardwareProfileProcessor = (int?) content.GetValueForProperty("HardwareProfileProcessor",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HardwareProfileProcessor, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("HardwareProfileMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HardwareProfileMemoryMb = (long?) content.GetValueForProperty("HardwareProfileMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HardwareProfileMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("NetworkProfileNetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).NetworkProfileNetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem[]) content.GetValueForProperty("NetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).NetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItemTypeConverter.ConvertFrom)); + } + if (content.Contains("OSProfileLinuxConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfileLinuxConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration) content.GetValueForProperty("OSProfileLinuxConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfileLinuxConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileLinuxConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileWindowsConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfileWindowsConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration) content.GetValueForProperty("OSProfileWindowsConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfileWindowsConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileWindowsConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileAdminPassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfileAdminPassword = (string) content.GetValueForProperty("OSProfileAdminPassword",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfileAdminPassword, global::System.Convert.ToString); + } + if (content.Contains("OSProfileAdminUsername")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfileAdminUsername = (string) content.GetValueForProperty("OSProfileAdminUsername",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfileAdminUsername, global::System.Convert.ToString); + } + if (content.Contains("OSProfileComputerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfileComputerName = (string) content.GetValueForProperty("OSProfileComputerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSProfileComputerName, global::System.Convert.ToString); + } + if (content.Contains("SecurityProfileUefiSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).SecurityProfileUefiSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings) content.GetValueForProperty("SecurityProfileUefiSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).SecurityProfileUefiSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesSecurityProfileUefiSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("SecurityProfileEnableTpm")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).SecurityProfileEnableTpm = (bool?) content.GetValueForProperty("SecurityProfileEnableTpm",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).SecurityProfileEnableTpm, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("SecurityProfileSecurityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).SecurityProfileSecurityType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes?) content.GetValueForProperty("SecurityProfileSecurityType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).SecurityProfileSecurityType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes.CreateFrom); + } + if (content.Contains("StorageProfileImageReference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StorageProfileImageReference = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference) content.GetValueForProperty("StorageProfileImageReference",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StorageProfileImageReference, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileImageReferenceTypeConverter.ConvertFrom); + } + if (content.Contains("StorageProfileOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StorageProfileOSDisk = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk) content.GetValueForProperty("StorageProfileOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StorageProfileOSDisk, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileOSDiskTypeConverter.ConvertFrom); + } + if (content.Contains("StorageProfileDataDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StorageProfileDataDisk = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem[]) content.GetValueForProperty("StorageProfileDataDisk",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StorageProfileDataDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileDataDisksItemTypeConverter.ConvertFrom)); + } + if (content.Contains("StorageProfileVMConfigStoragePathId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StorageProfileVMConfigStoragePathId = (string) content.GetValueForProperty("StorageProfileVMConfigStoragePathId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StorageProfileVMConfigStoragePathId, global::System.Convert.ToString); + } + if (content.Contains("HttpProxyConfigHttpProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HttpProxyConfigHttpProxy = (string) content.GetValueForProperty("HttpProxyConfigHttpProxy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HttpProxyConfigHttpProxy, global::System.Convert.ToString); + } + if (content.Contains("HttpProxyConfigHttpsProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HttpProxyConfigHttpsProxy = (string) content.GetValueForProperty("HttpProxyConfigHttpsProxy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HttpProxyConfigHttpsProxy, global::System.Convert.ToString); + } + if (content.Contains("HttpProxyConfigNoProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HttpProxyConfigNoProxy = (string[]) content.GetValueForProperty("HttpProxyConfigNoProxy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HttpProxyConfigNoProxy, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("HttpProxyConfigTrustedCa")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HttpProxyConfigTrustedCa = (string) content.GetValueForProperty("HttpProxyConfigTrustedCa",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).HttpProxyConfigTrustedCa, global::System.Convert.ToString); + } + if (content.Contains("InstanceViewVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).InstanceViewVMAgent = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView) content.GetValueForProperty("InstanceViewVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).InstanceViewVMAgent, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineConfigAgentInstanceViewTypeConverter.ConvertFrom); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusPowerState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StatusPowerState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum?) content.GetValueForProperty("StatusPowerState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).StatusPowerState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum.CreateFrom); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("PropertiesGuestAgentInstallStatusStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).PropertiesGuestAgentInstallStatusStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes?) content.GetValueForProperty("PropertiesGuestAgentInstallStatusStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).PropertiesGuestAgentInstallStatusStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes.CreateFrom); + } + if (content.Contains("GuestAgentInstallStatusLastStatusChange")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).GuestAgentInstallStatusLastStatusChange = (global::System.DateTime?) content.GetValueForProperty("GuestAgentInstallStatusLastStatusChange",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).GuestAgentInstallStatusLastStatusChange, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("DynamicMemoryConfigMaximumMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).DynamicMemoryConfigMaximumMemoryMb = (long?) content.GetValueForProperty("DynamicMemoryConfigMaximumMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).DynamicMemoryConfigMaximumMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DynamicMemoryConfigMinimumMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).DynamicMemoryConfigMinimumMemoryMb = (long?) content.GetValueForProperty("DynamicMemoryConfigMinimumMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).DynamicMemoryConfigMinimumMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DynamicMemoryConfigTargetMemoryBuffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).DynamicMemoryConfigTargetMemoryBuffer = (int?) content.GetValueForProperty("DynamicMemoryConfigTargetMemoryBuffer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).DynamicMemoryConfigTargetMemoryBuffer, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("LinuxConfigurationSsh")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).LinuxConfigurationSsh = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration) content.GetValueForProperty("LinuxConfigurationSsh",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).LinuxConfigurationSsh, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("LinuxConfigurationDisablePasswordAuthentication")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).LinuxConfigurationDisablePasswordAuthentication = (bool?) content.GetValueForProperty("LinuxConfigurationDisablePasswordAuthentication",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).LinuxConfigurationDisablePasswordAuthentication, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LinuxConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).LinuxConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).LinuxConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LinuxConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).LinuxConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).LinuxConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationSsh")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowConfigurationSsh = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration) content.GetValueForProperty("WindowConfigurationSsh",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowConfigurationSsh, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("WindowConfigurationEnableAutomaticUpdate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowConfigurationEnableAutomaticUpdate = (bool?) content.GetValueForProperty("WindowConfigurationEnableAutomaticUpdate",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowConfigurationEnableAutomaticUpdate, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationTimeZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowConfigurationTimeZone = (string) content.GetValueForProperty("WindowConfigurationTimeZone",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowConfigurationTimeZone, global::System.Convert.ToString); + } + if (content.Contains("WindowConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("UefiSettingSecureBootEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).UefiSettingSecureBootEnabled = (bool?) content.GetValueForProperty("UefiSettingSecureBootEnabled",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).UefiSettingSecureBootEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ImageReferenceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ImageReferenceId = (string) content.GetValueForProperty("ImageReferenceId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ImageReferenceId, global::System.Convert.ToString); + } + if (content.Contains("OSDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSDiskId = (string) content.GetValueForProperty("OSDiskId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSDiskId, global::System.Convert.ToString); + } + if (content.Contains("OSDiskOstype")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSDiskOstype = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes?) content.GetValueForProperty("OSDiskOstype",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).OSDiskOstype, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes.CreateFrom); + } + if (content.Contains("VMAgentVmconfigAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).VMAgentVmconfigAgentVersion = (string) content.GetValueForProperty("VMAgentVmconfigAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).VMAgentVmconfigAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("VMAgentStatuses")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).VMAgentStatuses = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus[]) content.GetValueForProperty("VMAgentStatuses",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).VMAgentStatuses, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.InstanceViewStatusTypeConverter.ConvertFrom)); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + if (content.Contains("LinuxConfigurationSshPublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).LinuxConfigurationSshPublicKey = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]) content.GetValueForProperty("LinuxConfigurationSshPublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).LinuxConfigurationSshPublicKey, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshPublicKeyTypeConverter.ConvertFrom)); + } + if (content.Contains("WindowsConfigurationSshPublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowsConfigurationSshPublicKey = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]) content.GetValueForProperty("WindowsConfigurationSshPublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal)this).WindowsConfigurationSshPublicKey, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshPublicKeyTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + } + /// The virtual machine instance resource definition. + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstanceTypeConverter))] + public partial interface IVirtualMachineInstance + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstance.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstance.TypeConverter.cs new file mode 100644 index 000000000000..53f228175a0a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstance.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineInstanceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineInstance.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineInstance.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineInstance.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstance.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstance.cs new file mode 100644 index 000000000000..1b25311e1e08 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstance.cs @@ -0,0 +1,1076 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The virtual machine instance resource definition. + public partial class VirtualMachineInstance : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Resource(); + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? DynamicMemoryConfigMaximumMemoryMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).DynamicMemoryConfigMaximumMemoryMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).DynamicMemoryConfigMaximumMemoryMb = value ?? default(long); } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? DynamicMemoryConfigMinimumMemoryMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).DynamicMemoryConfigMinimumMemoryMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).DynamicMemoryConfigMinimumMemoryMb = value ?? default(long); } + + /// + /// Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage + /// of the total memory that the virtual machine instance is thought to need. This only applies to virtual systems with dynamic + /// memory enabled. This property can be in the range of 5 to 2000. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public int? DynamicMemoryConfigTargetMemoryBuffer { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).DynamicMemoryConfigTargetMemoryBuffer; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).DynamicMemoryConfigTargetMemoryBuffer = value ?? default(int); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation _extendedLocation; + + /// The extendedLocation of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation ExtendedLocation { get => (this._extendedLocation = this._extendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation()); set => this._extendedLocation = value; } + + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ExtendedLocationName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Name = value ?? null; } + + /// The type of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? ExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocationInternal)ExtendedLocation).Type = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes)""); } + + /// The hybrid machine agent full version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string GuestAgentInstallStatusAgentVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).GuestAgentInstallStatusAgentVersion; } + + /// Details about the error state. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] GuestAgentInstallStatusErrorDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).GuestAgentInstallStatusErrorDetail; } + + /// The time of the last status change. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public global::System.DateTime? GuestAgentInstallStatusLastStatusChange { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).GuestAgentInstallStatusLastStatusChange; } + + /// Specifies the VM's unique SMBIOS ID. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string GuestAgentInstallStatusVMUuid { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).GuestAgentInstallStatusVMUuid; } + + /// RAM in MB for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? HardwareProfileMemoryMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).HardwareProfileMemoryMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).HardwareProfileMemoryMb = value ?? default(long); } + + /// number of processors for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public int? HardwareProfileProcessor { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).HardwareProfileProcessor; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).HardwareProfileProcessor = value ?? default(int); } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum? HardwareProfileVMSize { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).HardwareProfileVMSize; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).HardwareProfileVMSize = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum)""); } + + /// The HTTP proxy server endpoint to use. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string HttpProxyConfigHttpProxy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).HttpProxyConfigHttpProxy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).HttpProxyConfigHttpProxy = value ?? null; } + + /// The HTTPS proxy server endpoint to use. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string HttpProxyConfigHttpsProxy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).HttpProxyConfigHttpsProxy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).HttpProxyConfigHttpsProxy = value ?? null; } + + /// The endpoints that should not go through proxy. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string[] HttpProxyConfigNoProxy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).HttpProxyConfigNoProxy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).HttpProxyConfigNoProxy = value ?? null /* arrayOf */; } + + /// Alternative CA cert to use for connecting to proxy servers. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string HttpProxyConfigTrustedCa { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).HttpProxyConfigTrustedCa; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).HttpProxyConfigTrustedCa = value ?? null; } + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Id; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity _identity; + + /// Identity for the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity Identity { get => (this._identity = this._identity ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Identity()); set => this._identity = value; } + + /// The principal ID of resource identity. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentityPrincipalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).PrincipalId; } + + /// The tenant ID of resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).TenantId; } + + /// The identity type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).Type = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType)""); } + + /// Resource ID of the image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ImageReferenceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).ImageReferenceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).ImageReferenceId = value ?? null; } + + /// + /// DisablePasswordAuthentication - whether password authentication should be disabled + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? LinuxConfigurationDisablePasswordAuthentication { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).LinuxConfigurationDisablePasswordAuthentication; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).LinuxConfigurationDisablePasswordAuthentication = value ?? default(bool); } + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? LinuxConfigurationProvisionVMAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).LinuxConfigurationProvisionVMAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).LinuxConfigurationProvisionVMAgent = value ?? default(bool); } + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? LinuxConfigurationProvisionVMConfigAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).LinuxConfigurationProvisionVMConfigAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).LinuxConfigurationProvisionVMConfigAgent = value ?? default(bool); } + + /// The list of SSH public keys used to authenticate with linux based VMs. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] LinuxConfigurationSshPublicKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).LinuxConfigurationSshPublicKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).LinuxConfigurationSshPublicKey = value ?? null /* arrayOf */; } + + /// Internal Acessors for ExtendedLocation + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.ExtendedLocation { get => (this._extendedLocation = this._extendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation()); set { {_extendedLocation = value;} } } + + /// Internal Acessors for GuestAgentInstallStatusAgentVersion + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.GuestAgentInstallStatusAgentVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).GuestAgentInstallStatusAgentVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).GuestAgentInstallStatusAgentVersion = value; } + + /// Internal Acessors for GuestAgentInstallStatusErrorDetail + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.GuestAgentInstallStatusErrorDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).GuestAgentInstallStatusErrorDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).GuestAgentInstallStatusErrorDetail = value; } + + /// Internal Acessors for GuestAgentInstallStatusLastStatusChange + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.GuestAgentInstallStatusLastStatusChange { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).GuestAgentInstallStatusLastStatusChange; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).GuestAgentInstallStatusLastStatusChange = value; } + + /// Internal Acessors for GuestAgentInstallStatusVMUuid + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.GuestAgentInstallStatusVMUuid { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).GuestAgentInstallStatusVMUuid; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).GuestAgentInstallStatusVMUuid = value; } + + /// Internal Acessors for HardwareProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfile Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.HardwareProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).HardwareProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).HardwareProfile = value; } + + /// Internal Acessors for HardwareProfileDynamicMemoryConfig + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.HardwareProfileDynamicMemoryConfig { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).HardwareProfileDynamicMemoryConfig; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).HardwareProfileDynamicMemoryConfig = value; } + + /// Internal Acessors for HttpProxyConfig + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.HttpProxyConfig { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).HttpProxyConfig; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).HttpProxyConfig = value; } + + /// Internal Acessors for Identity + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.Identity { get => (this._identity = this._identity ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Identity()); set { {_identity = value;} } } + + /// Internal Acessors for IdentityPrincipalId + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.IdentityPrincipalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).PrincipalId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).PrincipalId = value; } + + /// Internal Acessors for IdentityTenantId + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.IdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).TenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).TenantId = value; } + + /// Internal Acessors for InstanceView + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceView Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.InstanceView { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).InstanceView; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).InstanceView = value; } + + /// Internal Acessors for InstanceViewVMAgent + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.InstanceViewVMAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).InstanceViewVMAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).InstanceViewVMAgent = value; } + + /// Internal Acessors for LinuxConfigurationSsh + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.LinuxConfigurationSsh { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).LinuxConfigurationSsh; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).LinuxConfigurationSsh = value; } + + /// Internal Acessors for NetworkProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfile Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.NetworkProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).NetworkProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).NetworkProfile = value; } + + /// Internal Acessors for OSProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfile Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.OSProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).OSProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).OSProfile = value; } + + /// Internal Acessors for OSProfileLinuxConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.OSProfileLinuxConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).OSProfileLinuxConfiguration; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).OSProfileLinuxConfiguration = value; } + + /// Internal Acessors for OSProfileWindowsConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.OSProfileWindowsConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).OSProfileWindowsConfiguration; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).OSProfileWindowsConfiguration = value; } + + /// Internal Acessors for PropertiesGuestAgentInstallStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.PropertiesGuestAgentInstallStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).GuestAgentInstallStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).GuestAgentInstallStatus = value; } + + /// Internal Acessors for PropertiesGuestAgentInstallStatusStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.PropertiesGuestAgentInstallStatusStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).GuestAgentInstallStatusStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).GuestAgentInstallStatusStatus = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for SecurityProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfile Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.SecurityProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).SecurityProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).SecurityProfile = value; } + + /// Internal Acessors for SecurityProfileUefiSetting + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.SecurityProfileUefiSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).SecurityProfileUefiSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).SecurityProfileUefiSetting = value; } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.Status { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).Status = value; } + + /// Internal Acessors for StatusProvisioningStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.StatusProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).StatusProvisioningStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).StatusProvisioningStatus = value; } + + /// Internal Acessors for StorageProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfile Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.StorageProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).StorageProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).StorageProfile = value; } + + /// Internal Acessors for StorageProfileImageReference + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.StorageProfileImageReference { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).StorageProfileImageReference; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).StorageProfileImageReference = value; } + + /// Internal Acessors for StorageProfileOSDisk + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.StorageProfileOSDisk { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).StorageProfileOSDisk; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).StorageProfileOSDisk = value; } + + /// Internal Acessors for VMId + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.VMId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).VMId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).VMId = value; } + + /// Internal Acessors for WindowConfigurationSsh + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceInternal.WindowConfigurationSsh { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).WindowConfigurationSsh; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).WindowConfigurationSsh = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemData = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Name; } + + /// + /// NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem[] NetworkProfileNetworkInterface { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).NetworkProfileNetworkInterface; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).NetworkProfileNetworkInterface = value ?? null /* arrayOf */; } + + /// Resource ID of the OS disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string OSDiskId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).OSDiskId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).OSDiskId = value ?? null; } + + /// + /// This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or + /// a specialized VHD. Possible values are: **Windows,** **Linux.** + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes? OSDiskOstype { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).OSDiskOstype; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).OSDiskOstype = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes)""); } + + /// AdminPassword - admin password + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string OSProfileAdminPassword { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).OSProfileAdminPassword; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).OSProfileAdminPassword = value ?? null; } + + /// AdminUsername - admin username + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string OSProfileAdminUsername { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).OSProfileAdminUsername; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).OSProfileAdminUsername = value ?? null; } + + /// ComputerName - name of the compute + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string OSProfileComputerName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).OSProfileComputerName; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).OSProfileComputerName = value ?? null; } + + /// The installation status of the hybrid machine agent installation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes? PropertiesGuestAgentInstallStatusStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).GuestAgentInstallStatusStatus; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceProperties _property; + + /// Properties under the virtual machine instance resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceProperties()); set => this._property = value; } + + /// Provisioning state of the virtual machine instance. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).ProvisioningState; } + + /// + /// The status of the operation performed on the virtual machine instance [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).ProvisioningStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).ProvisioningStatus = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status)""); } + + /// The ID of the operation performed on the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningStatusOperationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).ProvisioningStatusOperationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).ProvisioningStatusOperationId = value ?? null; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// Unique identifier defined by ARC to identify the guest of the VM. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ResourceUid { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).ResourceUid; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).ResourceUid = value ?? null; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? SecurityProfileEnableTpm { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).SecurityProfileEnableTpm; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).SecurityProfileEnableTpm = value ?? default(bool); } + + /// + /// Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for SecurityType + /// to function. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes? SecurityProfileSecurityType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).SecurityProfileSecurityType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).SecurityProfileSecurityType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes)""); } + + /// VirtualMachine provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).StatusErrorCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).StatusErrorCode = value ?? null; } + + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).StatusErrorMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).StatusErrorMessage = value ?? null; } + + /// The power state of the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum? StatusPowerState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).StatusPowerState; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).StatusPowerState = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum)""); } + + /// adds data disks to the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem[] StorageProfileDataDisk { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).StorageProfileDataDisk; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).StorageProfileDataDisk = value ?? null /* arrayOf */; } + + /// Id of the storage container that hosts the VM configuration file + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StorageProfileVMConfigStoragePathId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).StorageProfileVMConfigStoragePathId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).StorageProfileVMConfigStoragePathId = value ?? null; } + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemData; } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Type; } + + /// + /// Specifies whether secure boot should be enabled on the virtual machine instance. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? UefiSettingSecureBootEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).UefiSettingSecureBootEnabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).UefiSettingSecureBootEnabled = value ?? default(bool); } + + /// The resource status information. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus[] VMAgentStatuses { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).VMAgentStatuses; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).VMAgentStatuses = value ?? null /* arrayOf */; } + + /// The VM Config Agent full version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string VMAgentVmconfigAgentVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).VMAgentVmconfigAgentVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).VMAgentVmconfigAgentVersion = value ?? null; } + + /// Unique identifier for the vm resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string VMId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).VMId; } + + /// Whether to EnableAutomaticUpdates on the machine + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? WindowConfigurationEnableAutomaticUpdate { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).WindowConfigurationEnableAutomaticUpdate; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).WindowConfigurationEnableAutomaticUpdate = value ?? default(bool); } + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? WindowConfigurationProvisionVMAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).WindowConfigurationProvisionVMAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).WindowConfigurationProvisionVMAgent = value ?? default(bool); } + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? WindowConfigurationProvisionVMConfigAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).WindowConfigurationProvisionVMConfigAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).WindowConfigurationProvisionVMConfigAgent = value ?? default(bool); } + + /// TimeZone for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string WindowConfigurationTimeZone { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).WindowConfigurationTimeZone; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).WindowConfigurationTimeZone = value ?? null; } + + /// The list of SSH public keys used to authenticate with linux based VMs. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] WindowsConfigurationSshPublicKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).WindowsConfigurationSshPublicKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)Property).WindowsConfigurationSshPublicKey = value ?? null /* arrayOf */; } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + + /// Creates an new instance. + public VirtualMachineInstance() + { + + } + } + /// The virtual machine instance resource definition. + public partial interface IVirtualMachineInstance : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource + { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"maximumMemoryMB", + PossibleTypes = new [] { typeof(long) })] + long? DynamicMemoryConfigMaximumMemoryMb { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"minimumMemoryMB", + PossibleTypes = new [] { typeof(long) })] + long? DynamicMemoryConfigMinimumMemoryMb { get; set; } + /// + /// Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage + /// of the total memory that the virtual machine instance is thought to need. This only applies to virtual systems with dynamic + /// memory enabled. This property can be in the range of 5 to 2000. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage of the total memory that the virtual machine instance is thought to need. This only applies to virtual systems with dynamic memory enabled. This property can be in the range of 5 to 2000.", + SerializedName = @"targetMemoryBuffer", + PossibleTypes = new [] { typeof(int) })] + int? DynamicMemoryConfigTargetMemoryBuffer { get; set; } + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string ExtendedLocationName { get; set; } + /// The type of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the extended location.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? ExtendedLocationType { get; set; } + /// The hybrid machine agent full version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The hybrid machine agent full version.", + SerializedName = @"agentVersion", + PossibleTypes = new [] { typeof(string) })] + string GuestAgentInstallStatusAgentVersion { get; } + /// Details about the error state. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Details about the error state.", + SerializedName = @"errorDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] GuestAgentInstallStatusErrorDetail { get; } + /// The time of the last status change. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The time of the last status change.", + SerializedName = @"lastStatusChange", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? GuestAgentInstallStatusLastStatusChange { get; } + /// Specifies the VM's unique SMBIOS ID. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the VM's unique SMBIOS ID.", + SerializedName = @"vmUuid", + PossibleTypes = new [] { typeof(string) })] + string GuestAgentInstallStatusVMUuid { get; } + /// RAM in MB for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"RAM in MB for the virtual machine instance", + SerializedName = @"memoryMB", + PossibleTypes = new [] { typeof(long) })] + long? HardwareProfileMemoryMb { get; set; } + /// number of processors for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"number of processors for the virtual machine instance", + SerializedName = @"processors", + PossibleTypes = new [] { typeof(int) })] + int? HardwareProfileProcessor { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"vmSize", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum? HardwareProfileVMSize { get; set; } + /// The HTTP proxy server endpoint to use. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The HTTP proxy server endpoint to use.", + SerializedName = @"httpProxy", + PossibleTypes = new [] { typeof(string) })] + string HttpProxyConfigHttpProxy { get; set; } + /// The HTTPS proxy server endpoint to use. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The HTTPS proxy server endpoint to use.", + SerializedName = @"httpsProxy", + PossibleTypes = new [] { typeof(string) })] + string HttpProxyConfigHttpsProxy { get; set; } + /// The endpoints that should not go through proxy. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The endpoints that should not go through proxy.", + SerializedName = @"noProxy", + PossibleTypes = new [] { typeof(string) })] + string[] HttpProxyConfigNoProxy { get; set; } + /// Alternative CA cert to use for connecting to proxy servers. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Alternative CA cert to use for connecting to proxy servers.", + SerializedName = @"trustedCa", + PossibleTypes = new [] { typeof(string) })] + string HttpProxyConfigTrustedCa { get; set; } + /// The principal ID of resource identity. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The principal ID of resource identity.", + SerializedName = @"principalId", + PossibleTypes = new [] { typeof(string) })] + string IdentityPrincipalId { get; } + /// The tenant ID of resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The tenant ID of resource.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string IdentityTenantId { get; } + /// The identity type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identity type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get; set; } + /// Resource ID of the image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource ID of the image", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string ImageReferenceId { get; set; } + /// + /// DisablePasswordAuthentication - whether password authentication should be disabled + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"DisablePasswordAuthentication - whether password authentication should be disabled", + SerializedName = @"disablePasswordAuthentication", + PossibleTypes = new [] { typeof(bool) })] + bool? LinuxConfigurationDisablePasswordAuthentication { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? LinuxConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? LinuxConfigurationProvisionVMConfigAgent { get; set; } + /// The list of SSH public keys used to authenticate with linux based VMs. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of SSH public keys used to authenticate with linux based VMs.", + SerializedName = @"publicKeys", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] LinuxConfigurationSshPublicKey { get; set; } + /// + /// NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance", + SerializedName = @"networkInterfaces", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem[] NetworkProfileNetworkInterface { get; set; } + /// Resource ID of the OS disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource ID of the OS disk", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string OSDiskId { get; set; } + /// + /// This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or + /// a specialized VHD. Possible values are: **Windows,** **Linux.** + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. Possible values are: **Windows,** **Linux.**", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes? OSDiskOstype { get; set; } + /// AdminPassword - admin password + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"AdminPassword - admin password", + SerializedName = @"adminPassword", + PossibleTypes = new [] { typeof(string) })] + string OSProfileAdminPassword { get; set; } + /// AdminUsername - admin username + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"AdminUsername - admin username", + SerializedName = @"adminUsername", + PossibleTypes = new [] { typeof(string) })] + string OSProfileAdminUsername { get; set; } + /// ComputerName - name of the compute + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ComputerName - name of the compute", + SerializedName = @"computerName", + PossibleTypes = new [] { typeof(string) })] + string OSProfileComputerName { get; set; } + /// The installation status of the hybrid machine agent installation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The installation status of the hybrid machine agent installation.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes? PropertiesGuestAgentInstallStatusStatus { get; } + /// Provisioning state of the virtual machine instance. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Provisioning state of the virtual machine instance.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; } + /// + /// The status of the operation performed on the virtual machine instance [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the virtual machine instance [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the virtual machine instance", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusOperationId { get; set; } + /// Unique identifier defined by ARC to identify the guest of the VM. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Unique identifier defined by ARC to identify the guest of the VM.", + SerializedName = @"resourceUid", + PossibleTypes = new [] { typeof(string) })] + string ResourceUid { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"enableTPM", + PossibleTypes = new [] { typeof(bool) })] + bool? SecurityProfileEnableTpm { get; set; } + /// + /// Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for SecurityType + /// to function. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for SecurityType to function.", + SerializedName = @"securityType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes? SecurityProfileSecurityType { get; set; } + /// VirtualMachine provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VirtualMachine provisioning error code", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorCode { get; set; } + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Descriptive error message", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorMessage { get; set; } + /// The power state of the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The power state of the virtual machine instance", + SerializedName = @"powerState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum? StatusPowerState { get; set; } + /// adds data disks to the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"adds data disks to the virtual machine instance", + SerializedName = @"dataDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem[] StorageProfileDataDisk { get; set; } + /// Id of the storage container that hosts the VM configuration file + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Id of the storage container that hosts the VM configuration file", + SerializedName = @"vmConfigStoragePathId", + PossibleTypes = new [] { typeof(string) })] + string StorageProfileVMConfigStoragePathId { get; set; } + /// + /// Specifies whether secure boot should be enabled on the virtual machine instance. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies whether secure boot should be enabled on the virtual machine instance.", + SerializedName = @"secureBootEnabled", + PossibleTypes = new [] { typeof(bool) })] + bool? UefiSettingSecureBootEnabled { get; set; } + /// The resource status information. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource status information.", + SerializedName = @"statuses", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus[] VMAgentStatuses { get; set; } + /// The VM Config Agent full version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The VM Config Agent full version.", + SerializedName = @"vmConfigAgentVersion", + PossibleTypes = new [] { typeof(string) })] + string VMAgentVmconfigAgentVersion { get; set; } + /// Unique identifier for the vm resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Unique identifier for the vm resource.", + SerializedName = @"vmId", + PossibleTypes = new [] { typeof(string) })] + string VMId { get; } + /// Whether to EnableAutomaticUpdates on the machine + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Whether to EnableAutomaticUpdates on the machine", + SerializedName = @"enableAutomaticUpdates", + PossibleTypes = new [] { typeof(bool) })] + bool? WindowConfigurationEnableAutomaticUpdate { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? WindowConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? WindowConfigurationProvisionVMConfigAgent { get; set; } + /// TimeZone for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"TimeZone for the virtual machine instance", + SerializedName = @"timeZone", + PossibleTypes = new [] { typeof(string) })] + string WindowConfigurationTimeZone { get; set; } + /// The list of SSH public keys used to authenticate with linux based VMs. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of SSH public keys used to authenticate with linux based VMs.", + SerializedName = @"publicKeys", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] WindowsConfigurationSshPublicKey { get; set; } + + } + /// The virtual machine instance resource definition. + internal partial interface IVirtualMachineInstanceInternal : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal + { + long? DynamicMemoryConfigMaximumMemoryMb { get; set; } + + long? DynamicMemoryConfigMinimumMemoryMb { get; set; } + /// + /// Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage + /// of the total memory that the virtual machine instance is thought to need. This only applies to virtual systems with dynamic + /// memory enabled. This property can be in the range of 5 to 2000. + /// + int? DynamicMemoryConfigTargetMemoryBuffer { get; set; } + /// The extendedLocation of the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IExtendedLocation ExtendedLocation { get; set; } + /// The name of the extended location. + string ExtendedLocationName { get; set; } + /// The type of the extended location. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes? ExtendedLocationType { get; set; } + /// The hybrid machine agent full version. + string GuestAgentInstallStatusAgentVersion { get; set; } + /// Details about the error state. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] GuestAgentInstallStatusErrorDetail { get; set; } + /// The time of the last status change. + global::System.DateTime? GuestAgentInstallStatusLastStatusChange { get; set; } + /// Specifies the VM's unique SMBIOS ID. + string GuestAgentInstallStatusVMUuid { get; set; } + /// + /// HardwareProfile - Specifies the hardware settings for the virtual machine instance. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfile HardwareProfile { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig HardwareProfileDynamicMemoryConfig { get; set; } + /// RAM in MB for the virtual machine instance + long? HardwareProfileMemoryMb { get; set; } + /// number of processors for the virtual machine instance + int? HardwareProfileProcessor { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum? HardwareProfileVMSize { get; set; } + /// HTTP Proxy configuration for the VM. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfiguration HttpProxyConfig { get; set; } + /// The HTTP proxy server endpoint to use. + string HttpProxyConfigHttpProxy { get; set; } + /// The HTTPS proxy server endpoint to use. + string HttpProxyConfigHttpsProxy { get; set; } + /// The endpoints that should not go through proxy. + string[] HttpProxyConfigNoProxy { get; set; } + /// Alternative CA cert to use for connecting to proxy servers. + string HttpProxyConfigTrustedCa { get; set; } + /// Identity for the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity Identity { get; set; } + /// The principal ID of resource identity. + string IdentityPrincipalId { get; set; } + /// The tenant ID of resource. + string IdentityTenantId { get; set; } + /// The identity type. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get; set; } + /// Resource ID of the image + string ImageReferenceId { get; set; } + /// The virtual machine instance view. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceView InstanceView { get; set; } + /// The VM Config Agent running on the virtual machine. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView InstanceViewVMAgent { get; set; } + /// + /// DisablePasswordAuthentication - whether password authentication should be disabled + /// + bool? LinuxConfigurationDisablePasswordAuthentication { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + bool? LinuxConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + bool? LinuxConfigurationProvisionVMConfigAgent { get; set; } + /// Specifies the ssh key configuration for a Linux OS. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration LinuxConfigurationSsh { get; set; } + /// The list of SSH public keys used to authenticate with linux based VMs. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] LinuxConfigurationSshPublicKey { get; set; } + /// + /// NetworkProfile - describes the network configuration the virtual machine instance + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfile NetworkProfile { get; set; } + /// + /// NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem[] NetworkProfileNetworkInterface { get; set; } + /// Resource ID of the OS disk + string OSDiskId { get; set; } + /// + /// This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or + /// a specialized VHD. Possible values are: **Windows,** **Linux.** + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes? OSDiskOstype { get; set; } + /// + /// OsProfile - describes the configuration of the operating system and sets login data + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfile OSProfile { get; set; } + /// AdminPassword - admin password + string OSProfileAdminPassword { get; set; } + /// AdminUsername - admin username + string OSProfileAdminUsername { get; set; } + /// ComputerName - name of the compute + string OSProfileComputerName { get; set; } + /// + /// LinuxConfiguration - linux specific configuration values for the virtual machine instance + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration OSProfileLinuxConfiguration { get; set; } + /// Windows Configuration for the virtual machine instance + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration OSProfileWindowsConfiguration { get; set; } + /// Guest agent install status. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatus PropertiesGuestAgentInstallStatus { get; set; } + /// The installation status of the hybrid machine agent installation. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes? PropertiesGuestAgentInstallStatusStatus { get; set; } + /// Properties under the virtual machine instance resource + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceProperties Property { get; set; } + /// Provisioning state of the virtual machine instance. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; set; } + /// + /// The status of the operation performed on the virtual machine instance [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the virtual machine instance + string ProvisioningStatusOperationId { get; set; } + /// Unique identifier defined by ARC to identify the guest of the VM. + string ResourceUid { get; set; } + /// + /// SecurityProfile - Specifies the security settings for the virtual machine instance. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfile SecurityProfile { get; set; } + + bool? SecurityProfileEnableTpm { get; set; } + /// + /// Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for SecurityType + /// to function. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes? SecurityProfileSecurityType { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings SecurityProfileUefiSetting { get; set; } + /// The observed state of virtual machine instances + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatus Status { get; set; } + /// VirtualMachine provisioning error code + string StatusErrorCode { get; set; } + /// Descriptive error message + string StatusErrorMessage { get; set; } + /// The power state of the virtual machine instance + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum? StatusPowerState { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus StatusProvisioningStatus { get; set; } + /// + /// StorageProfile - contains information about the disks and storage information for the virtual machine instance + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfile StorageProfile { get; set; } + /// adds data disks to the virtual machine instance + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem[] StorageProfileDataDisk { get; set; } + /// Which Image to use for the virtual machine instance + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference StorageProfileImageReference { get; set; } + /// VHD to attach as OS disk + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk StorageProfileOSDisk { get; set; } + /// Id of the storage container that hosts the VM configuration file + string StorageProfileVMConfigStoragePathId { get; set; } + /// + /// Specifies whether secure boot should be enabled on the virtual machine instance. + /// + bool? UefiSettingSecureBootEnabled { get; set; } + /// The resource status information. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus[] VMAgentStatuses { get; set; } + /// The VM Config Agent full version. + string VMAgentVmconfigAgentVersion { get; set; } + /// Unique identifier for the vm resource. + string VMId { get; set; } + /// Whether to EnableAutomaticUpdates on the machine + bool? WindowConfigurationEnableAutomaticUpdate { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + bool? WindowConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + bool? WindowConfigurationProvisionVMConfigAgent { get; set; } + /// Specifies the ssh key configuration for Windows OS. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration WindowConfigurationSsh { get; set; } + /// TimeZone for the virtual machine instance + string WindowConfigurationTimeZone { get; set; } + /// The list of SSH public keys used to authenticate with linux based VMs. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] WindowsConfigurationSshPublicKey { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstance.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstance.json.cs new file mode 100644 index 000000000000..034db9a3cbb8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstance.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The virtual machine instance resource definition. + public partial class VirtualMachineInstance + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualMachineInstance(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != this._extendedLocation ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._extendedLocation.ToJson(null,serializationMode) : null, "extendedLocation" ,container.Add ); + AddIf( null != this._identity ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._identity.ToJson(null,serializationMode) : null, "identity" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineInstance(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceProperties.FromJson(__jsonProperties) : Property;} + {_extendedLocation = If( json?.PropertyT("extendedLocation"), out var __jsonExtendedLocation) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ExtendedLocation.FromJson(__jsonExtendedLocation) : ExtendedLocation;} + {_identity = If( json?.PropertyT("identity"), out var __jsonIdentity) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Identity.FromJson(__jsonIdentity) : Identity;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceListResult.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceListResult.PowerShell.cs new file mode 100644 index 000000000000..55bbb30c73b5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceListResult.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstanceListResultTypeConverter))] + public partial class VirtualMachineInstanceListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineInstanceListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineInstanceListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineInstanceListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineInstanceListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstanceListResultTypeConverter))] + public partial interface IVirtualMachineInstanceListResult + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceListResult.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceListResult.TypeConverter.cs new file mode 100644 index 000000000000..cdd03c2f95f6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceListResult.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineInstanceListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineInstanceListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineInstanceListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineInstanceListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceListResult.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceListResult.cs new file mode 100644 index 000000000000..9a279fcb428b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceListResult.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class VirtualMachineInstanceListResult : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceListResult, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance[] _value; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public VirtualMachineInstanceListResult() + { + + } + } + public partial interface IVirtualMachineInstanceListResult : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance[] Value { get; set; } + + } + internal partial interface IVirtualMachineInstanceListResultInternal + + { + string NextLink { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceListResult.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceListResult.json.cs new file mode 100644 index 000000000000..0f73476bbf71 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceListResult.json.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class VirtualMachineInstanceListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualMachineInstanceListResult(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineInstanceListResult(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstance.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceProperties.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceProperties.PowerShell.cs new file mode 100644 index 000000000000..6ae0d7ad6a23 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceProperties.PowerShell.cs @@ -0,0 +1,658 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Properties under the virtual machine instance resource + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesTypeConverter))] + public partial class VirtualMachineInstanceProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineInstanceProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineInstanceProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineInstanceProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HardwareProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HardwareProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfile) content.GetValueForProperty("HardwareProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HardwareProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesHardwareProfileTypeConverter.ConvertFrom); + } + if (content.Contains("NetworkProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).NetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfile) content.GetValueForProperty("NetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).NetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesNetworkProfileTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfile) content.GetValueForProperty("OSProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileTypeConverter.ConvertFrom); + } + if (content.Contains("SecurityProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).SecurityProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfile) content.GetValueForProperty("SecurityProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).SecurityProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesSecurityProfileTypeConverter.ConvertFrom); + } + if (content.Contains("StorageProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StorageProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfile) content.GetValueForProperty("StorageProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StorageProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileTypeConverter.ConvertFrom); + } + if (content.Contains("HttpProxyConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HttpProxyConfig = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfiguration) content.GetValueForProperty("HttpProxyConfig",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HttpProxyConfig, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HttpProxyConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceView")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).InstanceView = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceView) content.GetValueForProperty("InstanceView",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).InstanceView, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceViewTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceStatusTypeConverter.ConvertFrom); + } + if (content.Contains("GuestAgentInstallStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatus) content.GetValueForProperty("GuestAgentInstallStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgentInstallStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("ResourceUid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).ResourceUid = (string) content.GetValueForProperty("ResourceUid",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).ResourceUid, global::System.Convert.ToString); + } + if (content.Contains("GuestAgentInstallStatusVMUuid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatusVMUuid = (string) content.GetValueForProperty("GuestAgentInstallStatusVMUuid",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatusVMUuid, global::System.Convert.ToString); + } + if (content.Contains("GuestAgentInstallStatusAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatusAgentVersion = (string) content.GetValueForProperty("GuestAgentInstallStatusAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatusAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("GuestAgentInstallStatusErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatusErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[]) content.GetValueForProperty("GuestAgentInstallStatusErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatusErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("HardwareProfileDynamicMemoryConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HardwareProfileDynamicMemoryConfig = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig) content.GetValueForProperty("HardwareProfileDynamicMemoryConfig",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HardwareProfileDynamicMemoryConfig, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigTypeConverter.ConvertFrom); + } + if (content.Contains("HardwareProfileVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HardwareProfileVMSize = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum?) content.GetValueForProperty("HardwareProfileVMSize",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HardwareProfileVMSize, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum.CreateFrom); + } + if (content.Contains("HardwareProfileProcessor")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HardwareProfileProcessor = (int?) content.GetValueForProperty("HardwareProfileProcessor",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HardwareProfileProcessor, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("HardwareProfileMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HardwareProfileMemoryMb = (long?) content.GetValueForProperty("HardwareProfileMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HardwareProfileMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("NetworkProfileNetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).NetworkProfileNetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem[]) content.GetValueForProperty("NetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).NetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItemTypeConverter.ConvertFrom)); + } + if (content.Contains("OSProfileLinuxConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfileLinuxConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration) content.GetValueForProperty("OSProfileLinuxConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfileLinuxConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileLinuxConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileWindowsConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfileWindowsConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration) content.GetValueForProperty("OSProfileWindowsConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfileWindowsConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileWindowsConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileAdminPassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfileAdminPassword = (string) content.GetValueForProperty("OSProfileAdminPassword",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfileAdminPassword, global::System.Convert.ToString); + } + if (content.Contains("OSProfileAdminUsername")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfileAdminUsername = (string) content.GetValueForProperty("OSProfileAdminUsername",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfileAdminUsername, global::System.Convert.ToString); + } + if (content.Contains("OSProfileComputerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfileComputerName = (string) content.GetValueForProperty("OSProfileComputerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfileComputerName, global::System.Convert.ToString); + } + if (content.Contains("SecurityProfileUefiSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).SecurityProfileUefiSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings) content.GetValueForProperty("SecurityProfileUefiSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).SecurityProfileUefiSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesSecurityProfileUefiSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("SecurityProfileEnableTpm")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).SecurityProfileEnableTpm = (bool?) content.GetValueForProperty("SecurityProfileEnableTpm",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).SecurityProfileEnableTpm, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("SecurityProfileSecurityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).SecurityProfileSecurityType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes?) content.GetValueForProperty("SecurityProfileSecurityType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).SecurityProfileSecurityType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes.CreateFrom); + } + if (content.Contains("StorageProfileImageReference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StorageProfileImageReference = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference) content.GetValueForProperty("StorageProfileImageReference",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StorageProfileImageReference, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileImageReferenceTypeConverter.ConvertFrom); + } + if (content.Contains("StorageProfileOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StorageProfileOSDisk = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk) content.GetValueForProperty("StorageProfileOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StorageProfileOSDisk, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileOSDiskTypeConverter.ConvertFrom); + } + if (content.Contains("StorageProfileDataDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StorageProfileDataDisk = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem[]) content.GetValueForProperty("StorageProfileDataDisk",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StorageProfileDataDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileDataDisksItemTypeConverter.ConvertFrom)); + } + if (content.Contains("StorageProfileVMConfigStoragePathId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StorageProfileVMConfigStoragePathId = (string) content.GetValueForProperty("StorageProfileVMConfigStoragePathId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StorageProfileVMConfigStoragePathId, global::System.Convert.ToString); + } + if (content.Contains("HttpProxyConfigHttpProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HttpProxyConfigHttpProxy = (string) content.GetValueForProperty("HttpProxyConfigHttpProxy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HttpProxyConfigHttpProxy, global::System.Convert.ToString); + } + if (content.Contains("HttpProxyConfigHttpsProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HttpProxyConfigHttpsProxy = (string) content.GetValueForProperty("HttpProxyConfigHttpsProxy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HttpProxyConfigHttpsProxy, global::System.Convert.ToString); + } + if (content.Contains("HttpProxyConfigNoProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HttpProxyConfigNoProxy = (string[]) content.GetValueForProperty("HttpProxyConfigNoProxy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HttpProxyConfigNoProxy, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("HttpProxyConfigTrustedCa")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HttpProxyConfigTrustedCa = (string) content.GetValueForProperty("HttpProxyConfigTrustedCa",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HttpProxyConfigTrustedCa, global::System.Convert.ToString); + } + if (content.Contains("InstanceViewVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).InstanceViewVMAgent = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView) content.GetValueForProperty("InstanceViewVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).InstanceViewVMAgent, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineConfigAgentInstanceViewTypeConverter.ConvertFrom); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusPowerState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StatusPowerState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum?) content.GetValueForProperty("StatusPowerState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StatusPowerState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum.CreateFrom); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("GuestAgentInstallStatusStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatusStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes?) content.GetValueForProperty("GuestAgentInstallStatusStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatusStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes.CreateFrom); + } + if (content.Contains("GuestAgentInstallStatusLastStatusChange")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatusLastStatusChange = (global::System.DateTime?) content.GetValueForProperty("GuestAgentInstallStatusLastStatusChange",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatusLastStatusChange, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("DynamicMemoryConfigMaximumMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).DynamicMemoryConfigMaximumMemoryMb = (long?) content.GetValueForProperty("DynamicMemoryConfigMaximumMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).DynamicMemoryConfigMaximumMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DynamicMemoryConfigMinimumMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).DynamicMemoryConfigMinimumMemoryMb = (long?) content.GetValueForProperty("DynamicMemoryConfigMinimumMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).DynamicMemoryConfigMinimumMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DynamicMemoryConfigTargetMemoryBuffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).DynamicMemoryConfigTargetMemoryBuffer = (int?) content.GetValueForProperty("DynamicMemoryConfigTargetMemoryBuffer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).DynamicMemoryConfigTargetMemoryBuffer, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("LinuxConfigurationSsh")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).LinuxConfigurationSsh = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration) content.GetValueForProperty("LinuxConfigurationSsh",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).LinuxConfigurationSsh, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("LinuxConfigurationDisablePasswordAuthentication")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).LinuxConfigurationDisablePasswordAuthentication = (bool?) content.GetValueForProperty("LinuxConfigurationDisablePasswordAuthentication",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).LinuxConfigurationDisablePasswordAuthentication, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LinuxConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).LinuxConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).LinuxConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LinuxConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).LinuxConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).LinuxConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationSsh")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowConfigurationSsh = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration) content.GetValueForProperty("WindowConfigurationSsh",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowConfigurationSsh, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("WindowConfigurationEnableAutomaticUpdate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowConfigurationEnableAutomaticUpdate = (bool?) content.GetValueForProperty("WindowConfigurationEnableAutomaticUpdate",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowConfigurationEnableAutomaticUpdate, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationTimeZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowConfigurationTimeZone = (string) content.GetValueForProperty("WindowConfigurationTimeZone",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowConfigurationTimeZone, global::System.Convert.ToString); + } + if (content.Contains("WindowConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("UefiSettingSecureBootEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).UefiSettingSecureBootEnabled = (bool?) content.GetValueForProperty("UefiSettingSecureBootEnabled",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).UefiSettingSecureBootEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ImageReferenceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).ImageReferenceId = (string) content.GetValueForProperty("ImageReferenceId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).ImageReferenceId, global::System.Convert.ToString); + } + if (content.Contains("OSDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSDiskId = (string) content.GetValueForProperty("OSDiskId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSDiskId, global::System.Convert.ToString); + } + if (content.Contains("OSDiskOstype")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSDiskOstype = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes?) content.GetValueForProperty("OSDiskOstype",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSDiskOstype, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes.CreateFrom); + } + if (content.Contains("VMAgentVmconfigAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).VMAgentVmconfigAgentVersion = (string) content.GetValueForProperty("VMAgentVmconfigAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).VMAgentVmconfigAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("VMAgentStatuses")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).VMAgentStatuses = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus[]) content.GetValueForProperty("VMAgentStatuses",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).VMAgentStatuses, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.InstanceViewStatusTypeConverter.ConvertFrom)); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + if (content.Contains("LinuxConfigurationSshPublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).LinuxConfigurationSshPublicKey = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]) content.GetValueForProperty("LinuxConfigurationSshPublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).LinuxConfigurationSshPublicKey, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshPublicKeyTypeConverter.ConvertFrom)); + } + if (content.Contains("WindowsConfigurationSshPublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowsConfigurationSshPublicKey = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]) content.GetValueForProperty("WindowsConfigurationSshPublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowsConfigurationSshPublicKey, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshPublicKeyTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineInstanceProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HardwareProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HardwareProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfile) content.GetValueForProperty("HardwareProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HardwareProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesHardwareProfileTypeConverter.ConvertFrom); + } + if (content.Contains("NetworkProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).NetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfile) content.GetValueForProperty("NetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).NetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesNetworkProfileTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfile) content.GetValueForProperty("OSProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileTypeConverter.ConvertFrom); + } + if (content.Contains("SecurityProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).SecurityProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfile) content.GetValueForProperty("SecurityProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).SecurityProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesSecurityProfileTypeConverter.ConvertFrom); + } + if (content.Contains("StorageProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StorageProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfile) content.GetValueForProperty("StorageProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StorageProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileTypeConverter.ConvertFrom); + } + if (content.Contains("HttpProxyConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HttpProxyConfig = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfiguration) content.GetValueForProperty("HttpProxyConfig",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HttpProxyConfig, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HttpProxyConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceView")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).InstanceView = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceView) content.GetValueForProperty("InstanceView",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).InstanceView, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceViewTypeConverter.ConvertFrom); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatus) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceStatusTypeConverter.ConvertFrom); + } + if (content.Contains("GuestAgentInstallStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatus) content.GetValueForProperty("GuestAgentInstallStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgentInstallStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum.CreateFrom); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("ResourceUid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).ResourceUid = (string) content.GetValueForProperty("ResourceUid",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).ResourceUid, global::System.Convert.ToString); + } + if (content.Contains("GuestAgentInstallStatusVMUuid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatusVMUuid = (string) content.GetValueForProperty("GuestAgentInstallStatusVMUuid",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatusVMUuid, global::System.Convert.ToString); + } + if (content.Contains("GuestAgentInstallStatusAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatusAgentVersion = (string) content.GetValueForProperty("GuestAgentInstallStatusAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatusAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("GuestAgentInstallStatusErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatusErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[]) content.GetValueForProperty("GuestAgentInstallStatusErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatusErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("HardwareProfileDynamicMemoryConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HardwareProfileDynamicMemoryConfig = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig) content.GetValueForProperty("HardwareProfileDynamicMemoryConfig",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HardwareProfileDynamicMemoryConfig, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigTypeConverter.ConvertFrom); + } + if (content.Contains("HardwareProfileVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HardwareProfileVMSize = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum?) content.GetValueForProperty("HardwareProfileVMSize",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HardwareProfileVMSize, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum.CreateFrom); + } + if (content.Contains("HardwareProfileProcessor")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HardwareProfileProcessor = (int?) content.GetValueForProperty("HardwareProfileProcessor",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HardwareProfileProcessor, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("HardwareProfileMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HardwareProfileMemoryMb = (long?) content.GetValueForProperty("HardwareProfileMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HardwareProfileMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("NetworkProfileNetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).NetworkProfileNetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem[]) content.GetValueForProperty("NetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).NetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItemTypeConverter.ConvertFrom)); + } + if (content.Contains("OSProfileLinuxConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfileLinuxConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration) content.GetValueForProperty("OSProfileLinuxConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfileLinuxConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileLinuxConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileWindowsConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfileWindowsConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration) content.GetValueForProperty("OSProfileWindowsConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfileWindowsConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileWindowsConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileAdminPassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfileAdminPassword = (string) content.GetValueForProperty("OSProfileAdminPassword",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfileAdminPassword, global::System.Convert.ToString); + } + if (content.Contains("OSProfileAdminUsername")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfileAdminUsername = (string) content.GetValueForProperty("OSProfileAdminUsername",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfileAdminUsername, global::System.Convert.ToString); + } + if (content.Contains("OSProfileComputerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfileComputerName = (string) content.GetValueForProperty("OSProfileComputerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSProfileComputerName, global::System.Convert.ToString); + } + if (content.Contains("SecurityProfileUefiSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).SecurityProfileUefiSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings) content.GetValueForProperty("SecurityProfileUefiSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).SecurityProfileUefiSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesSecurityProfileUefiSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("SecurityProfileEnableTpm")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).SecurityProfileEnableTpm = (bool?) content.GetValueForProperty("SecurityProfileEnableTpm",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).SecurityProfileEnableTpm, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("SecurityProfileSecurityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).SecurityProfileSecurityType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes?) content.GetValueForProperty("SecurityProfileSecurityType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).SecurityProfileSecurityType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes.CreateFrom); + } + if (content.Contains("StorageProfileImageReference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StorageProfileImageReference = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference) content.GetValueForProperty("StorageProfileImageReference",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StorageProfileImageReference, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileImageReferenceTypeConverter.ConvertFrom); + } + if (content.Contains("StorageProfileOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StorageProfileOSDisk = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk) content.GetValueForProperty("StorageProfileOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StorageProfileOSDisk, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileOSDiskTypeConverter.ConvertFrom); + } + if (content.Contains("StorageProfileDataDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StorageProfileDataDisk = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem[]) content.GetValueForProperty("StorageProfileDataDisk",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StorageProfileDataDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileDataDisksItemTypeConverter.ConvertFrom)); + } + if (content.Contains("StorageProfileVMConfigStoragePathId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StorageProfileVMConfigStoragePathId = (string) content.GetValueForProperty("StorageProfileVMConfigStoragePathId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StorageProfileVMConfigStoragePathId, global::System.Convert.ToString); + } + if (content.Contains("HttpProxyConfigHttpProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HttpProxyConfigHttpProxy = (string) content.GetValueForProperty("HttpProxyConfigHttpProxy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HttpProxyConfigHttpProxy, global::System.Convert.ToString); + } + if (content.Contains("HttpProxyConfigHttpsProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HttpProxyConfigHttpsProxy = (string) content.GetValueForProperty("HttpProxyConfigHttpsProxy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HttpProxyConfigHttpsProxy, global::System.Convert.ToString); + } + if (content.Contains("HttpProxyConfigNoProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HttpProxyConfigNoProxy = (string[]) content.GetValueForProperty("HttpProxyConfigNoProxy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HttpProxyConfigNoProxy, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("HttpProxyConfigTrustedCa")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HttpProxyConfigTrustedCa = (string) content.GetValueForProperty("HttpProxyConfigTrustedCa",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).HttpProxyConfigTrustedCa, global::System.Convert.ToString); + } + if (content.Contains("InstanceViewVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).InstanceViewVMAgent = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView) content.GetValueForProperty("InstanceViewVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).InstanceViewVMAgent, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineConfigAgentInstanceViewTypeConverter.ConvertFrom); + } + if (content.Contains("StatusProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StatusProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus) content.GetValueForProperty("StatusProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StatusProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("StatusErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StatusErrorCode = (string) content.GetValueForProperty("StatusErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StatusErrorCode, global::System.Convert.ToString); + } + if (content.Contains("StatusErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StatusErrorMessage = (string) content.GetValueForProperty("StatusErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StatusErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("StatusPowerState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StatusPowerState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum?) content.GetValueForProperty("StatusPowerState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).StatusPowerState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum.CreateFrom); + } + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("GuestAgentInstallStatusStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatusStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes?) content.GetValueForProperty("GuestAgentInstallStatusStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatusStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes.CreateFrom); + } + if (content.Contains("GuestAgentInstallStatusLastStatusChange")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatusLastStatusChange = (global::System.DateTime?) content.GetValueForProperty("GuestAgentInstallStatusLastStatusChange",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).GuestAgentInstallStatusLastStatusChange, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("DynamicMemoryConfigMaximumMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).DynamicMemoryConfigMaximumMemoryMb = (long?) content.GetValueForProperty("DynamicMemoryConfigMaximumMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).DynamicMemoryConfigMaximumMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DynamicMemoryConfigMinimumMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).DynamicMemoryConfigMinimumMemoryMb = (long?) content.GetValueForProperty("DynamicMemoryConfigMinimumMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).DynamicMemoryConfigMinimumMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DynamicMemoryConfigTargetMemoryBuffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).DynamicMemoryConfigTargetMemoryBuffer = (int?) content.GetValueForProperty("DynamicMemoryConfigTargetMemoryBuffer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).DynamicMemoryConfigTargetMemoryBuffer, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("LinuxConfigurationSsh")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).LinuxConfigurationSsh = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration) content.GetValueForProperty("LinuxConfigurationSsh",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).LinuxConfigurationSsh, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("LinuxConfigurationDisablePasswordAuthentication")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).LinuxConfigurationDisablePasswordAuthentication = (bool?) content.GetValueForProperty("LinuxConfigurationDisablePasswordAuthentication",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).LinuxConfigurationDisablePasswordAuthentication, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LinuxConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).LinuxConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).LinuxConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LinuxConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).LinuxConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).LinuxConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationSsh")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowConfigurationSsh = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration) content.GetValueForProperty("WindowConfigurationSsh",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowConfigurationSsh, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("WindowConfigurationEnableAutomaticUpdate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowConfigurationEnableAutomaticUpdate = (bool?) content.GetValueForProperty("WindowConfigurationEnableAutomaticUpdate",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowConfigurationEnableAutomaticUpdate, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationTimeZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowConfigurationTimeZone = (string) content.GetValueForProperty("WindowConfigurationTimeZone",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowConfigurationTimeZone, global::System.Convert.ToString); + } + if (content.Contains("WindowConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("UefiSettingSecureBootEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).UefiSettingSecureBootEnabled = (bool?) content.GetValueForProperty("UefiSettingSecureBootEnabled",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).UefiSettingSecureBootEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ImageReferenceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).ImageReferenceId = (string) content.GetValueForProperty("ImageReferenceId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).ImageReferenceId, global::System.Convert.ToString); + } + if (content.Contains("OSDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSDiskId = (string) content.GetValueForProperty("OSDiskId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSDiskId, global::System.Convert.ToString); + } + if (content.Contains("OSDiskOstype")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSDiskOstype = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes?) content.GetValueForProperty("OSDiskOstype",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).OSDiskOstype, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes.CreateFrom); + } + if (content.Contains("VMAgentVmconfigAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).VMAgentVmconfigAgentVersion = (string) content.GetValueForProperty("VMAgentVmconfigAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).VMAgentVmconfigAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("VMAgentStatuses")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).VMAgentStatuses = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus[]) content.GetValueForProperty("VMAgentStatuses",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).VMAgentStatuses, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.InstanceViewStatusTypeConverter.ConvertFrom)); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + if (content.Contains("LinuxConfigurationSshPublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).LinuxConfigurationSshPublicKey = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]) content.GetValueForProperty("LinuxConfigurationSshPublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).LinuxConfigurationSshPublicKey, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshPublicKeyTypeConverter.ConvertFrom)); + } + if (content.Contains("WindowsConfigurationSshPublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowsConfigurationSshPublicKey = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]) content.GetValueForProperty("WindowsConfigurationSshPublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal)this).WindowsConfigurationSshPublicKey, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshPublicKeyTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + } + /// Properties under the virtual machine instance resource + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesTypeConverter))] + public partial interface IVirtualMachineInstanceProperties + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceProperties.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceProperties.TypeConverter.cs new file mode 100644 index 000000000000..bfe53d7a6822 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineInstancePropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineInstanceProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineInstanceProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineInstanceProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceProperties.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceProperties.cs new file mode 100644 index 000000000000..500d7c76e9ff --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceProperties.cs @@ -0,0 +1,966 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Properties under the virtual machine instance resource + public partial class VirtualMachineInstanceProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceProperties, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal + { + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? DynamicMemoryConfigMaximumMemoryMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)HardwareProfile).DynamicMemoryConfigMaximumMemoryMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)HardwareProfile).DynamicMemoryConfigMaximumMemoryMb = value ?? default(long); } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? DynamicMemoryConfigMinimumMemoryMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)HardwareProfile).DynamicMemoryConfigMinimumMemoryMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)HardwareProfile).DynamicMemoryConfigMinimumMemoryMb = value ?? default(long); } + + /// + /// Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage + /// of the total memory that the virtual machine instance is thought to need. This only applies to virtual systems with dynamic + /// memory enabled. This property can be in the range of 5 to 2000. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public int? DynamicMemoryConfigTargetMemoryBuffer { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)HardwareProfile).DynamicMemoryConfigTargetMemoryBuffer; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)HardwareProfile).DynamicMemoryConfigTargetMemoryBuffer = value ?? default(int); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatus _guestAgentInstallStatus; + + /// Guest agent install status. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatus GuestAgentInstallStatus { get => (this._guestAgentInstallStatus = this._guestAgentInstallStatus ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgentInstallStatus()); set => this._guestAgentInstallStatus = value; } + + /// The hybrid machine agent full version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string GuestAgentInstallStatusAgentVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)GuestAgentInstallStatus).AgentVersion; } + + /// Details about the error state. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] GuestAgentInstallStatusErrorDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)GuestAgentInstallStatus).ErrorDetail; } + + /// The time of the last status change. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public global::System.DateTime? GuestAgentInstallStatusLastStatusChange { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)GuestAgentInstallStatus).LastStatusChange; } + + /// The installation status of the hybrid machine agent installation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes? GuestAgentInstallStatusStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)GuestAgentInstallStatus).Status; } + + /// Specifies the VM's unique SMBIOS ID. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string GuestAgentInstallStatusVMUuid { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)GuestAgentInstallStatus).VMUuid; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfile _hardwareProfile; + + /// + /// HardwareProfile - Specifies the hardware settings for the virtual machine instance. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfile HardwareProfile { get => (this._hardwareProfile = this._hardwareProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesHardwareProfile()); set => this._hardwareProfile = value; } + + /// RAM in MB for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? HardwareProfileMemoryMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)HardwareProfile).MemoryMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)HardwareProfile).MemoryMb = value ?? default(long); } + + /// number of processors for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public int? HardwareProfileProcessor { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)HardwareProfile).Processor; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)HardwareProfile).Processor = value ?? default(int); } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum? HardwareProfileVMSize { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)HardwareProfile).VMSize; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)HardwareProfile).VMSize = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum)""); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfiguration _httpProxyConfig; + + /// HTTP Proxy configuration for the VM. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfiguration HttpProxyConfig { get => (this._httpProxyConfig = this._httpProxyConfig ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HttpProxyConfiguration()); set => this._httpProxyConfig = value; } + + /// The HTTP proxy server endpoint to use. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string HttpProxyConfigHttpProxy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)HttpProxyConfig).HttpProxy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)HttpProxyConfig).HttpProxy = value ?? null; } + + /// The HTTPS proxy server endpoint to use. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string HttpProxyConfigHttpsProxy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)HttpProxyConfig).HttpsProxy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)HttpProxyConfig).HttpsProxy = value ?? null; } + + /// The endpoints that should not go through proxy. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string[] HttpProxyConfigNoProxy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)HttpProxyConfig).NoProxy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)HttpProxyConfig).NoProxy = value ?? null /* arrayOf */; } + + /// Alternative CA cert to use for connecting to proxy servers. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string HttpProxyConfigTrustedCa { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)HttpProxyConfig).TrustedCa; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfigurationInternal)HttpProxyConfig).TrustedCa = value ?? null; } + + /// Resource ID of the image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ImageReferenceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)StorageProfile).ImageReferenceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)StorageProfile).ImageReferenceId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceView _instanceView; + + /// The virtual machine instance view. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceView InstanceView { get => (this._instanceView = this._instanceView ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceView()); } + + /// + /// DisablePasswordAuthentication - whether password authentication should be disabled + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? LinuxConfigurationDisablePasswordAuthentication { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).LinuxConfigurationDisablePasswordAuthentication; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).LinuxConfigurationDisablePasswordAuthentication = value ?? default(bool); } + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? LinuxConfigurationProvisionVMAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).LinuxConfigurationProvisionVMAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).LinuxConfigurationProvisionVMAgent = value ?? default(bool); } + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? LinuxConfigurationProvisionVMConfigAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).LinuxConfigurationProvisionVMConfigAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).LinuxConfigurationProvisionVMConfigAgent = value ?? default(bool); } + + /// The list of SSH public keys used to authenticate with linux based VMs. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] LinuxConfigurationSshPublicKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).LinuxConfigurationSshPublicKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).LinuxConfigurationSshPublicKey = value ?? null /* arrayOf */; } + + /// Internal Acessors for GuestAgentInstallStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.GuestAgentInstallStatus { get => (this._guestAgentInstallStatus = this._guestAgentInstallStatus ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgentInstallStatus()); set { {_guestAgentInstallStatus = value;} } } + + /// Internal Acessors for GuestAgentInstallStatusAgentVersion + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.GuestAgentInstallStatusAgentVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)GuestAgentInstallStatus).AgentVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)GuestAgentInstallStatus).AgentVersion = value; } + + /// Internal Acessors for GuestAgentInstallStatusErrorDetail + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.GuestAgentInstallStatusErrorDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)GuestAgentInstallStatus).ErrorDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)GuestAgentInstallStatus).ErrorDetail = value; } + + /// Internal Acessors for GuestAgentInstallStatusLastStatusChange + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.GuestAgentInstallStatusLastStatusChange { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)GuestAgentInstallStatus).LastStatusChange; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)GuestAgentInstallStatus).LastStatusChange = value; } + + /// Internal Acessors for GuestAgentInstallStatusStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.GuestAgentInstallStatusStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)GuestAgentInstallStatus).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)GuestAgentInstallStatus).Status = value; } + + /// Internal Acessors for GuestAgentInstallStatusVMUuid + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.GuestAgentInstallStatusVMUuid { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)GuestAgentInstallStatus).VMUuid; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatusInternal)GuestAgentInstallStatus).VMUuid = value; } + + /// Internal Acessors for HardwareProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfile Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.HardwareProfile { get => (this._hardwareProfile = this._hardwareProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesHardwareProfile()); set { {_hardwareProfile = value;} } } + + /// Internal Acessors for HardwareProfileDynamicMemoryConfig + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.HardwareProfileDynamicMemoryConfig { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)HardwareProfile).DynamicMemoryConfig; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)HardwareProfile).DynamicMemoryConfig = value; } + + /// Internal Acessors for HttpProxyConfig + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.HttpProxyConfig { get => (this._httpProxyConfig = this._httpProxyConfig ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HttpProxyConfiguration()); set { {_httpProxyConfig = value;} } } + + /// Internal Acessors for InstanceView + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceView Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.InstanceView { get => (this._instanceView = this._instanceView ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceView()); set { {_instanceView = value;} } } + + /// Internal Acessors for InstanceViewVMAgent + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.InstanceViewVMAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceViewInternal)InstanceView).VMAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceViewInternal)InstanceView).VMAgent = value; } + + /// Internal Acessors for LinuxConfigurationSsh + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.LinuxConfigurationSsh { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).LinuxConfigurationSsh; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).LinuxConfigurationSsh = value; } + + /// Internal Acessors for NetworkProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfile Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.NetworkProfile { get => (this._networkProfile = this._networkProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesNetworkProfile()); set { {_networkProfile = value;} } } + + /// Internal Acessors for OSProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfile Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.OSProfile { get => (this._oSProfile = this._oSProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfile()); set { {_oSProfile = value;} } } + + /// Internal Acessors for OSProfileLinuxConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.OSProfileLinuxConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).LinuxConfiguration; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).LinuxConfiguration = value; } + + /// Internal Acessors for OSProfileWindowsConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.OSProfileWindowsConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).WindowsConfiguration; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).WindowsConfiguration = value; } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Internal Acessors for SecurityProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfile Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.SecurityProfile { get => (this._securityProfile = this._securityProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesSecurityProfile()); set { {_securityProfile = value;} } } + + /// Internal Acessors for SecurityProfileUefiSetting + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.SecurityProfileUefiSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)SecurityProfile).UefiSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)SecurityProfile).UefiSetting = value; } + + /// Internal Acessors for Status + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.Status { get => (this._status = this._status ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceStatus()); set { {_status = value;} } } + + /// Internal Acessors for StatusProvisioningStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.StatusProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)Status).ProvisioningStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)Status).ProvisioningStatus = value; } + + /// Internal Acessors for StorageProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfile Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.StorageProfile { get => (this._storageProfile = this._storageProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfile()); set { {_storageProfile = value;} } } + + /// Internal Acessors for StorageProfileImageReference + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.StorageProfileImageReference { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)StorageProfile).ImageReference; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)StorageProfile).ImageReference = value; } + + /// Internal Acessors for StorageProfileOSDisk + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.StorageProfileOSDisk { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)StorageProfile).OSDisk; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)StorageProfile).OSDisk = value; } + + /// Internal Acessors for VMId + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.VMId { get => this._vMId; set { {_vMId = value;} } } + + /// Internal Acessors for WindowConfigurationSsh + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesInternal.WindowConfigurationSsh { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).WindowConfigurationSsh; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).WindowConfigurationSsh = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfile _networkProfile; + + /// + /// NetworkProfile - describes the network configuration the virtual machine instance + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfile NetworkProfile { get => (this._networkProfile = this._networkProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesNetworkProfile()); set => this._networkProfile = value; } + + /// + /// NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem[] NetworkProfileNetworkInterface { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileInternal)NetworkProfile).NetworkInterface; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileInternal)NetworkProfile).NetworkInterface = value ?? null /* arrayOf */; } + + /// Resource ID of the OS disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string OSDiskId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)StorageProfile).OSDiskId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)StorageProfile).OSDiskId = value ?? null; } + + /// + /// This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or + /// a specialized VHD. Possible values are: **Windows,** **Linux.** + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes? OSDiskOstype { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)StorageProfile).OSDiskOstype; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)StorageProfile).OSDiskOstype = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes)""); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfile _oSProfile; + + /// + /// OsProfile - describes the configuration of the operating system and sets login data + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfile OSProfile { get => (this._oSProfile = this._oSProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfile()); set => this._oSProfile = value; } + + /// AdminPassword - admin password + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string OSProfileAdminPassword { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).AdminPassword; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).AdminPassword = value ?? null; } + + /// AdminUsername - admin username + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string OSProfileAdminUsername { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).AdminUsername; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).AdminUsername = value ?? null; } + + /// ComputerName - name of the compute + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string OSProfileComputerName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).ComputerName; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).ComputerName = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? _provisioningState; + + /// Provisioning state of the virtual machine instance. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get => this._provisioningState; } + + /// + /// The status of the operation performed on the virtual machine instance [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)Status).ProvisioningStatusStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)Status).ProvisioningStatusStatus = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status)""); } + + /// The ID of the operation performed on the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningStatusOperationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)Status).ProvisioningStatusOperationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)Status).ProvisioningStatusOperationId = value ?? null; } + + /// Backing field for property. + private string _resourceUid; + + /// Unique identifier defined by ARC to identify the guest of the VM. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ResourceUid { get => this._resourceUid; set => this._resourceUid = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfile _securityProfile; + + /// + /// SecurityProfile - Specifies the security settings for the virtual machine instance. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfile SecurityProfile { get => (this._securityProfile = this._securityProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesSecurityProfile()); set => this._securityProfile = value; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? SecurityProfileEnableTpm { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)SecurityProfile).EnableTpm; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)SecurityProfile).EnableTpm = value ?? default(bool); } + + /// + /// Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for SecurityType + /// to function. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes? SecurityProfileSecurityType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)SecurityProfile).SecurityType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)SecurityProfile).SecurityType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes)""); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatus _status; + + /// The observed state of virtual machine instances + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatus Status { get => (this._status = this._status ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceStatus()); } + + /// VirtualMachine provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)Status).ErrorCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)Status).ErrorCode = value ?? null; } + + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StatusErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)Status).ErrorMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)Status).ErrorMessage = value ?? null; } + + /// The power state of the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum? StatusPowerState { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)Status).PowerState; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)Status).PowerState = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum)""); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfile _storageProfile; + + /// + /// StorageProfile - contains information about the disks and storage information for the virtual machine instance + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfile StorageProfile { get => (this._storageProfile = this._storageProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfile()); set => this._storageProfile = value; } + + /// adds data disks to the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem[] StorageProfileDataDisk { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)StorageProfile).DataDisk; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)StorageProfile).DataDisk = value ?? null /* arrayOf */; } + + /// Id of the storage container that hosts the VM configuration file + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string StorageProfileVMConfigStoragePathId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)StorageProfile).VMConfigStoragePathId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)StorageProfile).VMConfigStoragePathId = value ?? null; } + + /// + /// Specifies whether secure boot should be enabled on the virtual machine instance. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? UefiSettingSecureBootEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)SecurityProfile).UefiSettingSecureBootEnabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)SecurityProfile).UefiSettingSecureBootEnabled = value ?? default(bool); } + + /// The resource status information. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus[] VMAgentStatuses { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceViewInternal)InstanceView).VMAgentStatuses; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceViewInternal)InstanceView).VMAgentStatuses = value ?? null /* arrayOf */; } + + /// The VM Config Agent full version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string VMAgentVmconfigAgentVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceViewInternal)InstanceView).VMAgentVmconfigAgentVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceViewInternal)InstanceView).VMAgentVmconfigAgentVersion = value ?? null; } + + /// Backing field for property. + private string _vMId; + + /// Unique identifier for the vm resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string VMId { get => this._vMId; } + + /// Whether to EnableAutomaticUpdates on the machine + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? WindowConfigurationEnableAutomaticUpdate { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).WindowConfigurationEnableAutomaticUpdate; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).WindowConfigurationEnableAutomaticUpdate = value ?? default(bool); } + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? WindowConfigurationProvisionVMAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).WindowConfigurationProvisionVMAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).WindowConfigurationProvisionVMAgent = value ?? default(bool); } + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? WindowConfigurationProvisionVMConfigAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).WindowConfigurationProvisionVMConfigAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).WindowConfigurationProvisionVMConfigAgent = value ?? default(bool); } + + /// TimeZone for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string WindowConfigurationTimeZone { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).WindowConfigurationTimeZone; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).WindowConfigurationTimeZone = value ?? null; } + + /// The list of SSH public keys used to authenticate with linux based VMs. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] WindowsConfigurationSshPublicKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).WindowsConfigurationSshPublicKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)OSProfile).WindowsConfigurationSshPublicKey = value ?? null /* arrayOf */; } + + /// Creates an new instance. + public VirtualMachineInstanceProperties() + { + + } + } + /// Properties under the virtual machine instance resource + public partial interface IVirtualMachineInstanceProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"maximumMemoryMB", + PossibleTypes = new [] { typeof(long) })] + long? DynamicMemoryConfigMaximumMemoryMb { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"minimumMemoryMB", + PossibleTypes = new [] { typeof(long) })] + long? DynamicMemoryConfigMinimumMemoryMb { get; set; } + /// + /// Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage + /// of the total memory that the virtual machine instance is thought to need. This only applies to virtual systems with dynamic + /// memory enabled. This property can be in the range of 5 to 2000. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage of the total memory that the virtual machine instance is thought to need. This only applies to virtual systems with dynamic memory enabled. This property can be in the range of 5 to 2000.", + SerializedName = @"targetMemoryBuffer", + PossibleTypes = new [] { typeof(int) })] + int? DynamicMemoryConfigTargetMemoryBuffer { get; set; } + /// The hybrid machine agent full version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The hybrid machine agent full version.", + SerializedName = @"agentVersion", + PossibleTypes = new [] { typeof(string) })] + string GuestAgentInstallStatusAgentVersion { get; } + /// Details about the error state. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Details about the error state.", + SerializedName = @"errorDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] GuestAgentInstallStatusErrorDetail { get; } + /// The time of the last status change. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The time of the last status change.", + SerializedName = @"lastStatusChange", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? GuestAgentInstallStatusLastStatusChange { get; } + /// The installation status of the hybrid machine agent installation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The installation status of the hybrid machine agent installation.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes? GuestAgentInstallStatusStatus { get; } + /// Specifies the VM's unique SMBIOS ID. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the VM's unique SMBIOS ID.", + SerializedName = @"vmUuid", + PossibleTypes = new [] { typeof(string) })] + string GuestAgentInstallStatusVMUuid { get; } + /// RAM in MB for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"RAM in MB for the virtual machine instance", + SerializedName = @"memoryMB", + PossibleTypes = new [] { typeof(long) })] + long? HardwareProfileMemoryMb { get; set; } + /// number of processors for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"number of processors for the virtual machine instance", + SerializedName = @"processors", + PossibleTypes = new [] { typeof(int) })] + int? HardwareProfileProcessor { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"vmSize", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum? HardwareProfileVMSize { get; set; } + /// The HTTP proxy server endpoint to use. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The HTTP proxy server endpoint to use.", + SerializedName = @"httpProxy", + PossibleTypes = new [] { typeof(string) })] + string HttpProxyConfigHttpProxy { get; set; } + /// The HTTPS proxy server endpoint to use. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The HTTPS proxy server endpoint to use.", + SerializedName = @"httpsProxy", + PossibleTypes = new [] { typeof(string) })] + string HttpProxyConfigHttpsProxy { get; set; } + /// The endpoints that should not go through proxy. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The endpoints that should not go through proxy.", + SerializedName = @"noProxy", + PossibleTypes = new [] { typeof(string) })] + string[] HttpProxyConfigNoProxy { get; set; } + /// Alternative CA cert to use for connecting to proxy servers. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Alternative CA cert to use for connecting to proxy servers.", + SerializedName = @"trustedCa", + PossibleTypes = new [] { typeof(string) })] + string HttpProxyConfigTrustedCa { get; set; } + /// Resource ID of the image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource ID of the image", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string ImageReferenceId { get; set; } + /// + /// DisablePasswordAuthentication - whether password authentication should be disabled + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"DisablePasswordAuthentication - whether password authentication should be disabled", + SerializedName = @"disablePasswordAuthentication", + PossibleTypes = new [] { typeof(bool) })] + bool? LinuxConfigurationDisablePasswordAuthentication { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? LinuxConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? LinuxConfigurationProvisionVMConfigAgent { get; set; } + /// The list of SSH public keys used to authenticate with linux based VMs. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of SSH public keys used to authenticate with linux based VMs.", + SerializedName = @"publicKeys", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] LinuxConfigurationSshPublicKey { get; set; } + /// + /// NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance", + SerializedName = @"networkInterfaces", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem[] NetworkProfileNetworkInterface { get; set; } + /// Resource ID of the OS disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource ID of the OS disk", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string OSDiskId { get; set; } + /// + /// This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or + /// a specialized VHD. Possible values are: **Windows,** **Linux.** + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. Possible values are: **Windows,** **Linux.**", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes? OSDiskOstype { get; set; } + /// AdminPassword - admin password + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"AdminPassword - admin password", + SerializedName = @"adminPassword", + PossibleTypes = new [] { typeof(string) })] + string OSProfileAdminPassword { get; set; } + /// AdminUsername - admin username + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"AdminUsername - admin username", + SerializedName = @"adminUsername", + PossibleTypes = new [] { typeof(string) })] + string OSProfileAdminUsername { get; set; } + /// ComputerName - name of the compute + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ComputerName - name of the compute", + SerializedName = @"computerName", + PossibleTypes = new [] { typeof(string) })] + string OSProfileComputerName { get; set; } + /// Provisioning state of the virtual machine instance. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Provisioning state of the virtual machine instance.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; } + /// + /// The status of the operation performed on the virtual machine instance [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the virtual machine instance [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the virtual machine instance", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusOperationId { get; set; } + /// Unique identifier defined by ARC to identify the guest of the VM. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Unique identifier defined by ARC to identify the guest of the VM.", + SerializedName = @"resourceUid", + PossibleTypes = new [] { typeof(string) })] + string ResourceUid { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"enableTPM", + PossibleTypes = new [] { typeof(bool) })] + bool? SecurityProfileEnableTpm { get; set; } + /// + /// Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for SecurityType + /// to function. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for SecurityType to function.", + SerializedName = @"securityType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes? SecurityProfileSecurityType { get; set; } + /// VirtualMachine provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VirtualMachine provisioning error code", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorCode { get; set; } + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Descriptive error message", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string StatusErrorMessage { get; set; } + /// The power state of the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The power state of the virtual machine instance", + SerializedName = @"powerState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum? StatusPowerState { get; set; } + /// adds data disks to the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"adds data disks to the virtual machine instance", + SerializedName = @"dataDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem[] StorageProfileDataDisk { get; set; } + /// Id of the storage container that hosts the VM configuration file + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Id of the storage container that hosts the VM configuration file", + SerializedName = @"vmConfigStoragePathId", + PossibleTypes = new [] { typeof(string) })] + string StorageProfileVMConfigStoragePathId { get; set; } + /// + /// Specifies whether secure boot should be enabled on the virtual machine instance. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies whether secure boot should be enabled on the virtual machine instance.", + SerializedName = @"secureBootEnabled", + PossibleTypes = new [] { typeof(bool) })] + bool? UefiSettingSecureBootEnabled { get; set; } + /// The resource status information. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource status information.", + SerializedName = @"statuses", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus[] VMAgentStatuses { get; set; } + /// The VM Config Agent full version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The VM Config Agent full version.", + SerializedName = @"vmConfigAgentVersion", + PossibleTypes = new [] { typeof(string) })] + string VMAgentVmconfigAgentVersion { get; set; } + /// Unique identifier for the vm resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Unique identifier for the vm resource.", + SerializedName = @"vmId", + PossibleTypes = new [] { typeof(string) })] + string VMId { get; } + /// Whether to EnableAutomaticUpdates on the machine + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Whether to EnableAutomaticUpdates on the machine", + SerializedName = @"enableAutomaticUpdates", + PossibleTypes = new [] { typeof(bool) })] + bool? WindowConfigurationEnableAutomaticUpdate { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? WindowConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? WindowConfigurationProvisionVMConfigAgent { get; set; } + /// TimeZone for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"TimeZone for the virtual machine instance", + SerializedName = @"timeZone", + PossibleTypes = new [] { typeof(string) })] + string WindowConfigurationTimeZone { get; set; } + /// The list of SSH public keys used to authenticate with linux based VMs. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of SSH public keys used to authenticate with linux based VMs.", + SerializedName = @"publicKeys", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] WindowsConfigurationSshPublicKey { get; set; } + + } + /// Properties under the virtual machine instance resource + internal partial interface IVirtualMachineInstancePropertiesInternal + + { + long? DynamicMemoryConfigMaximumMemoryMb { get; set; } + + long? DynamicMemoryConfigMinimumMemoryMb { get; set; } + /// + /// Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage + /// of the total memory that the virtual machine instance is thought to need. This only applies to virtual systems with dynamic + /// memory enabled. This property can be in the range of 5 to 2000. + /// + int? DynamicMemoryConfigTargetMemoryBuffer { get; set; } + /// Guest agent install status. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentInstallStatus GuestAgentInstallStatus { get; set; } + /// The hybrid machine agent full version. + string GuestAgentInstallStatusAgentVersion { get; set; } + /// Details about the error state. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] GuestAgentInstallStatusErrorDetail { get; set; } + /// The time of the last status change. + global::System.DateTime? GuestAgentInstallStatusLastStatusChange { get; set; } + /// The installation status of the hybrid machine agent installation. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes? GuestAgentInstallStatusStatus { get; set; } + /// Specifies the VM's unique SMBIOS ID. + string GuestAgentInstallStatusVMUuid { get; set; } + /// + /// HardwareProfile - Specifies the hardware settings for the virtual machine instance. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfile HardwareProfile { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig HardwareProfileDynamicMemoryConfig { get; set; } + /// RAM in MB for the virtual machine instance + long? HardwareProfileMemoryMb { get; set; } + /// number of processors for the virtual machine instance + int? HardwareProfileProcessor { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum? HardwareProfileVMSize { get; set; } + /// HTTP Proxy configuration for the VM. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHttpProxyConfiguration HttpProxyConfig { get; set; } + /// The HTTP proxy server endpoint to use. + string HttpProxyConfigHttpProxy { get; set; } + /// The HTTPS proxy server endpoint to use. + string HttpProxyConfigHttpsProxy { get; set; } + /// The endpoints that should not go through proxy. + string[] HttpProxyConfigNoProxy { get; set; } + /// Alternative CA cert to use for connecting to proxy servers. + string HttpProxyConfigTrustedCa { get; set; } + /// Resource ID of the image + string ImageReferenceId { get; set; } + /// The virtual machine instance view. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceView InstanceView { get; set; } + /// The VM Config Agent running on the virtual machine. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView InstanceViewVMAgent { get; set; } + /// + /// DisablePasswordAuthentication - whether password authentication should be disabled + /// + bool? LinuxConfigurationDisablePasswordAuthentication { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + bool? LinuxConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + bool? LinuxConfigurationProvisionVMConfigAgent { get; set; } + /// Specifies the ssh key configuration for a Linux OS. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration LinuxConfigurationSsh { get; set; } + /// The list of SSH public keys used to authenticate with linux based VMs. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] LinuxConfigurationSshPublicKey { get; set; } + /// + /// NetworkProfile - describes the network configuration the virtual machine instance + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfile NetworkProfile { get; set; } + /// + /// NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem[] NetworkProfileNetworkInterface { get; set; } + /// Resource ID of the OS disk + string OSDiskId { get; set; } + /// + /// This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or + /// a specialized VHD. Possible values are: **Windows,** **Linux.** + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes? OSDiskOstype { get; set; } + /// + /// OsProfile - describes the configuration of the operating system and sets login data + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfile OSProfile { get; set; } + /// AdminPassword - admin password + string OSProfileAdminPassword { get; set; } + /// AdminUsername - admin username + string OSProfileAdminUsername { get; set; } + /// ComputerName - name of the compute + string OSProfileComputerName { get; set; } + /// + /// LinuxConfiguration - linux specific configuration values for the virtual machine instance + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration OSProfileLinuxConfiguration { get; set; } + /// Windows Configuration for the virtual machine instance + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration OSProfileWindowsConfiguration { get; set; } + /// Provisioning state of the virtual machine instance. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum? ProvisioningState { get; set; } + /// + /// The status of the operation performed on the virtual machine instance [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatus { get; set; } + /// The ID of the operation performed on the virtual machine instance + string ProvisioningStatusOperationId { get; set; } + /// Unique identifier defined by ARC to identify the guest of the VM. + string ResourceUid { get; set; } + /// + /// SecurityProfile - Specifies the security settings for the virtual machine instance. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfile SecurityProfile { get; set; } + + bool? SecurityProfileEnableTpm { get; set; } + /// + /// Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for SecurityType + /// to function. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes? SecurityProfileSecurityType { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings SecurityProfileUefiSetting { get; set; } + /// The observed state of virtual machine instances + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatus Status { get; set; } + /// VirtualMachine provisioning error code + string StatusErrorCode { get; set; } + /// Descriptive error message + string StatusErrorMessage { get; set; } + /// The power state of the virtual machine instance + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum? StatusPowerState { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus StatusProvisioningStatus { get; set; } + /// + /// StorageProfile - contains information about the disks and storage information for the virtual machine instance + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfile StorageProfile { get; set; } + /// adds data disks to the virtual machine instance + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem[] StorageProfileDataDisk { get; set; } + /// Which Image to use for the virtual machine instance + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference StorageProfileImageReference { get; set; } + /// VHD to attach as OS disk + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk StorageProfileOSDisk { get; set; } + /// Id of the storage container that hosts the VM configuration file + string StorageProfileVMConfigStoragePathId { get; set; } + /// + /// Specifies whether secure boot should be enabled on the virtual machine instance. + /// + bool? UefiSettingSecureBootEnabled { get; set; } + /// The resource status information. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus[] VMAgentStatuses { get; set; } + /// The VM Config Agent full version. + string VMAgentVmconfigAgentVersion { get; set; } + /// Unique identifier for the vm resource. + string VMId { get; set; } + /// Whether to EnableAutomaticUpdates on the machine + bool? WindowConfigurationEnableAutomaticUpdate { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + bool? WindowConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + bool? WindowConfigurationProvisionVMConfigAgent { get; set; } + /// Specifies the ssh key configuration for Windows OS. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration WindowConfigurationSsh { get; set; } + /// TimeZone for the virtual machine instance + string WindowConfigurationTimeZone { get; set; } + /// The list of SSH public keys used to authenticate with linux based VMs. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] WindowsConfigurationSshPublicKey { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceProperties.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceProperties.json.cs new file mode 100644 index 000000000000..0eb7978c0cfc --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceProperties.json.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Properties under the virtual machine instance resource + public partial class VirtualMachineInstanceProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualMachineInstanceProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._hardwareProfile ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._hardwareProfile.ToJson(null,serializationMode) : null, "hardwareProfile" ,container.Add ); + AddIf( null != this._networkProfile ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._networkProfile.ToJson(null,serializationMode) : null, "networkProfile" ,container.Add ); + AddIf( null != this._oSProfile ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._oSProfile.ToJson(null,serializationMode) : null, "osProfile" ,container.Add ); + AddIf( null != this._securityProfile ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._securityProfile.ToJson(null,serializationMode) : null, "securityProfile" ,container.Add ); + AddIf( null != this._storageProfile ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._storageProfile.ToJson(null,serializationMode) : null, "storageProfile" ,container.Add ); + AddIf( null != this._httpProxyConfig ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._httpProxyConfig.ToJson(null,serializationMode) : null, "httpProxyConfig" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._instanceView ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._instanceView.ToJson(null,serializationMode) : null, "instanceView" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._status ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._status.ToJson(null,serializationMode) : null, "status" ,container.Add ); + } + AddIf( null != this._guestAgentInstallStatus ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._guestAgentInstallStatus.ToJson(null,serializationMode) : null, "guestAgentInstallStatus" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._vMId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._vMId.ToString()) : null, "vmId" ,container.Add ); + } + AddIf( null != (((object)this._resourceUid)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._resourceUid.ToString()) : null, "resourceUid" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineInstanceProperties(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_hardwareProfile = If( json?.PropertyT("hardwareProfile"), out var __jsonHardwareProfile) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesHardwareProfile.FromJson(__jsonHardwareProfile) : HardwareProfile;} + {_networkProfile = If( json?.PropertyT("networkProfile"), out var __jsonNetworkProfile) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesNetworkProfile.FromJson(__jsonNetworkProfile) : NetworkProfile;} + {_oSProfile = If( json?.PropertyT("osProfile"), out var __jsonOSProfile) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfile.FromJson(__jsonOSProfile) : OSProfile;} + {_securityProfile = If( json?.PropertyT("securityProfile"), out var __jsonSecurityProfile) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesSecurityProfile.FromJson(__jsonSecurityProfile) : SecurityProfile;} + {_storageProfile = If( json?.PropertyT("storageProfile"), out var __jsonStorageProfile) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfile.FromJson(__jsonStorageProfile) : StorageProfile;} + {_httpProxyConfig = If( json?.PropertyT("httpProxyConfig"), out var __jsonHttpProxyConfig) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HttpProxyConfiguration.FromJson(__jsonHttpProxyConfig) : HttpProxyConfig;} + {_instanceView = If( json?.PropertyT("instanceView"), out var __jsonInstanceView) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceView.FromJson(__jsonInstanceView) : InstanceView;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceStatus.FromJson(__jsonStatus) : Status;} + {_guestAgentInstallStatus = If( json?.PropertyT("guestAgentInstallStatus"), out var __jsonGuestAgentInstallStatus) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgentInstallStatus.FromJson(__jsonGuestAgentInstallStatus) : GuestAgentInstallStatus;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + {_vMId = If( json?.PropertyT("vmId"), out var __jsonVMId) ? (string)__jsonVMId : (string)VMId;} + {_resourceUid = If( json?.PropertyT("resourceUid"), out var __jsonResourceUid) ? (string)__jsonResourceUid : (string)ResourceUid;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfile.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfile.PowerShell.cs new file mode 100644 index 000000000000..3710fc597904 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfile.PowerShell.cs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// HardwareProfile - Specifies the hardware settings for the virtual machine instance. + /// + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesHardwareProfileTypeConverter))] + public partial class VirtualMachineInstancePropertiesHardwareProfile + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfile DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineInstancePropertiesHardwareProfile(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfile DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineInstancePropertiesHardwareProfile(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfile FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineInstancePropertiesHardwareProfile(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DynamicMemoryConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).DynamicMemoryConfig = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig) content.GetValueForProperty("DynamicMemoryConfig",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).DynamicMemoryConfig, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigTypeConverter.ConvertFrom); + } + if (content.Contains("VMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).VMSize = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum?) content.GetValueForProperty("VMSize",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).VMSize, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum.CreateFrom); + } + if (content.Contains("Processor")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).Processor = (int?) content.GetValueForProperty("Processor",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).Processor, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).MemoryMb = (long?) content.GetValueForProperty("MemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).MemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DynamicMemoryConfigMaximumMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).DynamicMemoryConfigMaximumMemoryMb = (long?) content.GetValueForProperty("DynamicMemoryConfigMaximumMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).DynamicMemoryConfigMaximumMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DynamicMemoryConfigMinimumMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).DynamicMemoryConfigMinimumMemoryMb = (long?) content.GetValueForProperty("DynamicMemoryConfigMinimumMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).DynamicMemoryConfigMinimumMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DynamicMemoryConfigTargetMemoryBuffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).DynamicMemoryConfigTargetMemoryBuffer = (int?) content.GetValueForProperty("DynamicMemoryConfigTargetMemoryBuffer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).DynamicMemoryConfigTargetMemoryBuffer, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineInstancePropertiesHardwareProfile(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DynamicMemoryConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).DynamicMemoryConfig = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig) content.GetValueForProperty("DynamicMemoryConfig",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).DynamicMemoryConfig, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigTypeConverter.ConvertFrom); + } + if (content.Contains("VMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).VMSize = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum?) content.GetValueForProperty("VMSize",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).VMSize, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum.CreateFrom); + } + if (content.Contains("Processor")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).Processor = (int?) content.GetValueForProperty("Processor",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).Processor, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).MemoryMb = (long?) content.GetValueForProperty("MemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).MemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DynamicMemoryConfigMaximumMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).DynamicMemoryConfigMaximumMemoryMb = (long?) content.GetValueForProperty("DynamicMemoryConfigMaximumMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).DynamicMemoryConfigMaximumMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DynamicMemoryConfigMinimumMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).DynamicMemoryConfigMinimumMemoryMb = (long?) content.GetValueForProperty("DynamicMemoryConfigMinimumMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).DynamicMemoryConfigMinimumMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DynamicMemoryConfigTargetMemoryBuffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).DynamicMemoryConfigTargetMemoryBuffer = (int?) content.GetValueForProperty("DynamicMemoryConfigTargetMemoryBuffer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal)this).DynamicMemoryConfigTargetMemoryBuffer, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializePSObject(content); + } + } + /// HardwareProfile - Specifies the hardware settings for the virtual machine instance. + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesHardwareProfileTypeConverter))] + public partial interface IVirtualMachineInstancePropertiesHardwareProfile + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfile.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfile.TypeConverter.cs new file mode 100644 index 000000000000..33ba992ffe36 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfile.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineInstancePropertiesHardwareProfileTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfile ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfile).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineInstancePropertiesHardwareProfile.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesHardwareProfile.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesHardwareProfile.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfile.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfile.cs new file mode 100644 index 000000000000..ce2d0a4b64c9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfile.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// HardwareProfile - Specifies the hardware settings for the virtual machine instance. + /// + public partial class VirtualMachineInstancePropertiesHardwareProfile : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfile, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig _dynamicMemoryConfig; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig DynamicMemoryConfig { get => (this._dynamicMemoryConfig = this._dynamicMemoryConfig ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig()); set => this._dynamicMemoryConfig = value; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? DynamicMemoryConfigMaximumMemoryMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigInternal)DynamicMemoryConfig).MaximumMemoryMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigInternal)DynamicMemoryConfig).MaximumMemoryMb = value ?? default(long); } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? DynamicMemoryConfigMinimumMemoryMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigInternal)DynamicMemoryConfig).MinimumMemoryMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigInternal)DynamicMemoryConfig).MinimumMemoryMb = value ?? default(long); } + + /// + /// Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage + /// of the total memory that the virtual machine instance is thought to need. This only applies to virtual systems with dynamic + /// memory enabled. This property can be in the range of 5 to 2000. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public int? DynamicMemoryConfigTargetMemoryBuffer { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigInternal)DynamicMemoryConfig).TargetMemoryBuffer; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigInternal)DynamicMemoryConfig).TargetMemoryBuffer = value ?? default(int); } + + /// Backing field for property. + private long? _memoryMb; + + /// RAM in MB for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public long? MemoryMb { get => this._memoryMb; set => this._memoryMb = value; } + + /// Internal Acessors for DynamicMemoryConfig + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileInternal.DynamicMemoryConfig { get => (this._dynamicMemoryConfig = this._dynamicMemoryConfig ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig()); set { {_dynamicMemoryConfig = value;} } } + + /// Backing field for property. + private int? _processor; + + /// number of processors for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public int? Processor { get => this._processor; set => this._processor = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum? _vMSize; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum? VMSize { get => this._vMSize; set => this._vMSize = value; } + + /// + /// Creates an new instance. + /// + public VirtualMachineInstancePropertiesHardwareProfile() + { + + } + } + /// HardwareProfile - Specifies the hardware settings for the virtual machine instance. + public partial interface IVirtualMachineInstancePropertiesHardwareProfile : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"maximumMemoryMB", + PossibleTypes = new [] { typeof(long) })] + long? DynamicMemoryConfigMaximumMemoryMb { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"minimumMemoryMB", + PossibleTypes = new [] { typeof(long) })] + long? DynamicMemoryConfigMinimumMemoryMb { get; set; } + /// + /// Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage + /// of the total memory that the virtual machine instance is thought to need. This only applies to virtual systems with dynamic + /// memory enabled. This property can be in the range of 5 to 2000. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage of the total memory that the virtual machine instance is thought to need. This only applies to virtual systems with dynamic memory enabled. This property can be in the range of 5 to 2000.", + SerializedName = @"targetMemoryBuffer", + PossibleTypes = new [] { typeof(int) })] + int? DynamicMemoryConfigTargetMemoryBuffer { get; set; } + /// RAM in MB for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"RAM in MB for the virtual machine instance", + SerializedName = @"memoryMB", + PossibleTypes = new [] { typeof(long) })] + long? MemoryMb { get; set; } + /// number of processors for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"number of processors for the virtual machine instance", + SerializedName = @"processors", + PossibleTypes = new [] { typeof(int) })] + int? Processor { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"vmSize", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum? VMSize { get; set; } + + } + /// HardwareProfile - Specifies the hardware settings for the virtual machine instance. + internal partial interface IVirtualMachineInstancePropertiesHardwareProfileInternal + + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig DynamicMemoryConfig { get; set; } + + long? DynamicMemoryConfigMaximumMemoryMb { get; set; } + + long? DynamicMemoryConfigMinimumMemoryMb { get; set; } + /// + /// Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage + /// of the total memory that the virtual machine instance is thought to need. This only applies to virtual systems with dynamic + /// memory enabled. This property can be in the range of 5 to 2000. + /// + int? DynamicMemoryConfigTargetMemoryBuffer { get; set; } + /// RAM in MB for the virtual machine instance + long? MemoryMb { get; set; } + /// number of processors for the virtual machine instance + int? Processor { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum? VMSize { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfile.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfile.json.cs new file mode 100644 index 000000000000..09cd65588cdd --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfile.json.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// HardwareProfile - Specifies the hardware settings for the virtual machine instance. + /// + public partial class VirtualMachineInstancePropertiesHardwareProfile + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfile. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfile. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfile FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualMachineInstancePropertiesHardwareProfile(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._dynamicMemoryConfig ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._dynamicMemoryConfig.ToJson(null,serializationMode) : null, "dynamicMemoryConfig" ,container.Add ); + AddIf( null != (((object)this._vMSize)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._vMSize.ToString()) : null, "vmSize" ,container.Add ); + AddIf( null != this._processor ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNumber((int)this._processor) : null, "processors" ,container.Add ); + AddIf( null != this._memoryMb ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNumber((long)this._memoryMb) : null, "memoryMB" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineInstancePropertiesHardwareProfile(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_dynamicMemoryConfig = If( json?.PropertyT("dynamicMemoryConfig"), out var __jsonDynamicMemoryConfig) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.FromJson(__jsonDynamicMemoryConfig) : DynamicMemoryConfig;} + {_vMSize = If( json?.PropertyT("vmSize"), out var __jsonVMSize) ? (string)__jsonVMSize : (string)VMSize;} + {_processor = If( json?.PropertyT("processors"), out var __jsonProcessors) ? (int?)__jsonProcessors : Processor;} + {_memoryMb = If( json?.PropertyT("memoryMB"), out var __jsonMemoryMb) ? (long?)__jsonMemoryMb : MemoryMb;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.PowerShell.cs new file mode 100644 index 000000000000..450132177f1d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.PowerShell.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigTypeConverter))] + public partial class VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MaximumMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigInternal)this).MaximumMemoryMb = (long?) content.GetValueForProperty("MaximumMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigInternal)this).MaximumMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("MinimumMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigInternal)this).MinimumMemoryMb = (long?) content.GetValueForProperty("MinimumMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigInternal)this).MinimumMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TargetMemoryBuffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigInternal)this).TargetMemoryBuffer = (int?) content.GetValueForProperty("TargetMemoryBuffer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigInternal)this).TargetMemoryBuffer, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MaximumMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigInternal)this).MaximumMemoryMb = (long?) content.GetValueForProperty("MaximumMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigInternal)this).MaximumMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("MinimumMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigInternal)this).MinimumMemoryMb = (long?) content.GetValueForProperty("MinimumMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigInternal)this).MinimumMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TargetMemoryBuffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigInternal)this).TargetMemoryBuffer = (int?) content.GetValueForProperty("TargetMemoryBuffer",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigInternal)this).TargetMemoryBuffer, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializePSObject(content); + } + } + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigTypeConverter))] + public partial interface IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.TypeConverter.cs new file mode 100644 index 000000000000..ff68a9635dd7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.cs new file mode 100644 index 000000000000..700b4ad7b237 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigInternal + { + + /// Backing field for property. + private long? _maximumMemoryMb; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public long? MaximumMemoryMb { get => this._maximumMemoryMb; set => this._maximumMemoryMb = value; } + + /// Backing field for property. + private long? _minimumMemoryMb; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public long? MinimumMemoryMb { get => this._minimumMemoryMb; set => this._minimumMemoryMb = value; } + + /// Backing field for property. + private int? _targetMemoryBuffer; + + /// + /// Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage + /// of the total memory that the virtual machine instance is thought to need. This only applies to virtual systems with dynamic + /// memory enabled. This property can be in the range of 5 to 2000. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public int? TargetMemoryBuffer { get => this._targetMemoryBuffer; set => this._targetMemoryBuffer = value; } + + /// + /// Creates an new instance. + /// + public VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig() + { + + } + } + public partial interface IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"maximumMemoryMB", + PossibleTypes = new [] { typeof(long) })] + long? MaximumMemoryMb { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"minimumMemoryMB", + PossibleTypes = new [] { typeof(long) })] + long? MinimumMemoryMb { get; set; } + /// + /// Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage + /// of the total memory that the virtual machine instance is thought to need. This only applies to virtual systems with dynamic + /// memory enabled. This property can be in the range of 5 to 2000. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage of the total memory that the virtual machine instance is thought to need. This only applies to virtual systems with dynamic memory enabled. This property can be in the range of 5 to 2000.", + SerializedName = @"targetMemoryBuffer", + PossibleTypes = new [] { typeof(int) })] + int? TargetMemoryBuffer { get; set; } + + } + internal partial interface IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigInternal + + { + long? MaximumMemoryMb { get; set; } + + long? MinimumMemoryMb { get; set; } + /// + /// Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage + /// of the total memory that the virtual machine instance is thought to need. This only applies to virtual systems with dynamic + /// memory enabled. This property can be in the range of 5 to 2000. + /// + int? TargetMemoryBuffer { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.json.cs new file mode 100644 index 000000000000..6a253bfe51b5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._maximumMemoryMb ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNumber((long)this._maximumMemoryMb) : null, "maximumMemoryMB" ,container.Add ); + AddIf( null != this._minimumMemoryMb ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNumber((long)this._minimumMemoryMb) : null, "minimumMemoryMB" ,container.Add ); + AddIf( null != this._targetMemoryBuffer ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNumber((int)this._targetMemoryBuffer) : null, "targetMemoryBuffer" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_maximumMemoryMb = If( json?.PropertyT("maximumMemoryMB"), out var __jsonMaximumMemoryMb) ? (long?)__jsonMaximumMemoryMb : MaximumMemoryMb;} + {_minimumMemoryMb = If( json?.PropertyT("minimumMemoryMB"), out var __jsonMinimumMemoryMb) ? (long?)__jsonMinimumMemoryMb : MinimumMemoryMb;} + {_targetMemoryBuffer = If( json?.PropertyT("targetMemoryBuffer"), out var __jsonTargetMemoryBuffer) ? (int?)__jsonTargetMemoryBuffer : TargetMemoryBuffer;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfile.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfile.PowerShell.cs new file mode 100644 index 000000000000..4f840b78cdd8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfile.PowerShell.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// NetworkProfile - describes the network configuration the virtual machine instance + /// + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesNetworkProfileTypeConverter))] + public partial class VirtualMachineInstancePropertiesNetworkProfile + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfile DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineInstancePropertiesNetworkProfile(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfile DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineInstancePropertiesNetworkProfile(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfile FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineInstancePropertiesNetworkProfile(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileInternal)this).NetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem[]) content.GetValueForProperty("NetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileInternal)this).NetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItemTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineInstancePropertiesNetworkProfile(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileInternal)this).NetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem[]) content.GetValueForProperty("NetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileInternal)this).NetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItemTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + } + /// NetworkProfile - describes the network configuration the virtual machine instance + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesNetworkProfileTypeConverter))] + public partial interface IVirtualMachineInstancePropertiesNetworkProfile + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfile.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfile.TypeConverter.cs new file mode 100644 index 000000000000..3750a7274944 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfile.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineInstancePropertiesNetworkProfileTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfile ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfile).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineInstancePropertiesNetworkProfile.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesNetworkProfile.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesNetworkProfile.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfile.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfile.cs new file mode 100644 index 000000000000..e6a550fe67c2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfile.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// NetworkProfile - describes the network configuration the virtual machine instance + /// + public partial class VirtualMachineInstancePropertiesNetworkProfile : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfile, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem[] _networkInterface; + + /// + /// NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem[] NetworkInterface { get => this._networkInterface; set => this._networkInterface = value; } + + /// + /// Creates an new instance. + /// + public VirtualMachineInstancePropertiesNetworkProfile() + { + + } + } + /// NetworkProfile - describes the network configuration the virtual machine instance + public partial interface IVirtualMachineInstancePropertiesNetworkProfile : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// + /// NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance", + SerializedName = @"networkInterfaces", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem[] NetworkInterface { get; set; } + + } + /// NetworkProfile - describes the network configuration the virtual machine instance + internal partial interface IVirtualMachineInstancePropertiesNetworkProfileInternal + + { + /// + /// NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem[] NetworkInterface { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfile.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfile.json.cs new file mode 100644 index 000000000000..49f9e59e2933 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfile.json.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// NetworkProfile - describes the network configuration the virtual machine instance + /// + public partial class VirtualMachineInstancePropertiesNetworkProfile + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfile. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfile. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfile FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualMachineInstancePropertiesNetworkProfile(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._networkInterface) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._networkInterface ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("networkInterfaces",__w); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineInstancePropertiesNetworkProfile(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_networkInterface = If( json?.PropertyT("networkInterfaces"), out var __jsonNetworkInterfaces) ? If( __jsonNetworkInterfaces as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem.FromJson(__u) )) ))() : null : NetworkInterface;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem.PowerShell.cs new file mode 100644 index 000000000000..df7b221ce396 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem.PowerShell.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItemTypeConverter))] + public partial class VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItemInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItemInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItemInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItemInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItemTypeConverter))] + public partial interface IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem.TypeConverter.cs new file mode 100644 index 000000000000..1bdb9858e6db --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItemTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem.cs new file mode 100644 index 000000000000..ef3e7771fe4d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItemInternal + { + + /// Backing field for property. + private string _id; + + /// ID - Resource Id of the network interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// + /// Creates an new instance. + /// + public VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem() + { + + } + } + public partial interface IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// ID - Resource Id of the network interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ID - Resource Id of the network interface", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + + } + internal partial interface IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItemInternal + + { + /// ID - Resource Id of the network interface + string Id { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem.json.cs new file mode 100644 index 000000000000..3721a3ebdfa9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem(json) : null; + } + + /// + /// Serializes this instance of into a + /// . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfile.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfile.PowerShell.cs new file mode 100644 index 000000000000..eb0611a6bf56 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfile.PowerShell.cs @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// OsProfile - describes the configuration of the operating system and sets login data + /// + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesOSProfileTypeConverter))] + public partial class VirtualMachineInstancePropertiesOSProfile + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfile DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineInstancePropertiesOSProfile(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfile DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineInstancePropertiesOSProfile(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfile FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineInstancePropertiesOSProfile(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("LinuxConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration) content.GetValueForProperty("LinuxConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileLinuxConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("WindowsConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowsConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration) content.GetValueForProperty("WindowsConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowsConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileWindowsConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("AdminPassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).AdminPassword = (string) content.GetValueForProperty("AdminPassword",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).AdminPassword, global::System.Convert.ToString); + } + if (content.Contains("AdminUsername")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).AdminUsername = (string) content.GetValueForProperty("AdminUsername",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).AdminUsername, global::System.Convert.ToString); + } + if (content.Contains("ComputerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).ComputerName = (string) content.GetValueForProperty("ComputerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).ComputerName, global::System.Convert.ToString); + } + if (content.Contains("LinuxConfigurationSsh")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfigurationSsh = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration) content.GetValueForProperty("LinuxConfigurationSsh",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfigurationSsh, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("LinuxConfigurationDisablePasswordAuthentication")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfigurationDisablePasswordAuthentication = (bool?) content.GetValueForProperty("LinuxConfigurationDisablePasswordAuthentication",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfigurationDisablePasswordAuthentication, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LinuxConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LinuxConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationSsh")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowConfigurationSsh = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration) content.GetValueForProperty("WindowConfigurationSsh",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowConfigurationSsh, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("WindowConfigurationEnableAutomaticUpdate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowConfigurationEnableAutomaticUpdate = (bool?) content.GetValueForProperty("WindowConfigurationEnableAutomaticUpdate",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowConfigurationEnableAutomaticUpdate, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationTimeZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowConfigurationTimeZone = (string) content.GetValueForProperty("WindowConfigurationTimeZone",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowConfigurationTimeZone, global::System.Convert.ToString); + } + if (content.Contains("WindowConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LinuxConfigurationSshPublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfigurationSshPublicKey = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]) content.GetValueForProperty("LinuxConfigurationSshPublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfigurationSshPublicKey, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshPublicKeyTypeConverter.ConvertFrom)); + } + if (content.Contains("WindowsConfigurationSshPublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowsConfigurationSshPublicKey = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]) content.GetValueForProperty("WindowsConfigurationSshPublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowsConfigurationSshPublicKey, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshPublicKeyTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineInstancePropertiesOSProfile(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("LinuxConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration) content.GetValueForProperty("LinuxConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileLinuxConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("WindowsConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowsConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration) content.GetValueForProperty("WindowsConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowsConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileWindowsConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("AdminPassword")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).AdminPassword = (string) content.GetValueForProperty("AdminPassword",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).AdminPassword, global::System.Convert.ToString); + } + if (content.Contains("AdminUsername")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).AdminUsername = (string) content.GetValueForProperty("AdminUsername",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).AdminUsername, global::System.Convert.ToString); + } + if (content.Contains("ComputerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).ComputerName = (string) content.GetValueForProperty("ComputerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).ComputerName, global::System.Convert.ToString); + } + if (content.Contains("LinuxConfigurationSsh")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfigurationSsh = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration) content.GetValueForProperty("LinuxConfigurationSsh",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfigurationSsh, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("LinuxConfigurationDisablePasswordAuthentication")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfigurationDisablePasswordAuthentication = (bool?) content.GetValueForProperty("LinuxConfigurationDisablePasswordAuthentication",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfigurationDisablePasswordAuthentication, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LinuxConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LinuxConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationSsh")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowConfigurationSsh = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration) content.GetValueForProperty("WindowConfigurationSsh",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowConfigurationSsh, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("WindowConfigurationEnableAutomaticUpdate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowConfigurationEnableAutomaticUpdate = (bool?) content.GetValueForProperty("WindowConfigurationEnableAutomaticUpdate",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowConfigurationEnableAutomaticUpdate, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationTimeZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowConfigurationTimeZone = (string) content.GetValueForProperty("WindowConfigurationTimeZone",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowConfigurationTimeZone, global::System.Convert.ToString); + } + if (content.Contains("WindowConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LinuxConfigurationSshPublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfigurationSshPublicKey = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]) content.GetValueForProperty("LinuxConfigurationSshPublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).LinuxConfigurationSshPublicKey, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshPublicKeyTypeConverter.ConvertFrom)); + } + if (content.Contains("WindowsConfigurationSshPublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowsConfigurationSshPublicKey = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]) content.GetValueForProperty("WindowsConfigurationSshPublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal)this).WindowsConfigurationSshPublicKey, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshPublicKeyTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + } + /// OsProfile - describes the configuration of the operating system and sets login data + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesOSProfileTypeConverter))] + public partial interface IVirtualMachineInstancePropertiesOSProfile + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfile.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfile.TypeConverter.cs new file mode 100644 index 000000000000..2b36551aecc6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfile.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineInstancePropertiesOSProfileTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfile ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfile).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineInstancePropertiesOSProfile.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesOSProfile.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesOSProfile.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfile.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfile.cs new file mode 100644 index 000000000000..276401a12b16 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfile.cs @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// OsProfile - describes the configuration of the operating system and sets login data + /// + public partial class VirtualMachineInstancePropertiesOSProfile : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfile, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal + { + + /// Backing field for property. + private string _adminPassword; + + /// AdminPassword - admin password + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string AdminPassword { get => this._adminPassword; set => this._adminPassword = value; } + + /// Backing field for property. + private string _adminUsername; + + /// AdminUsername - admin username + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string AdminUsername { get => this._adminUsername; set => this._adminUsername = value; } + + /// Backing field for property. + private string _computerName; + + /// ComputerName - name of the compute + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ComputerName { get => this._computerName; set => this._computerName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration _linuxConfiguration; + + /// + /// LinuxConfiguration - linux specific configuration values for the virtual machine instance + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration LinuxConfiguration { get => (this._linuxConfiguration = this._linuxConfiguration ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileLinuxConfiguration()); set => this._linuxConfiguration = value; } + + /// + /// DisablePasswordAuthentication - whether password authentication should be disabled + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? LinuxConfigurationDisablePasswordAuthentication { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)LinuxConfiguration).DisablePasswordAuthentication; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)LinuxConfiguration).DisablePasswordAuthentication = value ?? default(bool); } + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? LinuxConfigurationProvisionVMAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)LinuxConfiguration).ProvisionVMAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)LinuxConfiguration).ProvisionVMAgent = value ?? default(bool); } + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? LinuxConfigurationProvisionVMConfigAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)LinuxConfiguration).ProvisionVMConfigAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)LinuxConfiguration).ProvisionVMConfigAgent = value ?? default(bool); } + + /// The list of SSH public keys used to authenticate with linux based VMs. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] LinuxConfigurationSshPublicKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)LinuxConfiguration).SshPublicKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)LinuxConfiguration).SshPublicKey = value ?? null /* arrayOf */; } + + /// Internal Acessors for LinuxConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal.LinuxConfiguration { get => (this._linuxConfiguration = this._linuxConfiguration ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileLinuxConfiguration()); set { {_linuxConfiguration = value;} } } + + /// Internal Acessors for LinuxConfigurationSsh + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal.LinuxConfigurationSsh { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)LinuxConfiguration).Ssh; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)LinuxConfiguration).Ssh = value; } + + /// Internal Acessors for WindowConfigurationSsh + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal.WindowConfigurationSsh { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)WindowsConfiguration).Ssh; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)WindowsConfiguration).Ssh = value; } + + /// Internal Acessors for WindowsConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileInternal.WindowsConfiguration { get => (this._windowsConfiguration = this._windowsConfiguration ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileWindowsConfiguration()); set { {_windowsConfiguration = value;} } } + + /// Whether to EnableAutomaticUpdates on the machine + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? WindowConfigurationEnableAutomaticUpdate { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)WindowsConfiguration).EnableAutomaticUpdate; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)WindowsConfiguration).EnableAutomaticUpdate = value ?? default(bool); } + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? WindowConfigurationProvisionVMAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)WindowsConfiguration).ProvisionVMAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)WindowsConfiguration).ProvisionVMAgent = value ?? default(bool); } + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? WindowConfigurationProvisionVMConfigAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)WindowsConfiguration).ProvisionVMConfigAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)WindowsConfiguration).ProvisionVMConfigAgent = value ?? default(bool); } + + /// TimeZone for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string WindowConfigurationTimeZone { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)WindowsConfiguration).TimeZone; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)WindowsConfiguration).TimeZone = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration _windowsConfiguration; + + /// Windows Configuration for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration WindowsConfiguration { get => (this._windowsConfiguration = this._windowsConfiguration ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileWindowsConfiguration()); set => this._windowsConfiguration = value; } + + /// The list of SSH public keys used to authenticate with linux based VMs. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] WindowsConfigurationSshPublicKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)WindowsConfiguration).SshPublicKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)WindowsConfiguration).SshPublicKey = value ?? null /* arrayOf */; } + + /// + /// Creates an new instance. + /// + public VirtualMachineInstancePropertiesOSProfile() + { + + } + } + /// OsProfile - describes the configuration of the operating system and sets login data + public partial interface IVirtualMachineInstancePropertiesOSProfile : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// AdminPassword - admin password + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"AdminPassword - admin password", + SerializedName = @"adminPassword", + PossibleTypes = new [] { typeof(string) })] + string AdminPassword { get; set; } + /// AdminUsername - admin username + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"AdminUsername - admin username", + SerializedName = @"adminUsername", + PossibleTypes = new [] { typeof(string) })] + string AdminUsername { get; set; } + /// ComputerName - name of the compute + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ComputerName - name of the compute", + SerializedName = @"computerName", + PossibleTypes = new [] { typeof(string) })] + string ComputerName { get; set; } + /// + /// DisablePasswordAuthentication - whether password authentication should be disabled + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"DisablePasswordAuthentication - whether password authentication should be disabled", + SerializedName = @"disablePasswordAuthentication", + PossibleTypes = new [] { typeof(bool) })] + bool? LinuxConfigurationDisablePasswordAuthentication { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? LinuxConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? LinuxConfigurationProvisionVMConfigAgent { get; set; } + /// The list of SSH public keys used to authenticate with linux based VMs. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of SSH public keys used to authenticate with linux based VMs.", + SerializedName = @"publicKeys", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] LinuxConfigurationSshPublicKey { get; set; } + /// Whether to EnableAutomaticUpdates on the machine + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Whether to EnableAutomaticUpdates on the machine", + SerializedName = @"enableAutomaticUpdates", + PossibleTypes = new [] { typeof(bool) })] + bool? WindowConfigurationEnableAutomaticUpdate { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? WindowConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? WindowConfigurationProvisionVMConfigAgent { get; set; } + /// TimeZone for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"TimeZone for the virtual machine instance", + SerializedName = @"timeZone", + PossibleTypes = new [] { typeof(string) })] + string WindowConfigurationTimeZone { get; set; } + /// The list of SSH public keys used to authenticate with linux based VMs. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of SSH public keys used to authenticate with linux based VMs.", + SerializedName = @"publicKeys", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] WindowsConfigurationSshPublicKey { get; set; } + + } + /// OsProfile - describes the configuration of the operating system and sets login data + internal partial interface IVirtualMachineInstancePropertiesOSProfileInternal + + { + /// AdminPassword - admin password + string AdminPassword { get; set; } + /// AdminUsername - admin username + string AdminUsername { get; set; } + /// ComputerName - name of the compute + string ComputerName { get; set; } + /// + /// LinuxConfiguration - linux specific configuration values for the virtual machine instance + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration LinuxConfiguration { get; set; } + /// + /// DisablePasswordAuthentication - whether password authentication should be disabled + /// + bool? LinuxConfigurationDisablePasswordAuthentication { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + bool? LinuxConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + bool? LinuxConfigurationProvisionVMConfigAgent { get; set; } + /// Specifies the ssh key configuration for a Linux OS. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration LinuxConfigurationSsh { get; set; } + /// The list of SSH public keys used to authenticate with linux based VMs. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] LinuxConfigurationSshPublicKey { get; set; } + /// Whether to EnableAutomaticUpdates on the machine + bool? WindowConfigurationEnableAutomaticUpdate { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + bool? WindowConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + bool? WindowConfigurationProvisionVMConfigAgent { get; set; } + /// Specifies the ssh key configuration for Windows OS. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration WindowConfigurationSsh { get; set; } + /// TimeZone for the virtual machine instance + string WindowConfigurationTimeZone { get; set; } + /// Windows Configuration for the virtual machine instance + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration WindowsConfiguration { get; set; } + /// The list of SSH public keys used to authenticate with linux based VMs. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] WindowsConfigurationSshPublicKey { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfile.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfile.json.cs new file mode 100644 index 000000000000..8ab68673d109 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfile.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// OsProfile - describes the configuration of the operating system and sets login data + /// + public partial class VirtualMachineInstancePropertiesOSProfile + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfile. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfile. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfile FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualMachineInstancePropertiesOSProfile(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._linuxConfiguration ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._linuxConfiguration.ToJson(null,serializationMode) : null, "linuxConfiguration" ,container.Add ); + AddIf( null != this._windowsConfiguration ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._windowsConfiguration.ToJson(null,serializationMode) : null, "windowsConfiguration" ,container.Add ); + AddIf( null != (((object)this._adminPassword)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._adminPassword.ToString()) : null, "adminPassword" ,container.Add ); + AddIf( null != (((object)this._adminUsername)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._adminUsername.ToString()) : null, "adminUsername" ,container.Add ); + AddIf( null != (((object)this._computerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._computerName.ToString()) : null, "computerName" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineInstancePropertiesOSProfile(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_linuxConfiguration = If( json?.PropertyT("linuxConfiguration"), out var __jsonLinuxConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileLinuxConfiguration.FromJson(__jsonLinuxConfiguration) : LinuxConfiguration;} + {_windowsConfiguration = If( json?.PropertyT("windowsConfiguration"), out var __jsonWindowsConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesOSProfileWindowsConfiguration.FromJson(__jsonWindowsConfiguration) : WindowsConfiguration;} + {_adminPassword = If( json?.PropertyT("adminPassword"), out var __jsonAdminPassword) ? (string)__jsonAdminPassword : (string)AdminPassword;} + {_adminUsername = If( json?.PropertyT("adminUsername"), out var __jsonAdminUsername) ? (string)__jsonAdminUsername : (string)AdminUsername;} + {_computerName = If( json?.PropertyT("computerName"), out var __jsonComputerName) ? (string)__jsonComputerName : (string)ComputerName;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileLinuxConfiguration.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileLinuxConfiguration.PowerShell.cs new file mode 100644 index 000000000000..9fe9b552df05 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileLinuxConfiguration.PowerShell.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// LinuxConfiguration - linux specific configuration values for the virtual machine instance + /// + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesOSProfileLinuxConfigurationTypeConverter))] + public partial class VirtualMachineInstancePropertiesOSProfileLinuxConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineInstancePropertiesOSProfileLinuxConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineInstancePropertiesOSProfileLinuxConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing the + /// content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineInstancePropertiesOSProfileLinuxConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Ssh")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)this).Ssh = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration) content.GetValueForProperty("Ssh",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)this).Ssh, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("DisablePasswordAuthentication")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)this).DisablePasswordAuthentication = (bool?) content.GetValueForProperty("DisablePasswordAuthentication",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)this).DisablePasswordAuthentication, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)this).ProvisionVMAgent = (bool?) content.GetValueForProperty("ProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)this).ProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)this).ProvisionVMConfigAgent = (bool?) content.GetValueForProperty("ProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)this).ProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("SshPublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)this).SshPublicKey = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]) content.GetValueForProperty("SshPublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)this).SshPublicKey, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshPublicKeyTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineInstancePropertiesOSProfileLinuxConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Ssh")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)this).Ssh = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration) content.GetValueForProperty("Ssh",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)this).Ssh, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("DisablePasswordAuthentication")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)this).DisablePasswordAuthentication = (bool?) content.GetValueForProperty("DisablePasswordAuthentication",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)this).DisablePasswordAuthentication, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)this).ProvisionVMAgent = (bool?) content.GetValueForProperty("ProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)this).ProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)this).ProvisionVMConfigAgent = (bool?) content.GetValueForProperty("ProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)this).ProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("SshPublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)this).SshPublicKey = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]) content.GetValueForProperty("SshPublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal)this).SshPublicKey, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshPublicKeyTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + } + /// LinuxConfiguration - linux specific configuration values for the virtual machine instance + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesOSProfileLinuxConfigurationTypeConverter))] + public partial interface IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileLinuxConfiguration.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileLinuxConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..b387f99972d2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileLinuxConfiguration.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineInstancePropertiesOSProfileLinuxConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineInstancePropertiesOSProfileLinuxConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesOSProfileLinuxConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesOSProfileLinuxConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileLinuxConfiguration.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileLinuxConfiguration.cs new file mode 100644 index 000000000000..c336d2d5f696 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileLinuxConfiguration.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// LinuxConfiguration - linux specific configuration values for the virtual machine instance + /// + public partial class VirtualMachineInstancePropertiesOSProfileLinuxConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal + { + + /// Backing field for property. + private bool? _disablePasswordAuthentication; + + /// + /// DisablePasswordAuthentication - whether password authentication should be disabled + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public bool? DisablePasswordAuthentication { get => this._disablePasswordAuthentication; set => this._disablePasswordAuthentication = value; } + + /// Internal Acessors for Ssh + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal.Ssh { get => (this._ssh = this._ssh ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshConfiguration()); set { {_ssh = value;} } } + + /// Backing field for property. + private bool? _provisionVMAgent; + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public bool? ProvisionVMAgent { get => this._provisionVMAgent; set => this._provisionVMAgent = value; } + + /// Backing field for property. + private bool? _provisionVMConfigAgent; + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public bool? ProvisionVMConfigAgent { get => this._provisionVMConfigAgent; set => this._provisionVMConfigAgent = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration _ssh; + + /// Specifies the ssh key configuration for a Linux OS. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration Ssh { get => (this._ssh = this._ssh ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshConfiguration()); set => this._ssh = value; } + + /// The list of SSH public keys used to authenticate with linux based VMs. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] SshPublicKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfigurationInternal)Ssh).PublicKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfigurationInternal)Ssh).PublicKey = value ?? null /* arrayOf */; } + + /// + /// Creates an new instance. + /// + public VirtualMachineInstancePropertiesOSProfileLinuxConfiguration() + { + + } + } + /// LinuxConfiguration - linux specific configuration values for the virtual machine instance + public partial interface IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// + /// DisablePasswordAuthentication - whether password authentication should be disabled + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"DisablePasswordAuthentication - whether password authentication should be disabled", + SerializedName = @"disablePasswordAuthentication", + PossibleTypes = new [] { typeof(bool) })] + bool? DisablePasswordAuthentication { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? ProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? ProvisionVMConfigAgent { get; set; } + /// The list of SSH public keys used to authenticate with linux based VMs. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of SSH public keys used to authenticate with linux based VMs.", + SerializedName = @"publicKeys", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] SshPublicKey { get; set; } + + } + /// LinuxConfiguration - linux specific configuration values for the virtual machine instance + internal partial interface IVirtualMachineInstancePropertiesOSProfileLinuxConfigurationInternal + + { + /// + /// DisablePasswordAuthentication - whether password authentication should be disabled + /// + bool? DisablePasswordAuthentication { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + bool? ProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + bool? ProvisionVMConfigAgent { get; set; } + /// Specifies the ssh key configuration for a Linux OS. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration Ssh { get; set; } + /// The list of SSH public keys used to authenticate with linux based VMs. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] SshPublicKey { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileLinuxConfiguration.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileLinuxConfiguration.json.cs new file mode 100644 index 000000000000..ca3b377bdbca --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileLinuxConfiguration.json.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// LinuxConfiguration - linux specific configuration values for the virtual machine instance + /// + public partial class VirtualMachineInstancePropertiesOSProfileLinuxConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileLinuxConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualMachineInstancePropertiesOSProfileLinuxConfiguration(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._ssh ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._ssh.ToJson(null,serializationMode) : null, "ssh" ,container.Add ); + AddIf( null != this._disablePasswordAuthentication ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonBoolean((bool)this._disablePasswordAuthentication) : null, "disablePasswordAuthentication" ,container.Add ); + AddIf( null != this._provisionVMAgent ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonBoolean((bool)this._provisionVMAgent) : null, "provisionVMAgent" ,container.Add ); + AddIf( null != this._provisionVMConfigAgent ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonBoolean((bool)this._provisionVMConfigAgent) : null, "provisionVMConfigAgent" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineInstancePropertiesOSProfileLinuxConfiguration(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_ssh = If( json?.PropertyT("ssh"), out var __jsonSsh) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshConfiguration.FromJson(__jsonSsh) : Ssh;} + {_disablePasswordAuthentication = If( json?.PropertyT("disablePasswordAuthentication"), out var __jsonDisablePasswordAuthentication) ? (bool?)__jsonDisablePasswordAuthentication : DisablePasswordAuthentication;} + {_provisionVMAgent = If( json?.PropertyT("provisionVMAgent"), out var __jsonProvisionVMAgent) ? (bool?)__jsonProvisionVMAgent : ProvisionVMAgent;} + {_provisionVMConfigAgent = If( json?.PropertyT("provisionVMConfigAgent"), out var __jsonProvisionVMConfigAgent) ? (bool?)__jsonProvisionVMConfigAgent : ProvisionVMConfigAgent;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileWindowsConfiguration.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileWindowsConfiguration.PowerShell.cs new file mode 100644 index 000000000000..9e3335dd749c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileWindowsConfiguration.PowerShell.cs @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Windows Configuration for the virtual machine instance + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesOSProfileWindowsConfigurationTypeConverter))] + public partial class VirtualMachineInstancePropertiesOSProfileWindowsConfiguration + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineInstancePropertiesOSProfileWindowsConfiguration(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineInstancePropertiesOSProfileWindowsConfiguration(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineInstancePropertiesOSProfileWindowsConfiguration(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Ssh")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).Ssh = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration) content.GetValueForProperty("Ssh",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).Ssh, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("EnableAutomaticUpdate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).EnableAutomaticUpdate = (bool?) content.GetValueForProperty("EnableAutomaticUpdate",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).EnableAutomaticUpdate, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TimeZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).TimeZone = (string) content.GetValueForProperty("TimeZone",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).TimeZone, global::System.Convert.ToString); + } + if (content.Contains("ProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).ProvisionVMAgent = (bool?) content.GetValueForProperty("ProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).ProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).ProvisionVMConfigAgent = (bool?) content.GetValueForProperty("ProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).ProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("SshPublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).SshPublicKey = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]) content.GetValueForProperty("SshPublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).SshPublicKey, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshPublicKeyTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineInstancePropertiesOSProfileWindowsConfiguration(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Ssh")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).Ssh = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration) content.GetValueForProperty("Ssh",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).Ssh, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("EnableAutomaticUpdate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).EnableAutomaticUpdate = (bool?) content.GetValueForProperty("EnableAutomaticUpdate",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).EnableAutomaticUpdate, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TimeZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).TimeZone = (string) content.GetValueForProperty("TimeZone",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).TimeZone, global::System.Convert.ToString); + } + if (content.Contains("ProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).ProvisionVMAgent = (bool?) content.GetValueForProperty("ProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).ProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).ProvisionVMConfigAgent = (bool?) content.GetValueForProperty("ProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).ProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("SshPublicKey")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).SshPublicKey = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]) content.GetValueForProperty("SshPublicKey",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal)this).SshPublicKey, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshPublicKeyTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + } + /// Windows Configuration for the virtual machine instance + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesOSProfileWindowsConfigurationTypeConverter))] + public partial interface IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileWindowsConfiguration.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileWindowsConfiguration.TypeConverter.cs new file mode 100644 index 000000000000..bd4569c52c5c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileWindowsConfiguration.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineInstancePropertiesOSProfileWindowsConfigurationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineInstancePropertiesOSProfileWindowsConfiguration.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesOSProfileWindowsConfiguration.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesOSProfileWindowsConfiguration.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileWindowsConfiguration.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileWindowsConfiguration.cs new file mode 100644 index 000000000000..bf3e48de1573 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileWindowsConfiguration.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Windows Configuration for the virtual machine instance + public partial class VirtualMachineInstancePropertiesOSProfileWindowsConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal + { + + /// Backing field for property. + private bool? _enableAutomaticUpdate; + + /// Whether to EnableAutomaticUpdates on the machine + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public bool? EnableAutomaticUpdate { get => this._enableAutomaticUpdate; set => this._enableAutomaticUpdate = value; } + + /// Internal Acessors for Ssh + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal.Ssh { get => (this._ssh = this._ssh ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshConfiguration()); set { {_ssh = value;} } } + + /// Backing field for property. + private bool? _provisionVMAgent; + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public bool? ProvisionVMAgent { get => this._provisionVMAgent; set => this._provisionVMAgent = value; } + + /// Backing field for property. + private bool? _provisionVMConfigAgent; + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public bool? ProvisionVMConfigAgent { get => this._provisionVMConfigAgent; set => this._provisionVMConfigAgent = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration _ssh; + + /// Specifies the ssh key configuration for Windows OS. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration Ssh { get => (this._ssh = this._ssh ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshConfiguration()); set => this._ssh = value; } + + /// The list of SSH public keys used to authenticate with linux based VMs. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] SshPublicKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfigurationInternal)Ssh).PublicKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfigurationInternal)Ssh).PublicKey = value ?? null /* arrayOf */; } + + /// Backing field for property. + private string _timeZone; + + /// TimeZone for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string TimeZone { get => this._timeZone; set => this._timeZone = value; } + + /// + /// Creates an new instance. + /// + public VirtualMachineInstancePropertiesOSProfileWindowsConfiguration() + { + + } + } + /// Windows Configuration for the virtual machine instance + public partial interface IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Whether to EnableAutomaticUpdates on the machine + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Whether to EnableAutomaticUpdates on the machine", + SerializedName = @"enableAutomaticUpdates", + PossibleTypes = new [] { typeof(bool) })] + bool? EnableAutomaticUpdate { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? ProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? ProvisionVMConfigAgent { get; set; } + /// The list of SSH public keys used to authenticate with linux based VMs. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of SSH public keys used to authenticate with linux based VMs.", + SerializedName = @"publicKeys", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] SshPublicKey { get; set; } + /// TimeZone for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"TimeZone for the virtual machine instance", + SerializedName = @"timeZone", + PossibleTypes = new [] { typeof(string) })] + string TimeZone { get; set; } + + } + /// Windows Configuration for the virtual machine instance + internal partial interface IVirtualMachineInstancePropertiesOSProfileWindowsConfigurationInternal + + { + /// Whether to EnableAutomaticUpdates on the machine + bool? EnableAutomaticUpdate { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + bool? ProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + bool? ProvisionVMConfigAgent { get; set; } + /// Specifies the ssh key configuration for Windows OS. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshConfiguration Ssh { get; set; } + /// The list of SSH public keys used to authenticate with linux based VMs. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] SshPublicKey { get; set; } + /// TimeZone for the virtual machine instance + string TimeZone { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileWindowsConfiguration.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileWindowsConfiguration.json.cs new file mode 100644 index 000000000000..d92802679b3b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesOSProfileWindowsConfiguration.json.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Windows Configuration for the virtual machine instance + public partial class VirtualMachineInstancePropertiesOSProfileWindowsConfiguration + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesOSProfileWindowsConfiguration FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualMachineInstancePropertiesOSProfileWindowsConfiguration(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._ssh ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._ssh.ToJson(null,serializationMode) : null, "ssh" ,container.Add ); + AddIf( null != this._enableAutomaticUpdate ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonBoolean((bool)this._enableAutomaticUpdate) : null, "enableAutomaticUpdates" ,container.Add ); + AddIf( null != (((object)this._timeZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._timeZone.ToString()) : null, "timeZone" ,container.Add ); + AddIf( null != this._provisionVMAgent ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonBoolean((bool)this._provisionVMAgent) : null, "provisionVMAgent" ,container.Add ); + AddIf( null != this._provisionVMConfigAgent ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonBoolean((bool)this._provisionVMConfigAgent) : null, "provisionVMConfigAgent" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineInstancePropertiesOSProfileWindowsConfiguration(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_ssh = If( json?.PropertyT("ssh"), out var __jsonSsh) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.SshConfiguration.FromJson(__jsonSsh) : Ssh;} + {_enableAutomaticUpdate = If( json?.PropertyT("enableAutomaticUpdates"), out var __jsonEnableAutomaticUpdates) ? (bool?)__jsonEnableAutomaticUpdates : EnableAutomaticUpdate;} + {_timeZone = If( json?.PropertyT("timeZone"), out var __jsonTimeZone) ? (string)__jsonTimeZone : (string)TimeZone;} + {_provisionVMAgent = If( json?.PropertyT("provisionVMAgent"), out var __jsonProvisionVMAgent) ? (bool?)__jsonProvisionVMAgent : ProvisionVMAgent;} + {_provisionVMConfigAgent = If( json?.PropertyT("provisionVMConfigAgent"), out var __jsonProvisionVMConfigAgent) ? (bool?)__jsonProvisionVMConfigAgent : ProvisionVMConfigAgent;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfile.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfile.PowerShell.cs new file mode 100644 index 000000000000..b95eec0d65b3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfile.PowerShell.cs @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// SecurityProfile - Specifies the security settings for the virtual machine instance. + /// + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesSecurityProfileTypeConverter))] + public partial class VirtualMachineInstancePropertiesSecurityProfile + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfile DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineInstancePropertiesSecurityProfile(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfile DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineInstancePropertiesSecurityProfile(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfile FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineInstancePropertiesSecurityProfile(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("UefiSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)this).UefiSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings) content.GetValueForProperty("UefiSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)this).UefiSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesSecurityProfileUefiSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("EnableTpm")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)this).EnableTpm = (bool?) content.GetValueForProperty("EnableTpm",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)this).EnableTpm, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("SecurityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)this).SecurityType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes?) content.GetValueForProperty("SecurityType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)this).SecurityType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes.CreateFrom); + } + if (content.Contains("UefiSettingSecureBootEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)this).UefiSettingSecureBootEnabled = (bool?) content.GetValueForProperty("UefiSettingSecureBootEnabled",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)this).UefiSettingSecureBootEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineInstancePropertiesSecurityProfile(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("UefiSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)this).UefiSetting = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings) content.GetValueForProperty("UefiSetting",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)this).UefiSetting, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesSecurityProfileUefiSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("EnableTpm")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)this).EnableTpm = (bool?) content.GetValueForProperty("EnableTpm",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)this).EnableTpm, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("SecurityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)this).SecurityType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes?) content.GetValueForProperty("SecurityType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)this).SecurityType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes.CreateFrom); + } + if (content.Contains("UefiSettingSecureBootEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)this).UefiSettingSecureBootEnabled = (bool?) content.GetValueForProperty("UefiSettingSecureBootEnabled",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal)this).UefiSettingSecureBootEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializePSObject(content); + } + } + /// SecurityProfile - Specifies the security settings for the virtual machine instance. + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesSecurityProfileTypeConverter))] + public partial interface IVirtualMachineInstancePropertiesSecurityProfile + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfile.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfile.TypeConverter.cs new file mode 100644 index 000000000000..9c6d07ecbd84 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfile.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineInstancePropertiesSecurityProfileTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfile ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfile).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineInstancePropertiesSecurityProfile.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesSecurityProfile.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesSecurityProfile.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfile.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfile.cs new file mode 100644 index 000000000000..ce87abdd09ec --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfile.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// SecurityProfile - Specifies the security settings for the virtual machine instance. + /// + public partial class VirtualMachineInstancePropertiesSecurityProfile : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfile, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal + { + + /// Backing field for property. + private bool? _enableTpm; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public bool? EnableTpm { get => this._enableTpm; set => this._enableTpm = value; } + + /// Internal Acessors for UefiSetting + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileInternal.UefiSetting { get => (this._uefiSetting = this._uefiSetting ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesSecurityProfileUefiSettings()); set { {_uefiSetting = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes? _securityType; + + /// + /// Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for SecurityType + /// to function. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes? SecurityType { get => this._securityType; set => this._securityType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings _uefiSetting; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings UefiSetting { get => (this._uefiSetting = this._uefiSetting ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesSecurityProfileUefiSettings()); set => this._uefiSetting = value; } + + /// + /// Specifies whether secure boot should be enabled on the virtual machine instance. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? UefiSettingSecureBootEnabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettingsInternal)UefiSetting).SecureBootEnabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettingsInternal)UefiSetting).SecureBootEnabled = value ?? default(bool); } + + /// + /// Creates an new instance. + /// + public VirtualMachineInstancePropertiesSecurityProfile() + { + + } + } + /// SecurityProfile - Specifies the security settings for the virtual machine instance. + public partial interface IVirtualMachineInstancePropertiesSecurityProfile : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"enableTPM", + PossibleTypes = new [] { typeof(bool) })] + bool? EnableTpm { get; set; } + /// + /// Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for SecurityType + /// to function. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for SecurityType to function.", + SerializedName = @"securityType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes? SecurityType { get; set; } + /// + /// Specifies whether secure boot should be enabled on the virtual machine instance. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies whether secure boot should be enabled on the virtual machine instance.", + SerializedName = @"secureBootEnabled", + PossibleTypes = new [] { typeof(bool) })] + bool? UefiSettingSecureBootEnabled { get; set; } + + } + /// SecurityProfile - Specifies the security settings for the virtual machine instance. + internal partial interface IVirtualMachineInstancePropertiesSecurityProfileInternal + + { + bool? EnableTpm { get; set; } + /// + /// Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for SecurityType + /// to function. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes? SecurityType { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings UefiSetting { get; set; } + /// + /// Specifies whether secure boot should be enabled on the virtual machine instance. + /// + bool? UefiSettingSecureBootEnabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfile.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfile.json.cs new file mode 100644 index 000000000000..21fb82214a62 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfile.json.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// SecurityProfile - Specifies the security settings for the virtual machine instance. + /// + public partial class VirtualMachineInstancePropertiesSecurityProfile + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfile. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfile. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfile FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualMachineInstancePropertiesSecurityProfile(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._uefiSetting ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._uefiSetting.ToJson(null,serializationMode) : null, "uefiSettings" ,container.Add ); + AddIf( null != this._enableTpm ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonBoolean((bool)this._enableTpm) : null, "enableTPM" ,container.Add ); + AddIf( null != (((object)this._securityType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._securityType.ToString()) : null, "securityType" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineInstancePropertiesSecurityProfile(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_uefiSetting = If( json?.PropertyT("uefiSettings"), out var __jsonUefiSettings) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesSecurityProfileUefiSettings.FromJson(__jsonUefiSettings) : UefiSetting;} + {_enableTpm = If( json?.PropertyT("enableTPM"), out var __jsonEnableTpm) ? (bool?)__jsonEnableTpm : EnableTpm;} + {_securityType = If( json?.PropertyT("securityType"), out var __jsonSecurityType) ? (string)__jsonSecurityType : (string)SecurityType;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfileUefiSettings.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfileUefiSettings.PowerShell.cs new file mode 100644 index 000000000000..20172a843fb9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfileUefiSettings.PowerShell.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesSecurityProfileUefiSettingsTypeConverter))] + public partial class VirtualMachineInstancePropertiesSecurityProfileUefiSettings + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineInstancePropertiesSecurityProfileUefiSettings(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineInstancePropertiesSecurityProfileUefiSettings(content); + } + + /// + /// Creates a new instance of , deserializing the + /// content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineInstancePropertiesSecurityProfileUefiSettings(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SecureBootEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettingsInternal)this).SecureBootEnabled = (bool?) content.GetValueForProperty("SecureBootEnabled",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettingsInternal)this).SecureBootEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineInstancePropertiesSecurityProfileUefiSettings(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SecureBootEnabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettingsInternal)this).SecureBootEnabled = (bool?) content.GetValueForProperty("SecureBootEnabled",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettingsInternal)this).SecureBootEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializePSObject(content); + } + } + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesSecurityProfileUefiSettingsTypeConverter))] + public partial interface IVirtualMachineInstancePropertiesSecurityProfileUefiSettings + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfileUefiSettings.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfileUefiSettings.TypeConverter.cs new file mode 100644 index 000000000000..ca20fc69e392 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfileUefiSettings.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineInstancePropertiesSecurityProfileUefiSettingsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineInstancePropertiesSecurityProfileUefiSettings.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesSecurityProfileUefiSettings.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesSecurityProfileUefiSettings.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfileUefiSettings.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfileUefiSettings.cs new file mode 100644 index 000000000000..79a21638a6a7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfileUefiSettings.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class VirtualMachineInstancePropertiesSecurityProfileUefiSettings : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettingsInternal + { + + /// Backing field for property. + private bool? _secureBootEnabled; + + /// + /// Specifies whether secure boot should be enabled on the virtual machine instance. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public bool? SecureBootEnabled { get => this._secureBootEnabled; set => this._secureBootEnabled = value; } + + /// + /// Creates an new instance. + /// + public VirtualMachineInstancePropertiesSecurityProfileUefiSettings() + { + + } + } + public partial interface IVirtualMachineInstancePropertiesSecurityProfileUefiSettings : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// + /// Specifies whether secure boot should be enabled on the virtual machine instance. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies whether secure boot should be enabled on the virtual machine instance.", + SerializedName = @"secureBootEnabled", + PossibleTypes = new [] { typeof(bool) })] + bool? SecureBootEnabled { get; set; } + + } + internal partial interface IVirtualMachineInstancePropertiesSecurityProfileUefiSettingsInternal + + { + /// + /// Specifies whether secure boot should be enabled on the virtual machine instance. + /// + bool? SecureBootEnabled { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfileUefiSettings.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfileUefiSettings.json.cs new file mode 100644 index 000000000000..81e5401d4227 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesSecurityProfileUefiSettings.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class VirtualMachineInstancePropertiesSecurityProfileUefiSettings + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesSecurityProfileUefiSettings FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualMachineInstancePropertiesSecurityProfileUefiSettings(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._secureBootEnabled ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonBoolean((bool)this._secureBootEnabled) : null, "secureBootEnabled" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineInstancePropertiesSecurityProfileUefiSettings(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_secureBootEnabled = If( json?.PropertyT("secureBootEnabled"), out var __jsonSecureBootEnabled) ? (bool?)__jsonSecureBootEnabled : SecureBootEnabled;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfile.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfile.PowerShell.cs new file mode 100644 index 000000000000..aafe0685abc5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfile.PowerShell.cs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// StorageProfile - contains information about the disks and storage information for the virtual machine instance + /// + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesStorageProfileTypeConverter))] + public partial class VirtualMachineInstancePropertiesStorageProfile + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfile DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineInstancePropertiesStorageProfile(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfile DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineInstancePropertiesStorageProfile(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfile FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineInstancePropertiesStorageProfile(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ImageReference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).ImageReference = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference) content.GetValueForProperty("ImageReference",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).ImageReference, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileImageReferenceTypeConverter.ConvertFrom); + } + if (content.Contains("OSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).OSDisk = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk) content.GetValueForProperty("OSDisk",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).OSDisk, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileOSDiskTypeConverter.ConvertFrom); + } + if (content.Contains("DataDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).DataDisk = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem[]) content.GetValueForProperty("DataDisk",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).DataDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileDataDisksItemTypeConverter.ConvertFrom)); + } + if (content.Contains("VMConfigStoragePathId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).VMConfigStoragePathId = (string) content.GetValueForProperty("VMConfigStoragePathId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).VMConfigStoragePathId, global::System.Convert.ToString); + } + if (content.Contains("ImageReferenceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).ImageReferenceId = (string) content.GetValueForProperty("ImageReferenceId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).ImageReferenceId, global::System.Convert.ToString); + } + if (content.Contains("OSDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).OSDiskId = (string) content.GetValueForProperty("OSDiskId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).OSDiskId, global::System.Convert.ToString); + } + if (content.Contains("OSDiskOstype")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).OSDiskOstype = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes?) content.GetValueForProperty("OSDiskOstype",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).OSDiskOstype, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineInstancePropertiesStorageProfile(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ImageReference")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).ImageReference = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference) content.GetValueForProperty("ImageReference",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).ImageReference, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileImageReferenceTypeConverter.ConvertFrom); + } + if (content.Contains("OSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).OSDisk = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk) content.GetValueForProperty("OSDisk",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).OSDisk, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileOSDiskTypeConverter.ConvertFrom); + } + if (content.Contains("DataDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).DataDisk = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem[]) content.GetValueForProperty("DataDisk",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).DataDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileDataDisksItemTypeConverter.ConvertFrom)); + } + if (content.Contains("VMConfigStoragePathId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).VMConfigStoragePathId = (string) content.GetValueForProperty("VMConfigStoragePathId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).VMConfigStoragePathId, global::System.Convert.ToString); + } + if (content.Contains("ImageReferenceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).ImageReferenceId = (string) content.GetValueForProperty("ImageReferenceId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).ImageReferenceId, global::System.Convert.ToString); + } + if (content.Contains("OSDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).OSDiskId = (string) content.GetValueForProperty("OSDiskId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).OSDiskId, global::System.Convert.ToString); + } + if (content.Contains("OSDiskOstype")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).OSDiskOstype = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes?) content.GetValueForProperty("OSDiskOstype",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal)this).OSDiskOstype, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes.CreateFrom); + } + AfterDeserializePSObject(content); + } + } + /// StorageProfile - contains information about the disks and storage information for the virtual machine instance + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesStorageProfileTypeConverter))] + public partial interface IVirtualMachineInstancePropertiesStorageProfile + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfile.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfile.TypeConverter.cs new file mode 100644 index 000000000000..ca9a595c4608 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfile.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineInstancePropertiesStorageProfileTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfile ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfile).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineInstancePropertiesStorageProfile.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesStorageProfile.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesStorageProfile.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfile.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfile.cs new file mode 100644 index 000000000000..3b1672d5ecd3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfile.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// StorageProfile - contains information about the disks and storage information for the virtual machine instance + /// + public partial class VirtualMachineInstancePropertiesStorageProfile : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfile, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem[] _dataDisk; + + /// adds data disks to the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem[] DataDisk { get => this._dataDisk; set => this._dataDisk = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference _imageReference; + + /// Which Image to use for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference ImageReference { get => (this._imageReference = this._imageReference ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileImageReference()); set => this._imageReference = value; } + + /// Resource ID of the image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ImageReferenceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReferenceInternal)ImageReference).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReferenceInternal)ImageReference).Id = value ?? null; } + + /// Internal Acessors for ImageReference + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal.ImageReference { get => (this._imageReference = this._imageReference ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileImageReference()); set { {_imageReference = value;} } } + + /// Internal Acessors for OSDisk + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileInternal.OSDisk { get => (this._oSDisk = this._oSDisk ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileOSDisk()); set { {_oSDisk = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk _oSDisk; + + /// VHD to attach as OS disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk OSDisk { get => (this._oSDisk = this._oSDisk ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileOSDisk()); set => this._oSDisk = value; } + + /// Resource ID of the OS disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string OSDiskId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDiskInternal)OSDisk).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDiskInternal)OSDisk).Id = value ?? null; } + + /// + /// This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or + /// a specialized VHD. Possible values are: **Windows,** **Linux.** + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes? OSDiskOstype { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDiskInternal)OSDisk).OSType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDiskInternal)OSDisk).OSType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes)""); } + + /// Backing field for property. + private string _vMConfigStoragePathId; + + /// Id of the storage container that hosts the VM configuration file + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string VMConfigStoragePathId { get => this._vMConfigStoragePathId; set => this._vMConfigStoragePathId = value; } + + /// + /// Creates an new instance. + /// + public VirtualMachineInstancePropertiesStorageProfile() + { + + } + } + /// StorageProfile - contains information about the disks and storage information for the virtual machine instance + public partial interface IVirtualMachineInstancePropertiesStorageProfile : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// adds data disks to the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"adds data disks to the virtual machine instance", + SerializedName = @"dataDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem[] DataDisk { get; set; } + /// Resource ID of the image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource ID of the image", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string ImageReferenceId { get; set; } + /// Resource ID of the OS disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource ID of the OS disk", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string OSDiskId { get; set; } + /// + /// This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or + /// a specialized VHD. Possible values are: **Windows,** **Linux.** + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. Possible values are: **Windows,** **Linux.**", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes? OSDiskOstype { get; set; } + /// Id of the storage container that hosts the VM configuration file + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Id of the storage container that hosts the VM configuration file", + SerializedName = @"vmConfigStoragePathId", + PossibleTypes = new [] { typeof(string) })] + string VMConfigStoragePathId { get; set; } + + } + /// StorageProfile - contains information about the disks and storage information for the virtual machine instance + internal partial interface IVirtualMachineInstancePropertiesStorageProfileInternal + + { + /// adds data disks to the virtual machine instance + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem[] DataDisk { get; set; } + /// Which Image to use for the virtual machine instance + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference ImageReference { get; set; } + /// Resource ID of the image + string ImageReferenceId { get; set; } + /// VHD to attach as OS disk + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk OSDisk { get; set; } + /// Resource ID of the OS disk + string OSDiskId { get; set; } + /// + /// This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or + /// a specialized VHD. Possible values are: **Windows,** **Linux.** + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes? OSDiskOstype { get; set; } + /// Id of the storage container that hosts the VM configuration file + string VMConfigStoragePathId { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfile.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfile.json.cs new file mode 100644 index 000000000000..b6ea73c6eb9c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfile.json.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// StorageProfile - contains information about the disks and storage information for the virtual machine instance + /// + public partial class VirtualMachineInstancePropertiesStorageProfile + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfile. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfile. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfile FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualMachineInstancePropertiesStorageProfile(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._imageReference ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._imageReference.ToJson(null,serializationMode) : null, "imageReference" ,container.Add ); + AddIf( null != this._oSDisk ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._oSDisk.ToJson(null,serializationMode) : null, "osDisk" ,container.Add ); + if (null != this._dataDisk) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._dataDisk ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("dataDisks",__w); + } + AddIf( null != (((object)this._vMConfigStoragePathId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._vMConfigStoragePathId.ToString()) : null, "vmConfigStoragePathId" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineInstancePropertiesStorageProfile(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_imageReference = If( json?.PropertyT("imageReference"), out var __jsonImageReference) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileImageReference.FromJson(__jsonImageReference) : ImageReference;} + {_oSDisk = If( json?.PropertyT("osDisk"), out var __jsonOSDisk) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileOSDisk.FromJson(__jsonOSDisk) : OSDisk;} + {_dataDisk = If( json?.PropertyT("dataDisks"), out var __jsonDataDisks) ? If( __jsonDataDisks as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstancePropertiesStorageProfileDataDisksItem.FromJson(__u) )) ))() : null : DataDisk;} + {_vMConfigStoragePathId = If( json?.PropertyT("vmConfigStoragePathId"), out var __jsonVMConfigStoragePathId) ? (string)__jsonVMConfigStoragePathId : (string)VMConfigStoragePathId;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileDataDisksItem.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileDataDisksItem.PowerShell.cs new file mode 100644 index 000000000000..a7758243ddc1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileDataDisksItem.PowerShell.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesStorageProfileDataDisksItemTypeConverter))] + public partial class VirtualMachineInstancePropertiesStorageProfileDataDisksItem + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineInstancePropertiesStorageProfileDataDisksItem(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineInstancePropertiesStorageProfileDataDisksItem(content); + } + + /// + /// Creates a new instance of , deserializing the + /// content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineInstancePropertiesStorageProfileDataDisksItem(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItemInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItemInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineInstancePropertiesStorageProfileDataDisksItem(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItemInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItemInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesStorageProfileDataDisksItemTypeConverter))] + public partial interface IVirtualMachineInstancePropertiesStorageProfileDataDisksItem + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileDataDisksItem.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileDataDisksItem.TypeConverter.cs new file mode 100644 index 000000000000..e474699b8a77 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileDataDisksItem.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineInstancePropertiesStorageProfileDataDisksItemTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineInstancePropertiesStorageProfileDataDisksItem.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesStorageProfileDataDisksItem.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesStorageProfileDataDisksItem.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileDataDisksItem.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileDataDisksItem.cs new file mode 100644 index 000000000000..0edd54b27ed0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileDataDisksItem.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class VirtualMachineInstancePropertiesStorageProfileDataDisksItem : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItemInternal + { + + /// Backing field for property. + private string _id; + + /// Resource ID of the data disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// + /// Creates an new instance. + /// + public VirtualMachineInstancePropertiesStorageProfileDataDisksItem() + { + + } + } + public partial interface IVirtualMachineInstancePropertiesStorageProfileDataDisksItem : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Resource ID of the data disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource ID of the data disk", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + + } + internal partial interface IVirtualMachineInstancePropertiesStorageProfileDataDisksItemInternal + + { + /// Resource ID of the data disk + string Id { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileDataDisksItem.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileDataDisksItem.json.cs new file mode 100644 index 000000000000..79b4ef95954d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileDataDisksItem.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class VirtualMachineInstancePropertiesStorageProfileDataDisksItem + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualMachineInstancePropertiesStorageProfileDataDisksItem(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineInstancePropertiesStorageProfileDataDisksItem(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileImageReference.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileImageReference.PowerShell.cs new file mode 100644 index 000000000000..bc242c9a9661 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileImageReference.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Which Image to use for the virtual machine instance + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesStorageProfileImageReferenceTypeConverter))] + public partial class VirtualMachineInstancePropertiesStorageProfileImageReference + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineInstancePropertiesStorageProfileImageReference(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineInstancePropertiesStorageProfileImageReference(content); + } + + /// + /// Creates a new instance of , deserializing the + /// content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineInstancePropertiesStorageProfileImageReference(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReferenceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReferenceInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineInstancePropertiesStorageProfileImageReference(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReferenceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReferenceInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Which Image to use for the virtual machine instance + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesStorageProfileImageReferenceTypeConverter))] + public partial interface IVirtualMachineInstancePropertiesStorageProfileImageReference + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileImageReference.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileImageReference.TypeConverter.cs new file mode 100644 index 000000000000..ea9534b62a86 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileImageReference.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineInstancePropertiesStorageProfileImageReferenceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineInstancePropertiesStorageProfileImageReference.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesStorageProfileImageReference.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesStorageProfileImageReference.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileImageReference.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileImageReference.cs new file mode 100644 index 000000000000..5292a5f2d603 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileImageReference.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Which Image to use for the virtual machine instance + public partial class VirtualMachineInstancePropertiesStorageProfileImageReference : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReferenceInternal + { + + /// Backing field for property. + private string _id; + + /// Resource ID of the image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// + /// Creates an new instance. + /// + public VirtualMachineInstancePropertiesStorageProfileImageReference() + { + + } + } + /// Which Image to use for the virtual machine instance + public partial interface IVirtualMachineInstancePropertiesStorageProfileImageReference : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Resource ID of the image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource ID of the image", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + + } + /// Which Image to use for the virtual machine instance + internal partial interface IVirtualMachineInstancePropertiesStorageProfileImageReferenceInternal + + { + /// Resource ID of the image + string Id { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileImageReference.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileImageReference.json.cs new file mode 100644 index 000000000000..3a5b8e94cf85 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileImageReference.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Which Image to use for the virtual machine instance + public partial class VirtualMachineInstancePropertiesStorageProfileImageReference + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileImageReference FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualMachineInstancePropertiesStorageProfileImageReference(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineInstancePropertiesStorageProfileImageReference(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileOSDisk.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileOSDisk.PowerShell.cs new file mode 100644 index 000000000000..4eb71ea19817 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileOSDisk.PowerShell.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// VHD to attach as OS disk + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesStorageProfileOSDiskTypeConverter))] + public partial class VirtualMachineInstancePropertiesStorageProfileOSDisk + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineInstancePropertiesStorageProfileOSDisk(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineInstancePropertiesStorageProfileOSDisk(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineInstancePropertiesStorageProfileOSDisk(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDiskInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDiskInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDiskInternal)this).OSType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes?) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDiskInternal)this).OSType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineInstancePropertiesStorageProfileOSDisk(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDiskInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDiskInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDiskInternal)this).OSType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes?) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDiskInternal)this).OSType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes.CreateFrom); + } + AfterDeserializePSObject(content); + } + } + /// VHD to attach as OS disk + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstancePropertiesStorageProfileOSDiskTypeConverter))] + public partial interface IVirtualMachineInstancePropertiesStorageProfileOSDisk + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileOSDisk.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileOSDisk.TypeConverter.cs new file mode 100644 index 000000000000..c8e61924ab4b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileOSDisk.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineInstancePropertiesStorageProfileOSDiskTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a + /// type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineInstancePropertiesStorageProfileOSDisk.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesStorageProfileOSDisk.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineInstancePropertiesStorageProfileOSDisk.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileOSDisk.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileOSDisk.cs new file mode 100644 index 000000000000..dd47466f1f45 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileOSDisk.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// VHD to attach as OS disk + public partial class VirtualMachineInstancePropertiesStorageProfileOSDisk : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDiskInternal + { + + /// Backing field for property. + private string _id; + + /// Resource ID of the OS disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes? _oSType; + + /// + /// This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or + /// a specialized VHD. Possible values are: **Windows,** **Linux.** + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes? OSType { get => this._oSType; set => this._oSType = value; } + + /// + /// Creates an new instance. + /// + public VirtualMachineInstancePropertiesStorageProfileOSDisk() + { + + } + } + /// VHD to attach as OS disk + public partial interface IVirtualMachineInstancePropertiesStorageProfileOSDisk : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// Resource ID of the OS disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource ID of the OS disk", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + /// + /// This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or + /// a specialized VHD. Possible values are: **Windows,** **Linux.** + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. Possible values are: **Windows,** **Linux.**", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes? OSType { get; set; } + + } + /// VHD to attach as OS disk + internal partial interface IVirtualMachineInstancePropertiesStorageProfileOSDiskInternal + + { + /// Resource ID of the OS disk + string Id { get; set; } + /// + /// This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or + /// a specialized VHD. Possible values are: **Windows,** **Linux.** + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes? OSType { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileOSDisk.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileOSDisk.json.cs new file mode 100644 index 000000000000..7f91a752113d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstancePropertiesStorageProfileOSDisk.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// VHD to attach as OS disk + public partial class VirtualMachineInstancePropertiesStorageProfileOSDisk + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileOSDisk FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualMachineInstancePropertiesStorageProfileOSDisk(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineInstancePropertiesStorageProfileOSDisk(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatus.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatus.PowerShell.cs new file mode 100644 index 000000000000..40fabc9fa050 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatus.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The observed state of virtual machine instances + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstanceStatusTypeConverter))] + public partial class VirtualMachineInstanceStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineInstanceStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineInstanceStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineInstanceStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("PowerState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).PowerState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum?) content.GetValueForProperty("PowerState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).PowerState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum.CreateFrom); + } + if (content.Contains("ProvisioningStatusStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).ProvisioningStatusStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatusStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).ProvisioningStatusStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineInstanceStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).ProvisioningStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus) content.GetValueForProperty("ProvisioningStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).ProvisioningStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceStatusProvisioningStatusTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("PowerState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).PowerState = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum?) content.GetValueForProperty("PowerState",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).PowerState, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum.CreateFrom); + } + if (content.Contains("ProvisioningStatusStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).ProvisioningStatusStatus = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("ProvisioningStatusStatus",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).ProvisioningStatusStatus, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + if (content.Contains("ProvisioningStatusOperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).ProvisioningStatusOperationId = (string) content.GetValueForProperty("ProvisioningStatusOperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal)this).ProvisioningStatusOperationId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// The observed state of virtual machine instances + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstanceStatusTypeConverter))] + public partial interface IVirtualMachineInstanceStatus + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatus.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatus.TypeConverter.cs new file mode 100644 index 000000000000..2a0f10cb4fc8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatus.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineInstanceStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineInstanceStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineInstanceStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineInstanceStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatus.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatus.cs new file mode 100644 index 000000000000..e9f30d407ea4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatus.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The observed state of virtual machine instances + public partial class VirtualMachineInstanceStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatus, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal + { + + /// Backing field for property. + private string _errorCode; + + /// VirtualMachine provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ErrorCode { get => this._errorCode; set => this._errorCode = value; } + + /// Backing field for property. + private string _errorMessage; + + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ErrorMessage { get => this._errorMessage; set => this._errorMessage = value; } + + /// Internal Acessors for ProvisioningStatus + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusInternal.ProvisioningStatus { get => (this._provisioningStatus = this._provisioningStatus ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceStatusProvisioningStatus()); set { {_provisioningStatus = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum? _powerState; + + /// The power state of the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum? PowerState { get => this._powerState; set => this._powerState = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus _provisioningStatus; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus ProvisioningStatus { get => (this._provisioningStatus = this._provisioningStatus ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceStatusProvisioningStatus()); set => this._provisioningStatus = value; } + + /// The ID of the operation performed on the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string ProvisioningStatusOperationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatusInternal)ProvisioningStatus).OperationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatusInternal)ProvisioningStatus).OperationId = value ?? null; } + + /// + /// The status of the operation performed on the virtual machine instance [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatusStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatusInternal)ProvisioningStatus).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatusInternal)ProvisioningStatus).Status = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status)""); } + + /// Creates an new instance. + public VirtualMachineInstanceStatus() + { + + } + } + /// The observed state of virtual machine instances + public partial interface IVirtualMachineInstanceStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// VirtualMachine provisioning error code + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VirtualMachine provisioning error code", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string ErrorCode { get; set; } + /// Descriptive error message + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Descriptive error message", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; set; } + /// The power state of the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The power state of the virtual machine instance", + SerializedName = @"powerState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum? PowerState { get; set; } + /// The ID of the operation performed on the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the virtual machine instance", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningStatusOperationId { get; set; } + /// + /// The status of the operation performed on the virtual machine instance [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the virtual machine instance [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatusStatus { get; set; } + + } + /// The observed state of virtual machine instances + internal partial interface IVirtualMachineInstanceStatusInternal + + { + /// VirtualMachine provisioning error code + string ErrorCode { get; set; } + /// Descriptive error message + string ErrorMessage { get; set; } + /// The power state of the virtual machine instance + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum? PowerState { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus ProvisioningStatus { get; set; } + /// The ID of the operation performed on the virtual machine instance + string ProvisioningStatusOperationId { get; set; } + /// + /// The status of the operation performed on the virtual machine instance [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? ProvisioningStatusStatus { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatus.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatus.json.cs new file mode 100644 index 000000000000..469e9ba0903a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatus.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The observed state of virtual machine instances + public partial class VirtualMachineInstanceStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualMachineInstanceStatus(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._provisioningStatus ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._provisioningStatus.ToJson(null,serializationMode) : null, "provisioningStatus" ,container.Add ); + AddIf( null != (((object)this._errorCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._errorCode.ToString()) : null, "errorCode" ,container.Add ); + AddIf( null != (((object)this._errorMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._errorMessage.ToString()) : null, "errorMessage" ,container.Add ); + AddIf( null != (((object)this._powerState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._powerState.ToString()) : null, "powerState" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineInstanceStatus(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provisioningStatus = If( json?.PropertyT("provisioningStatus"), out var __jsonProvisioningStatus) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceStatusProvisioningStatus.FromJson(__jsonProvisioningStatus) : ProvisioningStatus;} + {_errorCode = If( json?.PropertyT("errorCode"), out var __jsonErrorCode) ? (string)__jsonErrorCode : (string)ErrorCode;} + {_errorMessage = If( json?.PropertyT("errorMessage"), out var __jsonErrorMessage) ? (string)__jsonErrorMessage : (string)ErrorMessage;} + {_powerState = If( json?.PropertyT("powerState"), out var __jsonPowerState) ? (string)__jsonPowerState : (string)PowerState;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatusProvisioningStatus.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatusProvisioningStatus.PowerShell.cs new file mode 100644 index 000000000000..647f70f88bac --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatusProvisioningStatus.PowerShell.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstanceStatusProvisioningStatusTypeConverter))] + public partial class VirtualMachineInstanceStatusProvisioningStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineInstanceStatusProvisioningStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineInstanceStatusProvisioningStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineInstanceStatusProvisioningStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatusInternal)this).OperationId = (string) content.GetValueForProperty("OperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatusInternal)this).OperationId, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatusInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatusInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineInstanceStatusProvisioningStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatusInternal)this).OperationId = (string) content.GetValueForProperty("OperationId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatusInternal)this).OperationId, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatusInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatusInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status.CreateFrom); + } + AfterDeserializePSObject(content); + } + } + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstanceStatusProvisioningStatusTypeConverter))] + public partial interface IVirtualMachineInstanceStatusProvisioningStatus + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatusProvisioningStatus.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatusProvisioningStatus.TypeConverter.cs new file mode 100644 index 000000000000..33a2a70b97c3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatusProvisioningStatus.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineInstanceStatusProvisioningStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineInstanceStatusProvisioningStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineInstanceStatusProvisioningStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineInstanceStatusProvisioningStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatusProvisioningStatus.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatusProvisioningStatus.cs new file mode 100644 index 000000000000..e9a35260c767 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatusProvisioningStatus.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class VirtualMachineInstanceStatusProvisioningStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatusInternal + { + + /// Backing field for property. + private string _operationId; + + /// The ID of the operation performed on the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string OperationId { get => this._operationId; set => this._operationId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? _status; + + /// + /// The status of the operation performed on the virtual machine instance [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? Status { get => this._status; set => this._status = value; } + + /// + /// Creates an new instance. + /// + public VirtualMachineInstanceStatusProvisioningStatus() + { + + } + } + public partial interface IVirtualMachineInstanceStatusProvisioningStatus : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The ID of the operation performed on the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the operation performed on the virtual machine instance", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string OperationId { get; set; } + /// + /// The status of the operation performed on the virtual machine instance [Succeeded, Failed, InProgress] + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the operation performed on the virtual machine instance [Succeeded, Failed, InProgress]", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? Status { get; set; } + + } + internal partial interface IVirtualMachineInstanceStatusProvisioningStatusInternal + + { + /// The ID of the operation performed on the virtual machine instance + string OperationId { get; set; } + /// + /// The status of the operation performed on the virtual machine instance [Succeeded, Failed, InProgress] + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status? Status { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatusProvisioningStatus.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatusProvisioningStatus.json.cs new file mode 100644 index 000000000000..9b75524197fb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceStatusProvisioningStatus.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class VirtualMachineInstanceStatusProvisioningStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceStatusProvisioningStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualMachineInstanceStatusProvisioningStatus(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._operationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._operationId.ToString()) : null, "operationId" ,container.Add ); + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineInstanceStatusProvisioningStatus(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_operationId = If( json?.PropertyT("operationId"), out var __jsonOperationId) ? (string)__jsonOperationId : (string)OperationId;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)Status;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateProperties.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateProperties.PowerShell.cs new file mode 100644 index 000000000000..9ec2f139b58b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateProperties.PowerShell.cs @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Defines the resource properties for the update. + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstanceUpdatePropertiesTypeConverter))] + public partial class VirtualMachineInstanceUpdateProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineInstanceUpdateProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineInstanceUpdateProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineInstanceUpdateProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HardwareProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).HardwareProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdate) content.GetValueForProperty("HardwareProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).HardwareProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HardwareProfileUpdateTypeConverter.ConvertFrom); + } + if (content.Contains("StorageProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).StorageProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdate) content.GetValueForProperty("StorageProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).StorageProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageProfileUpdateTypeConverter.ConvertFrom); + } + if (content.Contains("NetworkProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).NetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdate) content.GetValueForProperty("NetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).NetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkProfileUpdateTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).OSProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdate) content.GetValueForProperty("OSProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).OSProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateTypeConverter.ConvertFrom); + } + if (content.Contains("HardwareProfileVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).HardwareProfileVMSize = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum?) content.GetValueForProperty("HardwareProfileVMSize",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).HardwareProfileVMSize, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum.CreateFrom); + } + if (content.Contains("HardwareProfileProcessor")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).HardwareProfileProcessor = (int?) content.GetValueForProperty("HardwareProfileProcessor",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).HardwareProfileProcessor, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("HardwareProfileMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).HardwareProfileMemoryMb = (long?) content.GetValueForProperty("HardwareProfileMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).HardwareProfileMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StorageProfileDataDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).StorageProfileDataDisk = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem[]) content.GetValueForProperty("StorageProfileDataDisk",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).StorageProfileDataDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageProfileUpdateDataDisksItemTypeConverter.ConvertFrom)); + } + if (content.Contains("NetworkProfileNetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).NetworkProfileNetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem[]) content.GetValueForProperty("NetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).NetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkProfileUpdateNetworkInterfacesItemTypeConverter.ConvertFrom)); + } + if (content.Contains("OSProfileLinuxConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).OSProfileLinuxConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration) content.GetValueForProperty("OSProfileLinuxConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).OSProfileLinuxConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateLinuxConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileWindowsConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).OSProfileWindowsConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration) content.GetValueForProperty("OSProfileWindowsConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).OSProfileWindowsConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateWindowsConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileComputerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).OSProfileComputerName = (string) content.GetValueForProperty("OSProfileComputerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).OSProfileComputerName, global::System.Convert.ToString); + } + if (content.Contains("LinuxConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).LinuxConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).LinuxConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LinuxConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).LinuxConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).LinuxConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).WindowConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).WindowConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).WindowConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).WindowConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineInstanceUpdateProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HardwareProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).HardwareProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdate) content.GetValueForProperty("HardwareProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).HardwareProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HardwareProfileUpdateTypeConverter.ConvertFrom); + } + if (content.Contains("StorageProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).StorageProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdate) content.GetValueForProperty("StorageProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).StorageProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageProfileUpdateTypeConverter.ConvertFrom); + } + if (content.Contains("NetworkProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).NetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdate) content.GetValueForProperty("NetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).NetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkProfileUpdateTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).OSProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdate) content.GetValueForProperty("OSProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).OSProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateTypeConverter.ConvertFrom); + } + if (content.Contains("HardwareProfileVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).HardwareProfileVMSize = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum?) content.GetValueForProperty("HardwareProfileVMSize",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).HardwareProfileVMSize, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum.CreateFrom); + } + if (content.Contains("HardwareProfileProcessor")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).HardwareProfileProcessor = (int?) content.GetValueForProperty("HardwareProfileProcessor",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).HardwareProfileProcessor, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("HardwareProfileMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).HardwareProfileMemoryMb = (long?) content.GetValueForProperty("HardwareProfileMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).HardwareProfileMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StorageProfileDataDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).StorageProfileDataDisk = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem[]) content.GetValueForProperty("StorageProfileDataDisk",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).StorageProfileDataDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageProfileUpdateDataDisksItemTypeConverter.ConvertFrom)); + } + if (content.Contains("NetworkProfileNetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).NetworkProfileNetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem[]) content.GetValueForProperty("NetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).NetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkProfileUpdateNetworkInterfacesItemTypeConverter.ConvertFrom)); + } + if (content.Contains("OSProfileLinuxConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).OSProfileLinuxConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration) content.GetValueForProperty("OSProfileLinuxConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).OSProfileLinuxConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateLinuxConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileWindowsConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).OSProfileWindowsConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration) content.GetValueForProperty("OSProfileWindowsConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).OSProfileWindowsConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateWindowsConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileComputerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).OSProfileComputerName = (string) content.GetValueForProperty("OSProfileComputerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).OSProfileComputerName, global::System.Convert.ToString); + } + if (content.Contains("LinuxConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).LinuxConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).LinuxConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LinuxConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).LinuxConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).LinuxConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).WindowConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).WindowConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).WindowConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)this).WindowConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializePSObject(content); + } + } + /// Defines the resource properties for the update. + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstanceUpdatePropertiesTypeConverter))] + public partial interface IVirtualMachineInstanceUpdateProperties + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateProperties.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateProperties.TypeConverter.cs new file mode 100644 index 000000000000..d407052e05c0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateProperties.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineInstanceUpdatePropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineInstanceUpdateProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineInstanceUpdateProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineInstanceUpdateProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateProperties.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateProperties.cs new file mode 100644 index 000000000000..b3fdfefbd66d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateProperties.cs @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Defines the resource properties for the update. + public partial class VirtualMachineInstanceUpdateProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateProperties, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdate _hardwareProfile; + + /// + /// HardwareProfile - Specifies the hardware settings for the virtual machine instance. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdate HardwareProfile { get => (this._hardwareProfile = this._hardwareProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HardwareProfileUpdate()); set => this._hardwareProfile = value; } + + /// RAM in MB for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? HardwareProfileMemoryMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdateInternal)HardwareProfile).MemoryMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdateInternal)HardwareProfile).MemoryMb = value ?? default(long); } + + /// number of processors for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public int? HardwareProfileProcessor { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdateInternal)HardwareProfile).Processor; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdateInternal)HardwareProfile).Processor = value ?? default(int); } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum? HardwareProfileVMSize { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdateInternal)HardwareProfile).VMSize; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdateInternal)HardwareProfile).VMSize = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum)""); } + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? LinuxConfigurationProvisionVMAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)OSProfile).LinuxConfigurationProvisionVMAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)OSProfile).LinuxConfigurationProvisionVMAgent = value ?? default(bool); } + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? LinuxConfigurationProvisionVMConfigAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)OSProfile).LinuxConfigurationProvisionVMConfigAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)OSProfile).LinuxConfigurationProvisionVMConfigAgent = value ?? default(bool); } + + /// Internal Acessors for HardwareProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdate Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal.HardwareProfile { get => (this._hardwareProfile = this._hardwareProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HardwareProfileUpdate()); set { {_hardwareProfile = value;} } } + + /// Internal Acessors for NetworkProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdate Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal.NetworkProfile { get => (this._networkProfile = this._networkProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkProfileUpdate()); set { {_networkProfile = value;} } } + + /// Internal Acessors for OSProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdate Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal.OSProfile { get => (this._oSProfile = this._oSProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdate()); set { {_oSProfile = value;} } } + + /// Internal Acessors for OSProfileLinuxConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal.OSProfileLinuxConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)OSProfile).LinuxConfiguration; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)OSProfile).LinuxConfiguration = value; } + + /// Internal Acessors for OSProfileWindowsConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal.OSProfileWindowsConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)OSProfile).WindowsConfiguration; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)OSProfile).WindowsConfiguration = value; } + + /// Internal Acessors for StorageProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdate Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal.StorageProfile { get => (this._storageProfile = this._storageProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageProfileUpdate()); set { {_storageProfile = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdate _networkProfile; + + /// + /// NetworkProfile - describes the network update configuration the virtual machine instance + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdate NetworkProfile { get => (this._networkProfile = this._networkProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkProfileUpdate()); set => this._networkProfile = value; } + + /// + /// NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem[] NetworkProfileNetworkInterface { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateInternal)NetworkProfile).NetworkInterface; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateInternal)NetworkProfile).NetworkInterface = value ?? null /* arrayOf */; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdate _oSProfile; + + /// OsProfile - describes the update configuration of the operating system + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdate OSProfile { get => (this._oSProfile = this._oSProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdate()); set => this._oSProfile = value; } + + /// ComputerName - name of the computer + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string OSProfileComputerName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)OSProfile).ComputerName; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)OSProfile).ComputerName = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdate _storageProfile; + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdate StorageProfile { get => (this._storageProfile = this._storageProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageProfileUpdate()); set => this._storageProfile = value; } + + /// adds data disks to the virtual machine instance for the update call + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem[] StorageProfileDataDisk { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateInternal)StorageProfile).DataDisk; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateInternal)StorageProfile).DataDisk = value ?? null /* arrayOf */; } + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? WindowConfigurationProvisionVMAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)OSProfile).WindowConfigurationProvisionVMAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)OSProfile).WindowConfigurationProvisionVMAgent = value ?? default(bool); } + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? WindowConfigurationProvisionVMConfigAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)OSProfile).WindowConfigurationProvisionVMConfigAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateInternal)OSProfile).WindowConfigurationProvisionVMConfigAgent = value ?? default(bool); } + + /// Creates an new instance. + public VirtualMachineInstanceUpdateProperties() + { + + } + } + /// Defines the resource properties for the update. + public partial interface IVirtualMachineInstanceUpdateProperties : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// RAM in MB for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"RAM in MB for the virtual machine instance", + SerializedName = @"memoryMB", + PossibleTypes = new [] { typeof(long) })] + long? HardwareProfileMemoryMb { get; set; } + /// number of processors for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"number of processors for the virtual machine instance", + SerializedName = @"processors", + PossibleTypes = new [] { typeof(int) })] + int? HardwareProfileProcessor { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"vmSize", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum? HardwareProfileVMSize { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? LinuxConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? LinuxConfigurationProvisionVMConfigAgent { get; set; } + /// + /// NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance", + SerializedName = @"networkInterfaces", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem[] NetworkProfileNetworkInterface { get; set; } + /// ComputerName - name of the computer + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ComputerName - name of the computer", + SerializedName = @"computerName", + PossibleTypes = new [] { typeof(string) })] + string OSProfileComputerName { get; set; } + /// adds data disks to the virtual machine instance for the update call + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"adds data disks to the virtual machine instance for the update call", + SerializedName = @"dataDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem[] StorageProfileDataDisk { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? WindowConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? WindowConfigurationProvisionVMConfigAgent { get; set; } + + } + /// Defines the resource properties for the update. + internal partial interface IVirtualMachineInstanceUpdatePropertiesInternal + + { + /// + /// HardwareProfile - Specifies the hardware settings for the virtual machine instance. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdate HardwareProfile { get; set; } + /// RAM in MB for the virtual machine instance + long? HardwareProfileMemoryMb { get; set; } + /// number of processors for the virtual machine instance + int? HardwareProfileProcessor { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum? HardwareProfileVMSize { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + bool? LinuxConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + bool? LinuxConfigurationProvisionVMConfigAgent { get; set; } + /// + /// NetworkProfile - describes the network update configuration the virtual machine instance + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdate NetworkProfile { get; set; } + /// + /// NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem[] NetworkProfileNetworkInterface { get; set; } + /// OsProfile - describes the update configuration of the operating system + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdate OSProfile { get; set; } + /// ComputerName - name of the computer + string OSProfileComputerName { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration OSProfileLinuxConfiguration { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration OSProfileWindowsConfiguration { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdate StorageProfile { get; set; } + /// adds data disks to the virtual machine instance for the update call + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem[] StorageProfileDataDisk { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + bool? WindowConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + bool? WindowConfigurationProvisionVMConfigAgent { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateProperties.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateProperties.json.cs new file mode 100644 index 000000000000..5aaf431c3498 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateProperties.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Defines the resource properties for the update. + public partial class VirtualMachineInstanceUpdateProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualMachineInstanceUpdateProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._hardwareProfile ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._hardwareProfile.ToJson(null,serializationMode) : null, "hardwareProfile" ,container.Add ); + AddIf( null != this._storageProfile ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._storageProfile.ToJson(null,serializationMode) : null, "storageProfile" ,container.Add ); + AddIf( null != this._networkProfile ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._networkProfile.ToJson(null,serializationMode) : null, "networkProfile" ,container.Add ); + AddIf( null != this._oSProfile ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._oSProfile.ToJson(null,serializationMode) : null, "osProfile" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineInstanceUpdateProperties(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_hardwareProfile = If( json?.PropertyT("hardwareProfile"), out var __jsonHardwareProfile) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HardwareProfileUpdate.FromJson(__jsonHardwareProfile) : HardwareProfile;} + {_storageProfile = If( json?.PropertyT("storageProfile"), out var __jsonStorageProfile) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageProfileUpdate.FromJson(__jsonStorageProfile) : StorageProfile;} + {_networkProfile = If( json?.PropertyT("networkProfile"), out var __jsonNetworkProfile) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkProfileUpdate.FromJson(__jsonNetworkProfile) : NetworkProfile;} + {_oSProfile = If( json?.PropertyT("osProfile"), out var __jsonOSProfile) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdate.FromJson(__jsonOSProfile) : OSProfile;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateRequest.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateRequest.PowerShell.cs new file mode 100644 index 000000000000..7130d4683aeb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateRequest.PowerShell.cs @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The virtual machine instance resource patch definition. + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstanceUpdateRequestTypeConverter))] + public partial class VirtualMachineInstanceUpdateRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineInstanceUpdateRequest(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineInstanceUpdateRequest(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineInstanceUpdateRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceUpdatePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Identity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IdentityTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityPrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).IdentityPrincipalId = (string) content.GetValueForProperty("IdentityPrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).IdentityPrincipalId, global::System.Convert.ToString); + } + if (content.Contains("IdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).IdentityTenantId = (string) content.GetValueForProperty("IdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).IdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("HardwareProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).HardwareProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdate) content.GetValueForProperty("HardwareProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).HardwareProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HardwareProfileUpdateTypeConverter.ConvertFrom); + } + if (content.Contains("StorageProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).StorageProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdate) content.GetValueForProperty("StorageProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).StorageProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageProfileUpdateTypeConverter.ConvertFrom); + } + if (content.Contains("NetworkProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).NetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdate) content.GetValueForProperty("NetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).NetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkProfileUpdateTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).OSProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdate) content.GetValueForProperty("OSProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).OSProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).IdentityType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType?) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).IdentityType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType.CreateFrom); + } + if (content.Contains("HardwareProfileVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).HardwareProfileVMSize = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum?) content.GetValueForProperty("HardwareProfileVMSize",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).HardwareProfileVMSize, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum.CreateFrom); + } + if (content.Contains("HardwareProfileProcessor")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).HardwareProfileProcessor = (int?) content.GetValueForProperty("HardwareProfileProcessor",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).HardwareProfileProcessor, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("HardwareProfileMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).HardwareProfileMemoryMb = (long?) content.GetValueForProperty("HardwareProfileMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).HardwareProfileMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StorageProfileDataDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).StorageProfileDataDisk = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem[]) content.GetValueForProperty("StorageProfileDataDisk",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).StorageProfileDataDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageProfileUpdateDataDisksItemTypeConverter.ConvertFrom)); + } + if (content.Contains("NetworkProfileNetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).NetworkProfileNetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem[]) content.GetValueForProperty("NetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).NetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkProfileUpdateNetworkInterfacesItemTypeConverter.ConvertFrom)); + } + if (content.Contains("OSProfileLinuxConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).OSProfileLinuxConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration) content.GetValueForProperty("OSProfileLinuxConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).OSProfileLinuxConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateLinuxConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileWindowsConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).OSProfileWindowsConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration) content.GetValueForProperty("OSProfileWindowsConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).OSProfileWindowsConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateWindowsConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileComputerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).OSProfileComputerName = (string) content.GetValueForProperty("OSProfileComputerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).OSProfileComputerName, global::System.Convert.ToString); + } + if (content.Contains("LinuxConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).LinuxConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).LinuxConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LinuxConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).LinuxConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).LinuxConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).WindowConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).WindowConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).WindowConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).WindowConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineInstanceUpdateRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceUpdatePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Identity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IdentityTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityPrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).IdentityPrincipalId = (string) content.GetValueForProperty("IdentityPrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).IdentityPrincipalId, global::System.Convert.ToString); + } + if (content.Contains("IdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).IdentityTenantId = (string) content.GetValueForProperty("IdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).IdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("HardwareProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).HardwareProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdate) content.GetValueForProperty("HardwareProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).HardwareProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HardwareProfileUpdateTypeConverter.ConvertFrom); + } + if (content.Contains("StorageProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).StorageProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdate) content.GetValueForProperty("StorageProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).StorageProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageProfileUpdateTypeConverter.ConvertFrom); + } + if (content.Contains("NetworkProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).NetworkProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdate) content.GetValueForProperty("NetworkProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).NetworkProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkProfileUpdateTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).OSProfile = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdate) content.GetValueForProperty("OSProfile",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).OSProfile, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateTypeConverter.ConvertFrom); + } + if (content.Contains("IdentityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).IdentityType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType?) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).IdentityType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType.CreateFrom); + } + if (content.Contains("HardwareProfileVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).HardwareProfileVMSize = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum?) content.GetValueForProperty("HardwareProfileVMSize",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).HardwareProfileVMSize, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum.CreateFrom); + } + if (content.Contains("HardwareProfileProcessor")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).HardwareProfileProcessor = (int?) content.GetValueForProperty("HardwareProfileProcessor",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).HardwareProfileProcessor, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("HardwareProfileMemoryMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).HardwareProfileMemoryMb = (long?) content.GetValueForProperty("HardwareProfileMemoryMb",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).HardwareProfileMemoryMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StorageProfileDataDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).StorageProfileDataDisk = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem[]) content.GetValueForProperty("StorageProfileDataDisk",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).StorageProfileDataDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageProfileUpdateDataDisksItemTypeConverter.ConvertFrom)); + } + if (content.Contains("NetworkProfileNetworkInterface")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).NetworkProfileNetworkInterface = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem[]) content.GetValueForProperty("NetworkProfileNetworkInterface",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).NetworkProfileNetworkInterface, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkProfileUpdateNetworkInterfacesItemTypeConverter.ConvertFrom)); + } + if (content.Contains("OSProfileLinuxConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).OSProfileLinuxConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration) content.GetValueForProperty("OSProfileLinuxConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).OSProfileLinuxConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateLinuxConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileWindowsConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).OSProfileWindowsConfiguration = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration) content.GetValueForProperty("OSProfileWindowsConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).OSProfileWindowsConfiguration, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.OSProfileUpdateWindowsConfigurationTypeConverter.ConvertFrom); + } + if (content.Contains("OSProfileComputerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).OSProfileComputerName = (string) content.GetValueForProperty("OSProfileComputerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).OSProfileComputerName, global::System.Convert.ToString); + } + if (content.Contains("LinuxConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).LinuxConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).LinuxConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LinuxConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).LinuxConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("LinuxConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).LinuxConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationProvisionVMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).WindowConfigurationProvisionVMAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).WindowConfigurationProvisionVMAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("WindowConfigurationProvisionVMConfigAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).WindowConfigurationProvisionVMConfigAgent = (bool?) content.GetValueForProperty("WindowConfigurationProvisionVMConfigAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal)this).WindowConfigurationProvisionVMConfigAgent, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializePSObject(content); + } + } + /// The virtual machine instance resource patch definition. + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstanceUpdateRequestTypeConverter))] + public partial interface IVirtualMachineInstanceUpdateRequest + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateRequest.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateRequest.TypeConverter.cs new file mode 100644 index 000000000000..5e6c268f3889 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateRequest.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineInstanceUpdateRequestTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineInstanceUpdateRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineInstanceUpdateRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineInstanceUpdateRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateRequest.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateRequest.cs new file mode 100644 index 000000000000..7389d2cd3b2d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateRequest.cs @@ -0,0 +1,315 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The virtual machine instance resource patch definition. + public partial class VirtualMachineInstanceUpdateRequest : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequest, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal + { + + /// RAM in MB for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public long? HardwareProfileMemoryMb { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).HardwareProfileMemoryMb; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).HardwareProfileMemoryMb = value ?? default(long); } + + /// number of processors for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public int? HardwareProfileProcessor { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).HardwareProfileProcessor; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).HardwareProfileProcessor = value ?? default(int); } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum? HardwareProfileVMSize { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).HardwareProfileVMSize; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).HardwareProfileVMSize = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum)""); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity _identity; + + /// Identity for the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity Identity { get => (this._identity = this._identity ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Identity()); set => this._identity = value; } + + /// The principal ID of resource identity. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentityPrincipalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).PrincipalId; } + + /// The tenant ID of resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string IdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).TenantId; } + + /// The identity type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).Type = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType)""); } + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? LinuxConfigurationProvisionVMAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).LinuxConfigurationProvisionVMAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).LinuxConfigurationProvisionVMAgent = value ?? default(bool); } + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? LinuxConfigurationProvisionVMConfigAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).LinuxConfigurationProvisionVMConfigAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).LinuxConfigurationProvisionVMConfigAgent = value ?? default(bool); } + + /// Internal Acessors for HardwareProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdate Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal.HardwareProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).HardwareProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).HardwareProfile = value; } + + /// Internal Acessors for Identity + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal.Identity { get => (this._identity = this._identity ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Identity()); set { {_identity = value;} } } + + /// Internal Acessors for IdentityPrincipalId + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal.IdentityPrincipalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).PrincipalId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).PrincipalId = value; } + + /// Internal Acessors for IdentityTenantId + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal.IdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).TenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)Identity).TenantId = value; } + + /// Internal Acessors for NetworkProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdate Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal.NetworkProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).NetworkProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).NetworkProfile = value; } + + /// Internal Acessors for OSProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdate Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal.OSProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).OSProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).OSProfile = value; } + + /// Internal Acessors for OSProfileLinuxConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal.OSProfileLinuxConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).OSProfileLinuxConfiguration; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).OSProfileLinuxConfiguration = value; } + + /// Internal Acessors for OSProfileWindowsConfiguration + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal.OSProfileWindowsConfiguration { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).OSProfileWindowsConfiguration; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).OSProfileWindowsConfiguration = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateProperties Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceUpdateProperties()); set { {_property = value;} } } + + /// Internal Acessors for StorageProfile + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdate Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequestInternal.StorageProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).StorageProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).StorageProfile = value; } + + /// + /// NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem[] NetworkProfileNetworkInterface { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).NetworkProfileNetworkInterface; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).NetworkProfileNetworkInterface = value ?? null /* arrayOf */; } + + /// ComputerName - name of the computer + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string OSProfileComputerName { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).OSProfileComputerName; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).OSProfileComputerName = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateProperties _property; + + /// Defines the resource properties for the update. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceUpdateProperties()); set => this._property = value; } + + /// adds data disks to the virtual machine instance for the update call + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem[] StorageProfileDataDisk { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).StorageProfileDataDisk; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).StorageProfileDataDisk = value ?? null /* arrayOf */; } + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? WindowConfigurationProvisionVMAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).WindowConfigurationProvisionVMAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).WindowConfigurationProvisionVMAgent = value ?? default(bool); } + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public bool? WindowConfigurationProvisionVMConfigAgent { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).WindowConfigurationProvisionVMConfigAgent; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdatePropertiesInternal)Property).WindowConfigurationProvisionVMConfigAgent = value ?? default(bool); } + + /// Creates an new instance. + public VirtualMachineInstanceUpdateRequest() + { + + } + } + /// The virtual machine instance resource patch definition. + public partial interface IVirtualMachineInstanceUpdateRequest : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// RAM in MB for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"RAM in MB for the virtual machine instance", + SerializedName = @"memoryMB", + PossibleTypes = new [] { typeof(long) })] + long? HardwareProfileMemoryMb { get; set; } + /// number of processors for the virtual machine instance + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"number of processors for the virtual machine instance", + SerializedName = @"processors", + PossibleTypes = new [] { typeof(int) })] + int? HardwareProfileProcessor { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"vmSize", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum? HardwareProfileVMSize { get; set; } + /// The principal ID of resource identity. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The principal ID of resource identity.", + SerializedName = @"principalId", + PossibleTypes = new [] { typeof(string) })] + string IdentityPrincipalId { get; } + /// The tenant ID of resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The tenant ID of resource.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string IdentityTenantId { get; } + /// The identity type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identity type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? LinuxConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? LinuxConfigurationProvisionVMConfigAgent { get; set; } + /// + /// NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance", + SerializedName = @"networkInterfaces", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem[] NetworkProfileNetworkInterface { get; set; } + /// ComputerName - name of the computer + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ComputerName - name of the computer", + SerializedName = @"computerName", + PossibleTypes = new [] { typeof(string) })] + string OSProfileComputerName { get; set; } + /// adds data disks to the virtual machine instance for the update call + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"adds data disks to the virtual machine instance for the update call", + SerializedName = @"dataDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem[] StorageProfileDataDisk { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? WindowConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(bool) })] + bool? WindowConfigurationProvisionVMConfigAgent { get; set; } + + } + /// The virtual machine instance resource patch definition. + internal partial interface IVirtualMachineInstanceUpdateRequestInternal + + { + /// + /// HardwareProfile - Specifies the hardware settings for the virtual machine instance. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHardwareProfileUpdate HardwareProfile { get; set; } + /// RAM in MB for the virtual machine instance + long? HardwareProfileMemoryMb { get; set; } + /// number of processors for the virtual machine instance + int? HardwareProfileProcessor { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum? HardwareProfileVMSize { get; set; } + /// Identity for the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity Identity { get; set; } + /// The principal ID of resource identity. + string IdentityPrincipalId { get; set; } + /// The tenant ID of resource. + string IdentityTenantId { get; set; } + /// The identity type. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? IdentityType { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + bool? LinuxConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + bool? LinuxConfigurationProvisionVMConfigAgent { get; set; } + /// + /// NetworkProfile - describes the network update configuration the virtual machine instance + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdate NetworkProfile { get; set; } + /// + /// NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem[] NetworkProfileNetworkInterface { get; set; } + /// OsProfile - describes the update configuration of the operating system + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdate OSProfile { get; set; } + /// ComputerName - name of the computer + string OSProfileComputerName { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateLinuxConfiguration OSProfileLinuxConfiguration { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IOSProfileUpdateWindowsConfiguration OSProfileWindowsConfiguration { get; set; } + /// Defines the resource properties for the update. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateProperties Property { get; set; } + + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdate StorageProfile { get; set; } + /// adds data disks to the virtual machine instance for the update call + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem[] StorageProfileDataDisk { get; set; } + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + bool? WindowConfigurationProvisionVMAgent { get; set; } + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + bool? WindowConfigurationProvisionVMConfigAgent { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateRequest.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateRequest.json.cs new file mode 100644 index 000000000000..282fcc9c87ce --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceUpdateRequest.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The virtual machine instance resource patch definition. + public partial class VirtualMachineInstanceUpdateRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualMachineInstanceUpdateRequest(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != this._identity ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._identity.ToJson(null,serializationMode) : null, "identity" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineInstanceUpdateRequest(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceUpdateProperties.FromJson(__jsonProperties) : Property;} + {_identity = If( json?.PropertyT("identity"), out var __jsonIdentity) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Identity.FromJson(__jsonIdentity) : Identity;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceView.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceView.PowerShell.cs new file mode 100644 index 000000000000..c9892a929bd5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceView.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The instance view of a virtual machine. + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstanceViewTypeConverter))] + public partial class VirtualMachineInstanceView + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceView DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineInstanceView(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceView DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineInstanceView(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceView FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineInstanceView(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceViewInternal)this).VMAgent = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView) content.GetValueForProperty("VMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceViewInternal)this).VMAgent, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineConfigAgentInstanceViewTypeConverter.ConvertFrom); + } + if (content.Contains("VMAgentVmconfigAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceViewInternal)this).VMAgentVmconfigAgentVersion = (string) content.GetValueForProperty("VMAgentVmconfigAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceViewInternal)this).VMAgentVmconfigAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("VMAgentStatuses")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceViewInternal)this).VMAgentStatuses = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus[]) content.GetValueForProperty("VMAgentStatuses",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceViewInternal)this).VMAgentStatuses, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.InstanceViewStatusTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineInstanceView(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VMAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceViewInternal)this).VMAgent = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView) content.GetValueForProperty("VMAgent",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceViewInternal)this).VMAgent, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineConfigAgentInstanceViewTypeConverter.ConvertFrom); + } + if (content.Contains("VMAgentVmconfigAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceViewInternal)this).VMAgentVmconfigAgentVersion = (string) content.GetValueForProperty("VMAgentVmconfigAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceViewInternal)this).VMAgentVmconfigAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("VMAgentStatuses")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceViewInternal)this).VMAgentStatuses = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus[]) content.GetValueForProperty("VMAgentStatuses",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceViewInternal)this).VMAgentStatuses, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.InstanceViewStatusTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + } + /// The instance view of a virtual machine. + [System.ComponentModel.TypeConverter(typeof(VirtualMachineInstanceViewTypeConverter))] + public partial interface IVirtualMachineInstanceView + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceView.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceView.TypeConverter.cs new file mode 100644 index 000000000000..8dd18efd103c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceView.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineInstanceViewTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceView ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceView).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineInstanceView.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineInstanceView.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineInstanceView.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceView.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceView.cs new file mode 100644 index 000000000000..f1ca38c01730 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceView.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The instance view of a virtual machine. + public partial class VirtualMachineInstanceView : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceView, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceViewInternal + { + + /// Internal Acessors for VMAgent + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceViewInternal.VMAgent { get => (this._vMAgent = this._vMAgent ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineConfigAgentInstanceView()); set { {_vMAgent = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView _vMAgent; + + /// The VM Config Agent running on the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView VMAgent { get => (this._vMAgent = this._vMAgent ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineConfigAgentInstanceView()); set => this._vMAgent = value; } + + /// The resource status information. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus[] VMAgentStatuses { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceViewInternal)VMAgent).Statuses; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceViewInternal)VMAgent).Statuses = value ?? null /* arrayOf */; } + + /// The VM Config Agent full version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string VMAgentVmconfigAgentVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceViewInternal)VMAgent).VMConfigAgentVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceViewInternal)VMAgent).VMConfigAgentVersion = value ?? null; } + + /// Creates an new instance. + public VirtualMachineInstanceView() + { + + } + } + /// The instance view of a virtual machine. + public partial interface IVirtualMachineInstanceView : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The resource status information. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource status information.", + SerializedName = @"statuses", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus[] VMAgentStatuses { get; set; } + /// The VM Config Agent full version. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The VM Config Agent full version.", + SerializedName = @"vmConfigAgentVersion", + PossibleTypes = new [] { typeof(string) })] + string VMAgentVmconfigAgentVersion { get; set; } + + } + /// The instance view of a virtual machine. + internal partial interface IVirtualMachineInstanceViewInternal + + { + /// The VM Config Agent running on the virtual machine. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineConfigAgentInstanceView VMAgent { get; set; } + /// The resource status information. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IInstanceViewStatus[] VMAgentStatuses { get; set; } + /// The VM Config Agent full version. + string VMAgentVmconfigAgentVersion { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceView.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceView.json.cs new file mode 100644 index 000000000000..486ee4a3e201 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api20230901Preview/VirtualMachineInstanceView.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The instance view of a virtual machine. + public partial class VirtualMachineInstanceView + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceView. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceView. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceView FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new VirtualMachineInstanceView(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._vMAgent ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._vMAgent.ToJson(null,serializationMode) : null, "vmAgent" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineInstanceView(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_vMAgent = If( json?.PropertyT("vmAgent"), out var __jsonVMAgent) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineConfigAgentInstanceView.FromJson(__jsonVMAgent) : VMAgent;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorDetail.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorDetail.PowerShell.cs new file mode 100644 index 000000000000..8e4d2b1669a3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorDetail.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// The error detail. + [System.ComponentModel.TypeConverter(typeof(ErrorDetailTypeConverter))] + public partial class ErrorDetail + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorDetail(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorDetail(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorDetail(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorDetail(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The error detail. + [System.ComponentModel.TypeConverter(typeof(ErrorDetailTypeConverter))] + public partial interface IErrorDetail + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorDetail.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorDetail.TypeConverter.cs new file mode 100644 index 000000000000..5e9126b3713a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorDetail.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorDetailTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorDetail.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorDetail.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorDetail.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorDetail.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorDetail.cs new file mode 100644 index 000000000000..10bcde1d0258 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorDetail.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The error detail. + public partial class ErrorDetail : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[] _additionalInfo; + + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[] AdditionalInfo { get => this._additionalInfo; } + + /// Backing field for property. + private string _code; + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Code { get => this._code; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] _detail; + + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] Detail { get => this._detail; } + + /// Backing field for property. + private string _message; + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Message { get => this._message; } + + /// Internal Acessors for AdditionalInfo + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal.AdditionalInfo { get => this._additionalInfo; set { {_additionalInfo = value;} } } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal.Code { get => this._code; set { {_code = value;} } } + + /// Internal Acessors for Detail + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal.Detail { get => this._detail; set { {_detail = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal.Message { get => this._message; set { {_message = value;} } } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal.Target { get => this._target; set { {_target = value;} } } + + /// Backing field for property. + private string _target; + + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Target { get => this._target; } + + /// Creates an new instance. + public ErrorDetail() + { + + } + } + /// The error detail. + public partial interface IErrorDetail : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error additional info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[] AdditionalInfo { get; } + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error details.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] Detail { get; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error target.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + + } + /// The error detail. + internal partial interface IErrorDetailInternal + + { + /// The error additional info. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[] AdditionalInfo { get; set; } + /// The error code. + string Code { get; set; } + /// The error details. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] Detail { get; set; } + /// The error message. + string Message { get; set; } + /// The error target. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorDetail.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorDetail.json.cs new file mode 100644 index 000000000000..76e90539769e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorDetail.json.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// The error detail. + public partial class ErrorDetail + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorDetail(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)Code;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} + {_target = If( json?.PropertyT("target"), out var __jsonTarget) ? (string)__jsonTarget : (string)Target;} + {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? If( __jsonDetails as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetail.FromJson(__u) )) ))() : null : Detail;} + {_additionalInfo = If( json?.PropertyT("additionalInfo"), out var __jsonAdditionalInfo) ? If( __jsonAdditionalInfo as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorAdditionalInfo.FromJson(__p) )) ))() : null : AdditionalInfo;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new ErrorDetail(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._target)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._target.ToString()) : null, "target" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._detail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._detail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("details",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._additionalInfo) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __s in this._additionalInfo ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("additionalInfo",__r); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorResponse.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorResponse.PowerShell.cs new file mode 100644 index 000000000000..d4a09854de84 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorResponse.PowerShell.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + /// + [System.ComponentModel.TypeConverter(typeof(ErrorResponseTypeConverter))] + public partial class ErrorResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorResponse(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorResponse(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetailTypeConverter.ConvertFrom); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetailTypeConverter.ConvertFrom); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + [System.ComponentModel.TypeConverter(typeof(ErrorResponseTypeConverter))] + public partial interface IErrorResponse + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorResponse.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorResponse.TypeConverter.cs new file mode 100644 index 000000000000..775f189b1fd8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorResponse.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorResponseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorResponse.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorResponse.cs new file mode 100644 index 000000000000..afd6925f43eb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorResponse.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + /// + public partial class ErrorResponse : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal + { + + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[] AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)Error).AdditionalInfo; } + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)Error).Code; } + + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)Error).Detail; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail _error; + + /// The error object. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetail()); set => this._error = value; } + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)Error).Message; } + + /// Internal Acessors for AdditionalInfo + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)Error).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)Error).AdditionalInfo = value; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)Error).Code = value; } + + /// Internal Acessors for Detail + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)Error).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)Error).Detail = value; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetail()); set { {_error = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)Error).Message = value; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponseInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)Error).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)Error).Target = value; } + + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetailInternal)Error).Target; } + + /// Creates an new instance. + public ErrorResponse() + { + + } + } + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + public partial interface IErrorResponse : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error additional info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[] AdditionalInfo { get; } + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error details.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] Detail { get; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error target.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + + } + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + internal partial interface IErrorResponseInternal + + { + /// The error additional info. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorAdditionalInfo[] AdditionalInfo { get; set; } + /// The error code. + string Code { get; set; } + /// The error details. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail[] Detail { get; set; } + /// The error object. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorDetail Error { get; set; } + /// The error message. + string Message { get; set; } + /// The error target. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorResponse.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorResponse.json.cs new file mode 100644 index 000000000000..25b93b54fba4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ErrorResponse.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + /// + public partial class ErrorResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorResponse(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorDetail.FromJson(__jsonError) : Error;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new ErrorResponse(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._error ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._error.ToJson(null,serializationMode) : null, "error" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Identity.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Identity.PowerShell.cs new file mode 100644 index 000000000000..faa336086e51 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Identity.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Identity for the resource. + [System.ComponentModel.TypeConverter(typeof(IdentityTypeConverter))] + public partial class Identity + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Identity(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Identity(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Identity(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)this).PrincipalId = (string) content.GetValueForProperty("PrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)this).PrincipalId, global::System.Convert.ToString); + } + if (content.Contains("TenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)this).TenantId = (string) content.GetValueForProperty("TenantId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)this).TenantId, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)this).Type = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType?) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)this).Type, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Identity(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)this).PrincipalId = (string) content.GetValueForProperty("PrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)this).PrincipalId, global::System.Convert.ToString); + } + if (content.Contains("TenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)this).TenantId = (string) content.GetValueForProperty("TenantId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)this).TenantId, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)this).Type = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType?) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal)this).Type, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Identity for the resource. + [System.ComponentModel.TypeConverter(typeof(IdentityTypeConverter))] + public partial interface IIdentity + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Identity.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Identity.TypeConverter.cs new file mode 100644 index 000000000000..b50d06470ac7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Identity.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class IdentityTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Identity.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Identity.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Identity.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Identity.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Identity.cs new file mode 100644 index 000000000000..4b25384e8a82 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Identity.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Identity for the resource. + public partial class Identity : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal + { + + /// Internal Acessors for PrincipalId + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal.PrincipalId { get => this._principalId; set { {_principalId = value;} } } + + /// Internal Acessors for TenantId + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentityInternal.TenantId { get => this._tenantId; set { {_tenantId = value;} } } + + /// Backing field for property. + private string _principalId; + + /// The principal ID of resource identity. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string PrincipalId { get => this._principalId; } + + /// Backing field for property. + private string _tenantId; + + /// The tenant ID of resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string TenantId { get => this._tenantId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? _type; + + /// The identity type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? Type { get => this._type; set => this._type = value; } + + /// Creates an new instance. + public Identity() + { + + } + } + /// Identity for the resource. + public partial interface IIdentity : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The principal ID of resource identity. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The principal ID of resource identity.", + SerializedName = @"principalId", + PossibleTypes = new [] { typeof(string) })] + string PrincipalId { get; } + /// The tenant ID of resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The tenant ID of resource.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string TenantId { get; } + /// The identity type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identity type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? Type { get; set; } + + } + /// Identity for the resource. + internal partial interface IIdentityInternal + + { + /// The principal ID of resource identity. + string PrincipalId { get; set; } + /// The tenant ID of resource. + string TenantId { get; set; } + /// The identity type. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType? Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Identity.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Identity.json.cs new file mode 100644 index 000000000000..60ffb5587f7c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Identity.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Identity for the resource. + public partial class Identity + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IIdentity FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new Identity(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal Identity(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_principalId = If( json?.PropertyT("principalId"), out var __jsonPrincipalId) ? (string)__jsonPrincipalId : (string)PrincipalId;} + {_tenantId = If( json?.PropertyT("tenantId"), out var __jsonTenantId) ? (string)__jsonTenantId : (string)TenantId;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._principalId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._principalId.ToString()) : null, "principalId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._tenantId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._tenantId.ToString()) : null, "tenantId" ,container.Add ); + } + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/LocationData.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/LocationData.PowerShell.cs new file mode 100644 index 000000000000..783cb2b3eded --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/LocationData.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Metadata pertaining to the geographic location of the resource. + [System.ComponentModel.TypeConverter(typeof(LocationDataTypeConverter))] + public partial class LocationData + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new LocationData(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new LocationData(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal LocationData(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("City")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)this).City, global::System.Convert.ToString); + } + if (content.Contains("District")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)this).District = (string) content.GetValueForProperty("District",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)this).District, global::System.Convert.ToString); + } + if (content.Contains("CountryOrRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)this).CountryOrRegion = (string) content.GetValueForProperty("CountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)this).CountryOrRegion, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal LocationData(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("City")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)this).City, global::System.Convert.ToString); + } + if (content.Contains("District")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)this).District = (string) content.GetValueForProperty("District",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)this).District, global::System.Convert.ToString); + } + if (content.Contains("CountryOrRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)this).CountryOrRegion = (string) content.GetValueForProperty("CountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal)this).CountryOrRegion, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Metadata pertaining to the geographic location of the resource. + [System.ComponentModel.TypeConverter(typeof(LocationDataTypeConverter))] + public partial interface ILocationData + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/LocationData.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/LocationData.TypeConverter.cs new file mode 100644 index 000000000000..abef0d0c7190 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/LocationData.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class LocationDataTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return LocationData.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return LocationData.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return LocationData.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/LocationData.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/LocationData.cs new file mode 100644 index 000000000000..56496ac9c686 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/LocationData.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Metadata pertaining to the geographic location of the resource. + public partial class LocationData : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationDataInternal + { + + /// Backing field for property. + private string _city; + + /// The city or locality where the resource is located. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string City { get => this._city; set => this._city = value; } + + /// Backing field for property. + private string _countryOrRegion; + + /// The country or region where the resource is located + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string CountryOrRegion { get => this._countryOrRegion; set => this._countryOrRegion = value; } + + /// Backing field for property. + private string _district; + + /// The district, state, or province where the resource is located. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string District { get => this._district; set => this._district = value; } + + /// Backing field for property. + private string _name; + + /// A canonical name for the geographic or physical location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Creates an new instance. + public LocationData() + { + + } + } + /// Metadata pertaining to the geographic location of the resource. + public partial interface ILocationData : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The city or locality where the resource is located. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The city or locality where the resource is located.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string City { get; set; } + /// The country or region where the resource is located + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The country or region where the resource is located", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + string CountryOrRegion { get; set; } + /// The district, state, or province where the resource is located. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The district, state, or province where the resource is located.", + SerializedName = @"district", + PossibleTypes = new [] { typeof(string) })] + string District { get; set; } + /// A canonical name for the geographic or physical location. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"A canonical name for the geographic or physical location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + + } + /// Metadata pertaining to the geographic location of the resource. + internal partial interface ILocationDataInternal + + { + /// The city or locality where the resource is located. + string City { get; set; } + /// The country or region where the resource is located + string CountryOrRegion { get; set; } + /// The district, state, or province where the resource is located. + string District { get; set; } + /// A canonical name for the geographic or physical location. + string Name { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/LocationData.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/LocationData.json.cs new file mode 100644 index 000000000000..dcd89aab8081 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/LocationData.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Metadata pertaining to the geographic location of the resource. + public partial class LocationData + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ILocationData FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new LocationData(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal LocationData(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_city = If( json?.PropertyT("city"), out var __jsonCity) ? (string)__jsonCity : (string)City;} + {_district = If( json?.PropertyT("district"), out var __jsonDistrict) ? (string)__jsonDistrict : (string)District;} + {_countryOrRegion = If( json?.PropertyT("countryOrRegion"), out var __jsonCountryOrRegion) ? (string)__jsonCountryOrRegion : (string)CountryOrRegion;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._city)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._city.ToString()) : null, "city" ,container.Add ); + AddIf( null != (((object)this._district)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._district.ToString()) : null, "district" ,container.Add ); + AddIf( null != (((object)this._countryOrRegion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._countryOrRegion.ToString()) : null, "countryOrRegion" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Operation.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Operation.PowerShell.cs new file mode 100644 index 000000000000..dc0b4fdb5b46 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Operation.PowerShell.cs @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// Details of a REST API operation, returned from the Resource Provider Operations API + /// + [System.ComponentModel.TypeConverter(typeof(OperationTypeConverter))] + public partial class Operation + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Operation(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Operation(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Operation(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Display")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.OperationDisplayTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("IsDataAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Origin")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).Origin = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Origin?) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).Origin, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Origin.CreateFrom); + } + if (content.Contains("ActionType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).ActionType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ActionType?) content.GetValueForProperty("ActionType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).ActionType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ActionType.CreateFrom); + } + if (content.Contains("DisplayProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).DisplayProvider, global::System.Convert.ToString); + } + if (content.Contains("DisplayResource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).DisplayResource, global::System.Convert.ToString); + } + if (content.Contains("DisplayOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).DisplayOperation, global::System.Convert.ToString); + } + if (content.Contains("DisplayDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).DisplayDescription, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Operation(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Display")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.OperationDisplayTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("IsDataAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Origin")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).Origin = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Origin?) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).Origin, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Origin.CreateFrom); + } + if (content.Contains("ActionType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).ActionType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ActionType?) content.GetValueForProperty("ActionType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).ActionType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ActionType.CreateFrom); + } + if (content.Contains("DisplayProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).DisplayProvider, global::System.Convert.ToString); + } + if (content.Contains("DisplayResource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).DisplayResource, global::System.Convert.ToString); + } + if (content.Contains("DisplayOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).DisplayOperation, global::System.Convert.ToString); + } + if (content.Contains("DisplayDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal)this).DisplayDescription, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Details of a REST API operation, returned from the Resource Provider Operations API + [System.ComponentModel.TypeConverter(typeof(OperationTypeConverter))] + public partial interface IOperation + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Operation.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Operation.TypeConverter.cs new file mode 100644 index 000000000000..e4b86659f17f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Operation.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Operation.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Operation.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Operation.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Operation.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Operation.cs new file mode 100644 index 000000000000..3cfcaf42e5ae --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Operation.cs @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// Details of a REST API operation, returned from the Resource Provider Operations API + /// + public partial class Operation : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ActionType? _actionType; + + /// + /// Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ActionType? ActionType { get => this._actionType; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplay _display; + + /// Localized display information for this particular operation. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplay Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.OperationDisplay()); set => this._display = value; } + + /// + /// The short, localized friendly description of the operation; suitable for tool tips and detailed views. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)Display).Description; } + + /// + /// The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", + /// "Restart Virtual Machine". + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)Display).Operation; } + + /// + /// The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)Display).Provider; } + + /// + /// The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)Display).Resource; } + + /// Backing field for property. + private bool? _isDataAction; + + /// + /// Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + /// operations. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public bool? IsDataAction { get => this._isDataAction; } + + /// Internal Acessors for ActionType + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ActionType? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal.ActionType { get => this._actionType; set { {_actionType = value;} } } + + /// Internal Acessors for Display + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplay Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.OperationDisplay()); set { {_display = value;} } } + + /// Internal Acessors for DisplayDescription + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal.DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)Display).Description = value; } + + /// Internal Acessors for DisplayOperation + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal.DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)Display).Operation = value; } + + /// Internal Acessors for DisplayProvider + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal.DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)Display).Provider = value; } + + /// Internal Acessors for DisplayResource + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal.DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)Display).Resource = value; } + + /// Internal Acessors for IsDataAction + bool? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal.IsDataAction { get => this._isDataAction; set { {_isDataAction = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Origin + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Origin? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationInternal.Origin { get => this._origin; set { {_origin = value;} } } + + /// Backing field for property. + private string _name; + + /// + /// The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + /// "Microsoft.Compute/virtualMachines/capture/action" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Origin? _origin; + + /// + /// The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is + /// "user,system" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Origin? Origin { get => this._origin; } + + /// Creates an new instance. + public Operation() + { + + } + } + /// Details of a REST API operation, returned from the Resource Provider Operations API + public partial interface IOperation : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// + /// Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Enum. Indicates the action type. ""Internal"" refers to actions that are for internal only APIs.", + SerializedName = @"actionType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ActionType) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ActionType? ActionType { get; } + /// + /// The short, localized friendly description of the operation; suitable for tool tips and detailed views. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The short, localized friendly description of the operation; suitable for tool tips and detailed views.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string DisplayDescription { get; } + /// + /// The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", + /// "Restart Virtual Machine". + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The concise, localized friendly name for the operation; suitable for dropdowns. E.g. ""Create or Update Virtual Machine"", ""Restart Virtual Machine"".", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + string DisplayOperation { get; } + /// + /// The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The localized friendly form of the resource provider name, e.g. ""Microsoft Monitoring Insights"" or ""Microsoft Compute"".", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string DisplayProvider { get; } + /// + /// The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The localized friendly name of the resource type related to this operation. E.g. ""Virtual Machines"" or ""Job Schedule Collections"".", + SerializedName = @"resource", + PossibleTypes = new [] { typeof(string) })] + string DisplayResource { get; } + /// + /// Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + /// operations. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Whether the operation applies to data-plane. This is ""true"" for data-plane operations and ""false"" for ARM/control-plane operations.", + SerializedName = @"isDataAction", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDataAction { get; } + /// + /// The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + /// "Microsoft.Compute/virtualMachines/capture/action" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The name of the operation, as per Resource-Based Access Control (RBAC). Examples: ""Microsoft.Compute/virtualMachines/write"", ""Microsoft.Compute/virtualMachines/capture/action""", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// + /// The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is + /// "user,system" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is ""user,system""", + SerializedName = @"origin", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Origin) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Origin? Origin { get; } + + } + /// Details of a REST API operation, returned from the Resource Provider Operations API + internal partial interface IOperationInternal + + { + /// + /// Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ActionType? ActionType { get; set; } + /// Localized display information for this particular operation. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplay Display { get; set; } + /// + /// The short, localized friendly description of the operation; suitable for tool tips and detailed views. + /// + string DisplayDescription { get; set; } + /// + /// The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", + /// "Restart Virtual Machine". + /// + string DisplayOperation { get; set; } + /// + /// The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + /// + string DisplayProvider { get; set; } + /// + /// The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + /// + string DisplayResource { get; set; } + /// + /// Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + /// operations. + /// + bool? IsDataAction { get; set; } + /// + /// The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + /// "Microsoft.Compute/virtualMachines/capture/action" + /// + string Name { get; set; } + /// + /// The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is + /// "user,system" + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Origin? Origin { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Operation.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Operation.json.cs new file mode 100644 index 000000000000..75d8cfd38901 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Operation.json.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// Details of a REST API operation, returned from the Resource Provider Operations API + /// + public partial class Operation + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new Operation(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal Operation(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_display = If( json?.PropertyT("display"), out var __jsonDisplay) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.OperationDisplay.FromJson(__jsonDisplay) : Display;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_isDataAction = If( json?.PropertyT("isDataAction"), out var __jsonIsDataAction) ? (bool?)__jsonIsDataAction : IsDataAction;} + {_origin = If( json?.PropertyT("origin"), out var __jsonOrigin) ? (string)__jsonOrigin : (string)Origin;} + {_actionType = If( json?.PropertyT("actionType"), out var __jsonActionType) ? (string)__jsonActionType : (string)ActionType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._display ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._display.ToJson(null,serializationMode) : null, "display" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._isDataAction ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonBoolean((bool)this._isDataAction) : null, "isDataAction" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._origin)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._origin.ToString()) : null, "origin" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._actionType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._actionType.ToString()) : null, "actionType" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationDisplay.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationDisplay.PowerShell.cs new file mode 100644 index 000000000000..e73e1f8f0388 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationDisplay.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Localized display information for this particular operation. + [System.ComponentModel.TypeConverter(typeof(OperationDisplayTypeConverter))] + public partial class OperationDisplay + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplay DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationDisplay(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplay DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationDisplay(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplay FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationDisplay(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Provider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)this).Provider, global::System.Convert.ToString); + } + if (content.Contains("Resource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)this).Resource, global::System.Convert.ToString); + } + if (content.Contains("Operation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)this).Operation, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)this).Description, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OperationDisplay(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Provider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)this).Provider, global::System.Convert.ToString); + } + if (content.Contains("Resource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)this).Resource, global::System.Convert.ToString); + } + if (content.Contains("Operation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)this).Operation, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal)this).Description, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Localized display information for this particular operation. + [System.ComponentModel.TypeConverter(typeof(OperationDisplayTypeConverter))] + public partial interface IOperationDisplay + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationDisplay.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationDisplay.TypeConverter.cs new file mode 100644 index 000000000000..a2a20bc41fc9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationDisplay.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationDisplayTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplay ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplay).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationDisplay.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationDisplay.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationDisplay.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationDisplay.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationDisplay.cs new file mode 100644 index 000000000000..6e273ce0e817 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationDisplay.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Localized display information for this particular operation. + public partial class OperationDisplay : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplay, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal + { + + /// Backing field for property. + private string _description; + + /// + /// The short, localized friendly description of the operation; suitable for tool tips and detailed views. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Description { get => this._description; } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal.Description { get => this._description; set { {_description = value;} } } + + /// Internal Acessors for Operation + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal.Operation { get => this._operation; set { {_operation = value;} } } + + /// Internal Acessors for Provider + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal.Provider { get => this._provider; set { {_provider = value;} } } + + /// Internal Acessors for Resource + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplayInternal.Resource { get => this._resource; set { {_resource = value;} } } + + /// Backing field for property. + private string _operation; + + /// + /// The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", + /// "Restart Virtual Machine". + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Operation { get => this._operation; } + + /// Backing field for property. + private string _provider; + + /// + /// The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Provider { get => this._provider; } + + /// Backing field for property. + private string _resource; + + /// + /// The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Resource { get => this._resource; } + + /// Creates an new instance. + public OperationDisplay() + { + + } + } + /// Localized display information for this particular operation. + public partial interface IOperationDisplay : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// + /// The short, localized friendly description of the operation; suitable for tool tips and detailed views. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The short, localized friendly description of the operation; suitable for tool tips and detailed views.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string Description { get; } + /// + /// The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", + /// "Restart Virtual Machine". + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The concise, localized friendly name for the operation; suitable for dropdowns. E.g. ""Create or Update Virtual Machine"", ""Restart Virtual Machine"".", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + string Operation { get; } + /// + /// The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The localized friendly form of the resource provider name, e.g. ""Microsoft Monitoring Insights"" or ""Microsoft Compute"".", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string Provider { get; } + /// + /// The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The localized friendly name of the resource type related to this operation. E.g. ""Virtual Machines"" or ""Job Schedule Collections"".", + SerializedName = @"resource", + PossibleTypes = new [] { typeof(string) })] + string Resource { get; } + + } + /// Localized display information for this particular operation. + internal partial interface IOperationDisplayInternal + + { + /// + /// The short, localized friendly description of the operation; suitable for tool tips and detailed views. + /// + string Description { get; set; } + /// + /// The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", + /// "Restart Virtual Machine". + /// + string Operation { get; set; } + /// + /// The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + /// + string Provider { get; set; } + /// + /// The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + /// + string Resource { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationDisplay.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationDisplay.json.cs new file mode 100644 index 000000000000..24eebbfb1bc2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationDisplay.json.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Localized display information for this particular operation. + public partial class OperationDisplay + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplay. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplay. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationDisplay FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new OperationDisplay(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal OperationDisplay(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provider = If( json?.PropertyT("provider"), out var __jsonProvider) ? (string)__jsonProvider : (string)Provider;} + {_resource = If( json?.PropertyT("resource"), out var __jsonResource) ? (string)__jsonResource : (string)Resource;} + {_operation = If( json?.PropertyT("operation"), out var __jsonOperation) ? (string)__jsonOperation : (string)Operation;} + {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)Description;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provider)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._provider.ToString()) : null, "provider" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._resource)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._resource.ToString()) : null, "resource" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._operation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._operation.ToString()) : null, "operation" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._description)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._description.ToString()) : null, "description" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationListResult.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationListResult.PowerShell.cs new file mode 100644 index 000000000000..daa76dae9e05 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationListResult.PowerShell.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + /// results. + /// + [System.ComponentModel.TypeConverter(typeof(OperationListResultTypeConverter))] + public partial class OperationListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.OperationTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OperationListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.OperationTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationListResultInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + /// results. + [System.ComponentModel.TypeConverter(typeof(OperationListResultTypeConverter))] + public partial interface IOperationListResult + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationListResult.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationListResult.TypeConverter.cs new file mode 100644 index 000000000000..e81db8b91b56 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationListResult.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationListResult.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationListResult.cs new file mode 100644 index 000000000000..babfb1d52dc5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationListResult.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + /// results. + /// + public partial class OperationListResult : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationListResult, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationListResultInternal + { + + /// Internal Acessors for NextLink + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationListResultInternal.NextLink { get => this._nextLink; set { {_nextLink = value;} } } + + /// Internal Acessors for Value + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation[] Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationListResultInternal.Value { get => this._value; set { {_value = value;} } } + + /// Backing field for property. + private string _nextLink; + + /// URL to get the next set of operation list results (if there are any). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation[] _value; + + /// List of operations supported by the resource provider + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation[] Value { get => this._value; } + + /// Creates an new instance. + public OperationListResult() + { + + } + } + /// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + /// results. + public partial interface IOperationListResult : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// URL to get the next set of operation list results (if there are any). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"URL to get the next set of operation list results (if there are any).", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; } + /// List of operations supported by the resource provider + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"List of operations supported by the resource provider", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation[] Value { get; } + + } + /// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + /// results. + internal partial interface IOperationListResultInternal + + { + /// URL to get the next set of operation list results (if there are any). + string NextLink { get; set; } + /// List of operations supported by the resource provider + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationListResult.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationListResult.json.cs new file mode 100644 index 000000000000..5823007a6c97 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/OperationListResult.json.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + /// results. + /// + public partial class OperationListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new OperationListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal OperationListResult(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation) (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Operation.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ProxyResource.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ProxyResource.PowerShell.cs new file mode 100644 index 000000000000..e6f43801820b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ProxyResource.PowerShell.cs @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location + /// + [System.ComponentModel.TypeConverter(typeof(ProxyResourceTypeConverter))] + public partial class ProxyResource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IProxyResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProxyResource(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IProxyResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProxyResource(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IProxyResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProxyResource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ProxyResource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location + [System.ComponentModel.TypeConverter(typeof(ProxyResourceTypeConverter))] + public partial interface IProxyResource + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ProxyResource.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ProxyResource.TypeConverter.cs new file mode 100644 index 000000000000..3b9645496a43 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ProxyResource.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProxyResourceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IProxyResource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IProxyResource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProxyResource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProxyResource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProxyResource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ProxyResource.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ProxyResource.cs new file mode 100644 index 000000000000..f8a39d64c579 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ProxyResource.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location + /// + public partial class ProxyResource : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IProxyResource, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IProxyResourceInternal, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Resource(); + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Id; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemData = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Name; } + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemData; } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public ProxyResource() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location + public partial interface IProxyResource : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource + { + + } + /// The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location + internal partial interface IProxyResourceInternal : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ProxyResource.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ProxyResource.json.cs new file mode 100644 index 000000000000..1db86978a37f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/ProxyResource.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location + /// + public partial class ProxyResource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IProxyResource. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IProxyResource. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IProxyResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new ProxyResource(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal ProxyResource(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Resource(json); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Resource.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Resource.PowerShell.cs new file mode 100644 index 000000000000..c06d6d0c063a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Resource.PowerShell.cs @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// Common fields that are returned in the response for all Azure Resource Manager resources + /// + [System.ComponentModel.TypeConverter(typeof(ResourceTypeConverter))] + public partial class Resource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Resource(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Resource(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Resource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Resource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Common fields that are returned in the response for all Azure Resource Manager resources + [System.ComponentModel.TypeConverter(typeof(ResourceTypeConverter))] + public partial interface IResource + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Resource.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Resource.TypeConverter.cs new file mode 100644 index 000000000000..ccdd493cc4b5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Resource.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Resource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Resource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Resource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Resource.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Resource.cs new file mode 100644 index 000000000000..82801b1995c9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Resource.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// Common fields that are returned in the response for all Azure Resource Manager resources + /// + public partial class Resource : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal + { + + /// Backing field for property. + private string _id; + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemData()); set { {_systemData = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData _systemData; + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemData()); } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)SystemData).CreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)SystemData).CreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)SystemData).LastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)SystemData).LastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// Backing field for property. + private string _type; + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public Resource() + { + + } + } + /// Common fields that are returned in the response for all Azure Resource Manager resources + public partial interface IResource : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The name of the resource", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; set; } + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of identity that created the resource.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataCreatedByType { get; set; } + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The timestamp of resource last modification (UTC)", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; set; } + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of identity that last modified the resource.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataLastModifiedByType { get; set; } + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The type of the resource. E.g. ""Microsoft.Compute/virtualMachines"" or ""Microsoft.Storage/storageAccounts""", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// Common fields that are returned in the response for all Azure Resource Manager resources + internal partial interface IResourceInternal + + { + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + string Id { get; set; } + /// The name of the resource + string Name { get; set; } + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData SystemData { get; set; } + /// The timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// The identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// The type of identity that created the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataCreatedByType { get; set; } + /// The timestamp of resource last modification (UTC) + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// The identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// The type of identity that last modified the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataLastModifiedByType { get; set; } + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Resource.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Resource.json.cs new file mode 100644 index 000000000000..c89ed7523f87 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/Resource.json.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// Common fields that are returned in the response for all Azure Resource Manager resources + /// + public partial class Resource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new Resource(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal Resource(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemData.FromJson(__jsonSystemData) : SystemData;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/SystemData.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/SystemData.PowerShell.cs new file mode 100644 index 000000000000..bc85f1952956 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/SystemData.PowerShell.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Metadata pertaining to creation and last modification of the resource. + [System.ComponentModel.TypeConverter(typeof(SystemDataTypeConverter))] + public partial class SystemData + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SystemData(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SystemData(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SystemData(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).CreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).CreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).LastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).LastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SystemData(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).CreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).CreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).LastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).LastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Metadata pertaining to creation and last modification of the resource. + [System.ComponentModel.TypeConverter(typeof(SystemDataTypeConverter))] + public partial interface ISystemData + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/SystemData.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/SystemData.TypeConverter.cs new file mode 100644 index 000000000000..dfcd3b43fb3b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/SystemData.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SystemDataTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SystemData.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SystemData.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SystemData.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/SystemData.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/SystemData.cs new file mode 100644 index 000000000000..0a67e50aea57 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/SystemData.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Metadata pertaining to creation and last modification of the resource. + public partial class SystemData : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemDataInternal + { + + /// Backing field for property. + private global::System.DateTime? _createdAt; + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public global::System.DateTime? CreatedAt { get => this._createdAt; set => this._createdAt = value; } + + /// Backing field for property. + private string _createdBy; + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string CreatedBy { get => this._createdBy; set => this._createdBy = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? _createdByType; + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? CreatedByType { get => this._createdByType; set => this._createdByType = value; } + + /// Backing field for property. + private global::System.DateTime? _lastModifiedAt; + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public global::System.DateTime? LastModifiedAt { get => this._lastModifiedAt; set => this._lastModifiedAt = value; } + + /// Backing field for property. + private string _lastModifiedBy; + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string LastModifiedBy { get => this._lastModifiedBy; set => this._lastModifiedBy = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? _lastModifiedByType; + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? LastModifiedByType { get => this._lastModifiedByType; set => this._lastModifiedByType = value; } + + /// Creates an new instance. + public SystemData() + { + + } + } + /// Metadata pertaining to creation and last modification of the resource. + public partial interface ISystemData : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? CreatedAt { get; set; } + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string CreatedBy { get; set; } + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of identity that created the resource.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? CreatedByType { get; set; } + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The timestamp of resource last modification (UTC)", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastModifiedAt { get; set; } + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string LastModifiedBy { get; set; } + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of identity that last modified the resource.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? LastModifiedByType { get; set; } + + } + /// Metadata pertaining to creation and last modification of the resource. + internal partial interface ISystemDataInternal + + { + /// The timestamp of resource creation (UTC). + global::System.DateTime? CreatedAt { get; set; } + /// The identity that created the resource. + string CreatedBy { get; set; } + /// The type of identity that created the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? CreatedByType { get; set; } + /// The timestamp of resource last modification (UTC) + global::System.DateTime? LastModifiedAt { get; set; } + /// The identity that last modified the resource. + string LastModifiedBy { get; set; } + /// The type of identity that last modified the resource. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? LastModifiedByType { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/SystemData.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/SystemData.json.cs new file mode 100644 index 000000000000..8394049a528b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/SystemData.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Metadata pertaining to creation and last modification of the resource. + public partial class SystemData + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new SystemData(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal SystemData(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_createdBy = If( json?.PropertyT("createdBy"), out var __jsonCreatedBy) ? (string)__jsonCreatedBy : (string)CreatedBy;} + {_createdByType = If( json?.PropertyT("createdByType"), out var __jsonCreatedByType) ? (string)__jsonCreatedByType : (string)CreatedByType;} + {_createdAt = If( json?.PropertyT("createdAt"), out var __jsonCreatedAt) ? global::System.DateTime.TryParse((string)__jsonCreatedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonCreatedAtValue) ? __jsonCreatedAtValue : CreatedAt : CreatedAt;} + {_lastModifiedBy = If( json?.PropertyT("lastModifiedBy"), out var __jsonLastModifiedBy) ? (string)__jsonLastModifiedBy : (string)LastModifiedBy;} + {_lastModifiedByType = If( json?.PropertyT("lastModifiedByType"), out var __jsonLastModifiedByType) ? (string)__jsonLastModifiedByType : (string)LastModifiedByType;} + {_lastModifiedAt = If( json?.PropertyT("lastModifiedAt"), out var __jsonLastModifiedAt) ? global::System.DateTime.TryParse((string)__jsonLastModifiedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastModifiedAtValue) ? __jsonLastModifiedAtValue : LastModifiedAt : LastModifiedAt;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._createdBy)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._createdBy.ToString()) : null, "createdBy" ,container.Add ); + AddIf( null != (((object)this._createdByType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._createdByType.ToString()) : null, "createdByType" ,container.Add ); + AddIf( null != this._createdAt ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._createdAt?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "createdAt" ,container.Add ); + AddIf( null != (((object)this._lastModifiedBy)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._lastModifiedBy.ToString()) : null, "lastModifiedBy" ,container.Add ); + AddIf( null != (((object)this._lastModifiedByType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._lastModifiedByType.ToString()) : null, "lastModifiedByType" ,container.Add ); + AddIf( null != this._lastModifiedAt ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._lastModifiedAt?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastModifiedAt" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResource.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResource.PowerShell.cs new file mode 100644 index 000000000000..83c74be63985 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResource.PowerShell.cs @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' + /// + [System.ComponentModel.TypeConverter(typeof(TrackedResourceTypeConverter))] + public partial class TrackedResource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TrackedResource(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TrackedResource(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TrackedResource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TrackedResource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType.CreateFrom); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' + [System.ComponentModel.TypeConverter(typeof(TrackedResourceTypeConverter))] + public partial interface ITrackedResource + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResource.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResource.TypeConverter.cs new file mode 100644 index 000000000000..1053f85b6b03 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResource.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TrackedResourceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TrackedResource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TrackedResource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TrackedResource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResource.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResource.cs new file mode 100644 index 000000000000..eb8b2bb4b924 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResource.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' + /// + public partial class TrackedResource : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceInternal, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Resource(); + + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Id; } + + /// Backing field for property. + private string _location; + + /// The geo-location where the resource lives + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemData = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Name; } + + /// + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemData; } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedBy = value ?? null; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataCreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).SystemDataLastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType)""); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags _tag; + + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTags()); set => this._tag = value; } + + /// + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public TrackedResource() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' + public partial interface ITrackedResource : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResource + { + /// The geo-location where the resource lives + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) })] + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get; set; } + + } + /// The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' + internal partial interface ITrackedResourceInternal : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IResourceInternal + { + /// The geo-location where the resource lives + string Location { get; set; } + /// Resource tags. + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResource.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResource.json.cs new file mode 100644 index 000000000000..97e23ecfb9c0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResource.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' + /// + public partial class TrackedResource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new TrackedResource(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal TrackedResource(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.Resource(json); + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTags.FromJson(__jsonTags) : Tag;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResourceTags.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResourceTags.PowerShell.cs new file mode 100644 index 000000000000..74755c83e730 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResourceTags.PowerShell.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// Resource tags. + [System.ComponentModel.TypeConverter(typeof(TrackedResourceTagsTypeConverter))] + public partial class TrackedResourceTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TrackedResourceTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TrackedResourceTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TrackedResourceTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TrackedResourceTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + } + /// Resource tags. + [System.ComponentModel.TypeConverter(typeof(TrackedResourceTagsTypeConverter))] + public partial interface ITrackedResourceTags + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResourceTags.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResourceTags.TypeConverter.cs new file mode 100644 index 000000000000..481487515361 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResourceTags.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TrackedResourceTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TrackedResourceTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TrackedResourceTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TrackedResourceTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResourceTags.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResourceTags.cs new file mode 100644 index 000000000000..89eb7a773d89 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResourceTags.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Resource tags. + public partial class TrackedResourceTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTagsInternal + { + + /// Creates an new instance. + public TrackedResourceTags() + { + + } + } + /// Resource tags. + public partial interface ITrackedResourceTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + + } + /// Resource tags. + internal partial interface ITrackedResourceTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResourceTags.dictionary.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResourceTags.dictionary.cs new file mode 100644 index 000000000000..2a789bf0e21e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResourceTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class TrackedResourceTags : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.TrackedResourceTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResourceTags.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResourceTags.json.cs new file mode 100644 index 000000000000..8743477dd451 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/Api30/TrackedResourceTags.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// Resource tags. + public partial class TrackedResourceTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new TrackedResourceTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + /// + internal TrackedResourceTags(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/StackHciVMIdentity.PowerShell.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/StackHciVMIdentity.PowerShell.cs new file mode 100644 index 000000000000..06fae5868931 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/StackHciVMIdentity.PowerShell.cs @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(StackHciVMIdentityTypeConverter))] + public partial class StackHciVMIdentity + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StackHciVMIdentity(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StackHciVMIdentity(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StackHciVMIdentity(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); + } + if (content.Contains("ResourceGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).ResourceGroupName = (string) content.GetValueForProperty("ResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).ResourceGroupName, global::System.Convert.ToString); + } + if (content.Contains("GalleryImageName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).GalleryImageName = (string) content.GetValueForProperty("GalleryImageName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).GalleryImageName, global::System.Convert.ToString); + } + if (content.Contains("MarketplaceGalleryImageName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).MarketplaceGalleryImageName = (string) content.GetValueForProperty("MarketplaceGalleryImageName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).MarketplaceGalleryImageName, global::System.Convert.ToString); + } + if (content.Contains("NetworkInterfaceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).NetworkInterfaceName = (string) content.GetValueForProperty("NetworkInterfaceName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).NetworkInterfaceName, global::System.Convert.ToString); + } + if (content.Contains("StorageContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).StorageContainerName = (string) content.GetValueForProperty("StorageContainerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).StorageContainerName, global::System.Convert.ToString); + } + if (content.Contains("VirtualHardDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).VirtualHardDiskName = (string) content.GetValueForProperty("VirtualHardDiskName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).VirtualHardDiskName, global::System.Convert.ToString); + } + if (content.Contains("ResourceUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).ResourceUri = (string) content.GetValueForProperty("ResourceUri",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).ResourceUri, global::System.Convert.ToString); + } + if (content.Contains("MachineName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).MachineName = (string) content.GetValueForProperty("MachineName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).MachineName, global::System.Convert.ToString); + } + if (content.Contains("MetadataName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).MetadataName = (string) content.GetValueForProperty("MetadataName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).MetadataName, global::System.Convert.ToString); + } + if (content.Contains("LogicalNetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).LogicalNetworkName = (string) content.GetValueForProperty("LogicalNetworkName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).LogicalNetworkName, global::System.Convert.ToString); + } + if (content.Contains("ExtensionName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).ExtensionName = (string) content.GetValueForProperty("ExtensionName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).ExtensionName, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Publisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).Publisher = (string) content.GetValueForProperty("Publisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).Publisher, global::System.Convert.ToString); + } + if (content.Contains("ExtensionType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).ExtensionType = (string) content.GetValueForProperty("ExtensionType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).ExtensionType, global::System.Convert.ToString); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StackHciVMIdentity(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); + } + if (content.Contains("ResourceGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).ResourceGroupName = (string) content.GetValueForProperty("ResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).ResourceGroupName, global::System.Convert.ToString); + } + if (content.Contains("GalleryImageName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).GalleryImageName = (string) content.GetValueForProperty("GalleryImageName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).GalleryImageName, global::System.Convert.ToString); + } + if (content.Contains("MarketplaceGalleryImageName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).MarketplaceGalleryImageName = (string) content.GetValueForProperty("MarketplaceGalleryImageName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).MarketplaceGalleryImageName, global::System.Convert.ToString); + } + if (content.Contains("NetworkInterfaceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).NetworkInterfaceName = (string) content.GetValueForProperty("NetworkInterfaceName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).NetworkInterfaceName, global::System.Convert.ToString); + } + if (content.Contains("StorageContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).StorageContainerName = (string) content.GetValueForProperty("StorageContainerName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).StorageContainerName, global::System.Convert.ToString); + } + if (content.Contains("VirtualHardDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).VirtualHardDiskName = (string) content.GetValueForProperty("VirtualHardDiskName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).VirtualHardDiskName, global::System.Convert.ToString); + } + if (content.Contains("ResourceUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).ResourceUri = (string) content.GetValueForProperty("ResourceUri",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).ResourceUri, global::System.Convert.ToString); + } + if (content.Contains("MachineName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).MachineName = (string) content.GetValueForProperty("MachineName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).MachineName, global::System.Convert.ToString); + } + if (content.Contains("MetadataName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).MetadataName = (string) content.GetValueForProperty("MetadataName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).MetadataName, global::System.Convert.ToString); + } + if (content.Contains("LogicalNetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).LogicalNetworkName = (string) content.GetValueForProperty("LogicalNetworkName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).LogicalNetworkName, global::System.Convert.ToString); + } + if (content.Contains("ExtensionName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).ExtensionName = (string) content.GetValueForProperty("ExtensionName",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).ExtensionName, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Publisher")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).Publisher = (string) content.GetValueForProperty("Publisher",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).Publisher, global::System.Convert.ToString); + } + if (content.Contains("ExtensionType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).ExtensionType = (string) content.GetValueForProperty("ExtensionType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).ExtensionType, global::System.Convert.ToString); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(StackHciVMIdentityTypeConverter))] + public partial interface IStackHciVMIdentity + + { + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/StackHciVMIdentity.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/StackHciVMIdentity.TypeConverter.cs new file mode 100644 index 000000000000..733b566e65bc --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/StackHciVMIdentity.TypeConverter.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StackHciVMIdentityTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + // we allow string conversion too. + if (type == typeof(global::System.String)) + { + return true; + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + // support direct string to id type conversion. + if (type == typeof(global::System.String)) + { + return new StackHciVMIdentity { Id = sourceValue }; + } + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StackHciVMIdentity.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StackHciVMIdentity.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StackHciVMIdentity.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/StackHciVMIdentity.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/StackHciVMIdentity.cs new file mode 100644 index 000000000000..ecdbe2cbea08 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/StackHciVMIdentity.cs @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class StackHciVMIdentity : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentityInternal + { + + /// Backing field for property. + private string _extensionName; + + /// The name of the machine extension. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ExtensionName { get => this._extensionName; set => this._extensionName = value; } + + /// Backing field for property. + private string _extensionType; + + /// The extensionType of the Extension being received. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ExtensionType { get => this._extensionType; set => this._extensionType = value; } + + /// Backing field for property. + private string _galleryImageName; + + /// Name of the gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string GalleryImageName { get => this._galleryImageName; set => this._galleryImageName = value; } + + /// Backing field for property. + private string _id; + + /// Resource identity path + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// Backing field for property. + private string _location; + + /// The location of the Extension being received. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// Backing field for property. + private string _logicalNetworkName; + + /// Name of the logical network + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string LogicalNetworkName { get => this._logicalNetworkName; set => this._logicalNetworkName = value; } + + /// Backing field for property. + private string _machineName; + + /// The name of the hybrid machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string MachineName { get => this._machineName; set => this._machineName = value; } + + /// Backing field for property. + private string _marketplaceGalleryImageName; + + /// Name of the marketplace gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string MarketplaceGalleryImageName { get => this._marketplaceGalleryImageName; set => this._marketplaceGalleryImageName = value; } + + /// Backing field for property. + private string _metadataName; + + /// Name of the HybridIdentityMetadata. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string MetadataName { get => this._metadataName; set => this._metadataName = value; } + + /// Backing field for property. + private string _networkInterfaceName; + + /// Name of the network interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string NetworkInterfaceName { get => this._networkInterfaceName; set => this._networkInterfaceName = value; } + + /// Backing field for property. + private string _oSType; + + /// Defines the os type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string OSType { get => this._oSType; set => this._oSType = value; } + + /// Backing field for property. + private string _publisher; + + /// The publisher of the Extension being received. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Publisher { get => this._publisher; set => this._publisher = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceUri; + + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string ResourceUri { get => this._resourceUri; set => this._resourceUri = value; } + + /// Backing field for property. + private string _storageContainerName; + + /// Name of the storage container + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string StorageContainerName { get => this._storageContainerName; set => this._storageContainerName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _version; + + /// The version of the Extension being received. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string Version { get => this._version; set => this._version = value; } + + /// Backing field for property. + private string _virtualHardDiskName; + + /// Name of the virtual hard disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Origin(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.PropertyOrigin.Owned)] + public string VirtualHardDiskName { get => this._virtualHardDiskName; set => this._virtualHardDiskName = value; } + + /// Creates an new instance. + public StackHciVMIdentity() + { + + } + } + public partial interface IStackHciVMIdentity : + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable + { + /// The name of the machine extension. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the machine extension.", + SerializedName = @"extensionName", + PossibleTypes = new [] { typeof(string) })] + string ExtensionName { get; set; } + /// The extensionType of the Extension being received. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The extensionType of the Extension being received.", + SerializedName = @"extensionType", + PossibleTypes = new [] { typeof(string) })] + string ExtensionType { get; set; } + /// Name of the gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Name of the gallery image", + SerializedName = @"galleryImageName", + PossibleTypes = new [] { typeof(string) })] + string GalleryImageName { get; set; } + /// Resource identity path + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource identity path", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + /// The location of the Extension being received. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The location of the Extension being received.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + /// Name of the logical network + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Name of the logical network", + SerializedName = @"logicalNetworkName", + PossibleTypes = new [] { typeof(string) })] + string LogicalNetworkName { get; set; } + /// The name of the hybrid machine. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the hybrid machine.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + string MachineName { get; set; } + /// Name of the marketplace gallery image + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Name of the marketplace gallery image", + SerializedName = @"marketplaceGalleryImageName", + PossibleTypes = new [] { typeof(string) })] + string MarketplaceGalleryImageName { get; set; } + /// Name of the HybridIdentityMetadata. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Name of the HybridIdentityMetadata.", + SerializedName = @"metadataName", + PossibleTypes = new [] { typeof(string) })] + string MetadataName { get; set; } + /// Name of the network interface + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Name of the network interface", + SerializedName = @"networkInterfaceName", + PossibleTypes = new [] { typeof(string) })] + string NetworkInterfaceName { get; set; } + /// Defines the os type. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Defines the os type.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; set; } + /// The publisher of the Extension being received. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The publisher of the Extension being received.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + string Publisher { get; set; } + /// The name of the resource group. The name is case insensitive. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + string ResourceGroupName { get; set; } + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + /// + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.", + SerializedName = @"resourceUri", + PossibleTypes = new [] { typeof(string) })] + string ResourceUri { get; set; } + /// Name of the storage container + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Name of the storage container", + SerializedName = @"storageContainerName", + PossibleTypes = new [] { typeof(string) })] + string StorageContainerName { get; set; } + /// The ID of the target subscription. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + string SubscriptionId { get; set; } + /// The version of the Extension being received. + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The version of the Extension being received.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string Version { get; set; } + /// Name of the virtual hard disk + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Name of the virtual hard disk", + SerializedName = @"virtualHardDiskName", + PossibleTypes = new [] { typeof(string) })] + string VirtualHardDiskName { get; set; } + + } + internal partial interface IStackHciVMIdentityInternal + + { + /// The name of the machine extension. + string ExtensionName { get; set; } + /// The extensionType of the Extension being received. + string ExtensionType { get; set; } + /// Name of the gallery image + string GalleryImageName { get; set; } + /// Resource identity path + string Id { get; set; } + /// The location of the Extension being received. + string Location { get; set; } + /// Name of the logical network + string LogicalNetworkName { get; set; } + /// The name of the hybrid machine. + string MachineName { get; set; } + /// Name of the marketplace gallery image + string MarketplaceGalleryImageName { get; set; } + /// Name of the HybridIdentityMetadata. + string MetadataName { get; set; } + /// Name of the network interface + string NetworkInterfaceName { get; set; } + /// Defines the os type. + string OSType { get; set; } + /// The publisher of the Extension being received. + string Publisher { get; set; } + /// The name of the resource group. The name is case insensitive. + string ResourceGroupName { get; set; } + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + /// + string ResourceUri { get; set; } + /// Name of the storage container + string StorageContainerName { get; set; } + /// The ID of the target subscription. + string SubscriptionId { get; set; } + /// The version of the Extension being received. + string Version { get; set; } + /// Name of the virtual hard disk + string VirtualHardDiskName { get; set; } + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/StackHciVMIdentity.json.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/StackHciVMIdentity.json.cs new file mode 100644 index 000000000000..797802e757b4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Models/StackHciVMIdentity.json.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public partial class StackHciVMIdentity + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new StackHciVMIdentity(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject instance to deserialize from. + internal StackHciVMIdentity(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)SubscriptionId;} + {_resourceGroupName = If( json?.PropertyT("resourceGroupName"), out var __jsonResourceGroupName) ? (string)__jsonResourceGroupName : (string)ResourceGroupName;} + {_galleryImageName = If( json?.PropertyT("galleryImageName"), out var __jsonGalleryImageName) ? (string)__jsonGalleryImageName : (string)GalleryImageName;} + {_marketplaceGalleryImageName = If( json?.PropertyT("marketplaceGalleryImageName"), out var __jsonMarketplaceGalleryImageName) ? (string)__jsonMarketplaceGalleryImageName : (string)MarketplaceGalleryImageName;} + {_networkInterfaceName = If( json?.PropertyT("networkInterfaceName"), out var __jsonNetworkInterfaceName) ? (string)__jsonNetworkInterfaceName : (string)NetworkInterfaceName;} + {_storageContainerName = If( json?.PropertyT("storageContainerName"), out var __jsonStorageContainerName) ? (string)__jsonStorageContainerName : (string)StorageContainerName;} + {_virtualHardDiskName = If( json?.PropertyT("virtualHardDiskName"), out var __jsonVirtualHardDiskName) ? (string)__jsonVirtualHardDiskName : (string)VirtualHardDiskName;} + {_resourceUri = If( json?.PropertyT("resourceUri"), out var __jsonResourceUri) ? (string)__jsonResourceUri : (string)ResourceUri;} + {_machineName = If( json?.PropertyT("machineName"), out var __jsonMachineName) ? (string)__jsonMachineName : (string)MachineName;} + {_metadataName = If( json?.PropertyT("metadataName"), out var __jsonMetadataName) ? (string)__jsonMetadataName : (string)MetadataName;} + {_logicalNetworkName = If( json?.PropertyT("logicalNetworkName"), out var __jsonLogicalNetworkName) ? (string)__jsonLogicalNetworkName : (string)LogicalNetworkName;} + {_extensionName = If( json?.PropertyT("extensionName"), out var __jsonExtensionName) ? (string)__jsonExtensionName : (string)ExtensionName;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + {_publisher = If( json?.PropertyT("publisher"), out var __jsonPublisher) ? (string)__jsonPublisher : (string)Publisher;} + {_extensionType = If( json?.PropertyT("extensionType"), out var __jsonExtensionType) ? (string)__jsonExtensionType : (string)ExtensionType;} + {_version = If( json?.PropertyT("version"), out var __jsonVersion) ? (string)__jsonVersion : (string)Version;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._subscriptionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._subscriptionId.ToString()) : null, "subscriptionId" ,container.Add ); + AddIf( null != (((object)this._resourceGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._resourceGroupName.ToString()) : null, "resourceGroupName" ,container.Add ); + AddIf( null != (((object)this._galleryImageName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._galleryImageName.ToString()) : null, "galleryImageName" ,container.Add ); + AddIf( null != (((object)this._marketplaceGalleryImageName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._marketplaceGalleryImageName.ToString()) : null, "marketplaceGalleryImageName" ,container.Add ); + AddIf( null != (((object)this._networkInterfaceName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._networkInterfaceName.ToString()) : null, "networkInterfaceName" ,container.Add ); + AddIf( null != (((object)this._storageContainerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._storageContainerName.ToString()) : null, "storageContainerName" ,container.Add ); + AddIf( null != (((object)this._virtualHardDiskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._virtualHardDiskName.ToString()) : null, "virtualHardDiskName" ,container.Add ); + AddIf( null != (((object)this._resourceUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._resourceUri.ToString()) : null, "resourceUri" ,container.Add ); + AddIf( null != (((object)this._machineName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._machineName.ToString()) : null, "machineName" ,container.Add ); + AddIf( null != (((object)this._metadataName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._metadataName.ToString()) : null, "metadataName" ,container.Add ); + AddIf( null != (((object)this._logicalNetworkName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._logicalNetworkName.ToString()) : null, "logicalNetworkName" ,container.Add ); + AddIf( null != (((object)this._extensionName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._extensionName.ToString()) : null, "extensionName" ,container.Add ); + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AddIf( null != (((object)this._publisher)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._publisher.ToString()) : null, "publisher" ,container.Add ); + AddIf( null != (((object)this._extensionType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._extensionType.ToString()) : null, "extensionType" ,container.Add ); + AddIf( null != (((object)this._version)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._version.ToString()) : null, "version" ,container.Add ); + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/StackHciVM.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/StackHciVM.cs new file mode 100644 index 000000000000..5abbe295be1f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/StackHciVM.cs @@ -0,0 +1,15170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + /// + /// Low-level API implementation for the StackHCIVm service. + /// The Microsoft.AzureStackHCI Rest API spec + /// + public partial class StackHciVM + { + + /// Gets an Agent Version along with the download link currently present. + /// Defines the os type + /// Defines the agent version. To get latest, use latest or else a specific agent version. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AgentVersionGet(string osType, string version, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.HybridCompute/osType/" + + global::System.Uri.EscapeDataString(osType) + + "/agentVersions/" + + global::System.Uri.EscapeDataString(version) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AgentVersionGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Gets an Agent Version along with the download link currently present. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AgentVersionGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.HybridCompute/osType/(?[^/]+)/agentVersions/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.HybridCompute/osType/{osType}/agentVersions/{version}'"); + } + + // replace URI parameters with values from identity + var osType = _match.Groups["osType"].Value; + var version = _match.Groups["version"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.HybridCompute/osType/" + + osType + + "/agentVersions/" + + version + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AgentVersionGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AgentVersionGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentVersion.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorResponseAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Defines the os type + /// Defines the agent version. To get latest, use latest or else a specific agent version. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AgentVersionGet_Validate(string osType, string version, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(osType),osType); + await eventListener.AssertNotNull(nameof(version),version); + } + } + + /// Gets all Agent Versions along with the download link currently present. + /// Defines the os type. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AgentVersionList(string osType, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.HybridCompute/osType/" + + global::System.Uri.EscapeDataString(osType) + + "/agentVersions" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AgentVersionList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Gets all Agent Versions along with the download link currently present. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task AgentVersionListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.HybridCompute/osType/(?[^/]+)/agentVersions$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.HybridCompute/osType/{osType}/agentVersions'"); + } + + // replace URI parameters with values from identity + var osType = _match.Groups["osType"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.HybridCompute/osType/" + + osType + + "/agentVersions" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.AgentVersionList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AgentVersionList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.AgentVersionsList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.ErrorResponseAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Defines the os type. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task AgentVersionList_Validate(string osType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(osType),osType); + } + } + + /// + /// Gets an Extension Metadata based on location, publisher, extensionType and version + /// + /// The ID of the target subscription. + /// The location of the Extension being received. + /// The publisher of the Extension being received. + /// The extensionType of the Extension being received. + /// The version of the Extension being received. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ExtensionMetadataGet(string subscriptionId, string location, string publisher, string extensionType, string version, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.HybridCompute/locations/" + + global::System.Uri.EscapeDataString(location) + + "/publishers/" + + global::System.Uri.EscapeDataString(publisher) + + "/extensionTypes/" + + global::System.Uri.EscapeDataString(extensionType) + + "/versions/" + + global::System.Uri.EscapeDataString(version) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ExtensionMetadataGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets an Extension Metadata based on location, publisher, extensionType and version + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ExtensionMetadataGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.HybridCompute/locations/(?[^/]+)/publishers/(?[^/]+)/extensionTypes/(?[^/]+)/versions/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions/{version}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var location = _match.Groups["location"].Value; + var publisher = _match.Groups["publisher"].Value; + var extensionType = _match.Groups["extensionType"].Value; + var version = _match.Groups["version"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.HybridCompute/locations/" + + location + + "/publishers/" + + publisher + + "/extensionTypes/" + + extensionType + + "/versions/" + + version + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ExtensionMetadataGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ExtensionMetadataGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ExtensionValue.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The location of the Extension being received. + /// The publisher of the Extension being received. + /// The extensionType of the Extension being received. + /// The version of the Extension being received. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ExtensionMetadataGet_Validate(string subscriptionId, string location, string publisher, string extensionType, string version, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(location),location); + await eventListener.AssertNotNull(nameof(publisher),publisher); + await eventListener.AssertNotNull(nameof(extensionType),extensionType); + await eventListener.AssertNotNull(nameof(version),version); + } + } + + /// Gets all Extension versions based on location, publisher, extensionType + /// The ID of the target subscription. + /// The location of the Extension being received. + /// The publisher of the Extension being received. + /// The extensionType of the Extension being received. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ExtensionMetadataList(string subscriptionId, string location, string publisher, string extensionType, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.HybridCompute/locations/" + + global::System.Uri.EscapeDataString(location) + + "/publishers/" + + global::System.Uri.EscapeDataString(publisher) + + "/extensionTypes/" + + global::System.Uri.EscapeDataString(extensionType) + + "/versions" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ExtensionMetadataList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Gets all Extension versions based on location, publisher, extensionType + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ExtensionMetadataListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.HybridCompute/locations/(?[^/]+)/publishers/(?[^/]+)/extensionTypes/(?[^/]+)/versions$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var location = _match.Groups["location"].Value; + var publisher = _match.Groups["publisher"].Value; + var extensionType = _match.Groups["extensionType"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.HybridCompute/locations/" + + location + + "/publishers/" + + publisher + + "/extensionTypes/" + + extensionType + + "/versions" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ExtensionMetadataList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ExtensionMetadataList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.ExtensionValueListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The location of the Extension being received. + /// The publisher of the Extension being received. + /// The extensionType of the Extension being received. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ExtensionMetadataList_Validate(string subscriptionId, string location, string publisher, string extensionType, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(location),location); + await eventListener.AssertNotNull(nameof(publisher),publisher); + await eventListener.AssertNotNull(nameof(extensionType),extensionType); + } + } + + /// + /// The operation to create or update a gallery image. Please note some properties can be set only during gallery image creation. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the gallery image + /// The gallery images resource definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GalleryImagesCreateOrUpdate(string subscriptionId, string resourceGroupName, string galleryImageName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/galleryImages/" + + global::System.Uri.EscapeDataString(galleryImageName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GalleryImagesCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// The operation to create or update a gallery image. Please note some properties can be set only during gallery image creation. + /// + /// + /// The gallery images resource definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GalleryImagesCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/galleryImages/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var galleryImageName = _match.Groups["galleryImageName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/galleryImages/" + + galleryImageName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GalleryImagesCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GalleryImagesCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImages.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the gallery image + /// The gallery images resource definition. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GalleryImagesCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string galleryImageName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages body, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(galleryImageName),galleryImageName); + await eventListener.AssertMinimumLength(nameof(galleryImageName),galleryImageName,1); + await eventListener.AssertMaximumLength(nameof(galleryImageName),galleryImageName,80); + await eventListener.AssertRegEx(nameof(galleryImageName),galleryImageName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[a-zA-Z0-9]$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to delete a gallery image. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the gallery image + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GalleryImagesDelete(string subscriptionId, string resourceGroupName, string galleryImageName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/galleryImages/" + + global::System.Uri.EscapeDataString(galleryImageName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GalleryImagesDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// The operation to delete a gallery image. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GalleryImagesDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/galleryImages/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var galleryImageName = _match.Groups["galleryImageName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/galleryImages/" + + galleryImageName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GalleryImagesDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GalleryImagesDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var _finalUri = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the gallery image + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GalleryImagesDelete_Validate(string subscriptionId, string resourceGroupName, string galleryImageName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(galleryImageName),galleryImageName); + await eventListener.AssertMinimumLength(nameof(galleryImageName),galleryImageName,1); + await eventListener.AssertMaximumLength(nameof(galleryImageName),galleryImageName,80); + await eventListener.AssertRegEx(nameof(galleryImageName),galleryImageName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[a-zA-Z0-9]$"); + } + } + + /// Gets a gallery image + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the gallery image + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GalleryImagesGet(string subscriptionId, string resourceGroupName, string galleryImageName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/galleryImages/" + + global::System.Uri.EscapeDataString(galleryImageName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GalleryImagesGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Gets a gallery image + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GalleryImagesGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/galleryImages/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var galleryImageName = _match.Groups["galleryImageName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/galleryImages/" + + galleryImageName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GalleryImagesGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GalleryImagesGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImages.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the gallery image + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GalleryImagesGet_Validate(string subscriptionId, string resourceGroupName, string galleryImageName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(galleryImageName),galleryImageName); + await eventListener.AssertMinimumLength(nameof(galleryImageName),galleryImageName,1); + await eventListener.AssertMaximumLength(nameof(galleryImageName),galleryImageName,80); + await eventListener.AssertRegEx(nameof(galleryImageName),galleryImageName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[a-zA-Z0-9]$"); + } + } + + /// + /// Lists all of the gallery images in the specified resource group. Use the nextLink property in the response to get the + /// next page of gallery images. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GalleryImagesList(string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/galleryImages" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GalleryImagesList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all of the gallery images in the specified subscription. Use the nextLink property in the response to get the next + /// page of gallery images. + /// + /// The ID of the target subscription. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GalleryImagesListAll(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.AzureStackHCI/galleryImages" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GalleryImagesListAll_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all of the gallery images in the specified subscription. Use the nextLink property in the response to get the next + /// page of gallery images. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GalleryImagesListAllViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.AzureStackHCI/galleryImages$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/galleryImages'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.AzureStackHCI/galleryImages" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GalleryImagesListAll_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GalleryImagesListAll_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImagesListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GalleryImagesListAll_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + } + } + + /// + /// Lists all of the gallery images in the specified resource group. Use the nextLink property in the response to get the + /// next page of gallery images. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GalleryImagesListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/galleryImages$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/galleryImages" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GalleryImagesList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GalleryImagesList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImagesListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GalleryImagesList_Validate(string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + } + } + + /// The operation to update a gallery image. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the gallery image + /// The gallery images resource patch definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GalleryImagesUpdate(string subscriptionId, string resourceGroupName, string galleryImageName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/galleryImages/" + + global::System.Uri.EscapeDataString(galleryImageName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GalleryImagesUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// The operation to update a gallery image. + /// + /// The gallery images resource patch definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GalleryImagesUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/galleryImages/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var galleryImageName = _match.Groups["galleryImageName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/galleryImages/" + + galleryImageName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GalleryImagesUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GalleryImagesUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImages.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the gallery image + /// The gallery images resource patch definition. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GalleryImagesUpdate_Validate(string subscriptionId, string resourceGroupName, string galleryImageName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequest body, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(galleryImageName),galleryImageName); + await eventListener.AssertMinimumLength(nameof(galleryImageName),galleryImageName,1); + await eventListener.AssertMaximumLength(nameof(galleryImageName),galleryImageName,80); + await eventListener.AssertRegEx(nameof(galleryImageName),galleryImageName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[a-zA-Z0-9]$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Create Or Update GuestAgent. + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// Request payload. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GuestAgentCreate(string resourceUri, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + (resourceUri) + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GuestAgentCreate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Create Or Update GuestAgent. + /// + /// Request payload. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GuestAgentCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/(?[^/]+)/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default'"); + } + + // replace URI parameters with values from identity + var resourceUri = _match.Groups["resourceUri"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + resourceUri + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GuestAgentCreate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GuestAgentCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgent.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// Request payload. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GuestAgentCreate_Validate(string resourceUri, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent body, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceUri),resourceUri); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Implements GuestAgent DELETE method. + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GuestAgentDelete(string resourceUri, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + (resourceUri) + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GuestAgentDelete_Call(request,onNoContent,onDefault,eventListener,sender); + } + } + + /// Implements GuestAgent DELETE method. + /// + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GuestAgentDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/(?[^/]+)/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default'"); + } + + // replace URI parameters with values from identity + var resourceUri = _match.Groups["resourceUri"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + resourceUri + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GuestAgentDelete_Call(request,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GuestAgentDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GuestAgentDelete_Validate(string resourceUri, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceUri),resourceUri); + } + } + + /// Implements GuestAgent GET method. + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GuestAgentGet(string resourceUri, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + (resourceUri) + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GuestAgentGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Implements GuestAgent GET method. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GuestAgentGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/(?[^/]+)/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default'"); + } + + // replace URI parameters with values from identity + var resourceUri = _match.Groups["resourceUri"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + resourceUri + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GuestAgentGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GuestAgentGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgent.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GuestAgentGet_Validate(string resourceUri, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceUri),resourceUri); + } + } + + /// Returns the list of GuestAgent of the given vm. + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GuestAgentsList(string resourceUri, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + (resourceUri) + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GuestAgentsList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Returns the list of GuestAgent of the given vm. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task GuestAgentsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/(?[^/]+)/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents'"); + } + + // replace URI parameters with values from identity + var resourceUri = _match.Groups["resourceUri"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + resourceUri + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.GuestAgentsList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GuestAgentsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgentList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task GuestAgentsList_Validate(string resourceUri, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceUri),resourceUri); + } + } + + /// Implements HybridIdentityMetadata GET method. + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task HybridIdentityMetadataGet(string resourceUri, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + (resourceUri) + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.HybridIdentityMetadataGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Implements HybridIdentityMetadata GET method. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the hybrid machine. + /// Name of the HybridIdentityMetadata. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task HybridIdentityMetadataGet1(string subscriptionId, string resourceGroupName, string machineName, string metadataName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HybridCompute/machines/" + + global::System.Uri.EscapeDataString(machineName) + + "/hybridIdentityMetadata/" + + global::System.Uri.EscapeDataString(metadataName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.HybridIdentityMetadataGet1_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Implements HybridIdentityMetadata GET method. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task HybridIdentityMetadataGet1ViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HybridCompute/machines/(?[^/]+)/hybridIdentityMetadata/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/hybridIdentityMetadata/{metadataName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var machineName = _match.Groups["machineName"].Value; + var metadataName = _match.Groups["metadataName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HybridCompute/machines/" + + machineName + + "/hybridIdentityMetadata/" + + metadataName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.HybridIdentityMetadataGet1_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task HybridIdentityMetadataGet1_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.HybridIdentityMetadataAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the hybrid machine. + /// Name of the HybridIdentityMetadata. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task HybridIdentityMetadataGet1_Validate(string subscriptionId, string resourceGroupName, string machineName, string metadataName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(machineName),machineName); + await eventListener.AssertMinimumLength(nameof(machineName),machineName,1); + await eventListener.AssertMaximumLength(nameof(machineName),machineName,54); + await eventListener.AssertRegEx(nameof(machineName),machineName,@"[a-zA-Z0-9-_\.]"); + await eventListener.AssertNotNull(nameof(metadataName),metadataName); + await eventListener.AssertRegEx(nameof(metadataName),metadataName,@"[a-zA-Z0-9-_\.]"); + } + } + + /// Implements HybridIdentityMetadata GET method. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task HybridIdentityMetadataGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/(?[^/]+)/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata/default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata/default'"); + } + + // replace URI parameters with values from identity + var resourceUri = _match.Groups["resourceUri"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + resourceUri + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.HybridIdentityMetadataGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task HybridIdentityMetadataGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HybridIdentityMetadata.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task HybridIdentityMetadataGet_Validate(string resourceUri, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceUri),resourceUri); + } + } + + /// Returns the list of HybridIdentityMetadata of the given vm. + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task HybridIdentityMetadataList(string resourceUri, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + (resourceUri) + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.HybridIdentityMetadataList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Returns the list of HybridIdentityMetadata of the given machine. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the hybrid machine. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task HybridIdentityMetadataListByMachines(string subscriptionId, string resourceGroupName, string machineName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HybridCompute/machines/" + + global::System.Uri.EscapeDataString(machineName) + + "/hybridIdentityMetadata" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.HybridIdentityMetadataListByMachines_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Returns the list of HybridIdentityMetadata of the given machine. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task HybridIdentityMetadataListByMachinesViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HybridCompute/machines/(?[^/]+)/hybridIdentityMetadata$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/hybridIdentityMetadata'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var machineName = _match.Groups["machineName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HybridCompute/machines/" + + machineName + + "/hybridIdentityMetadata" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.HybridIdentityMetadataListByMachines_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task HybridIdentityMetadataListByMachines_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.HybridIdentityMetadataListAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the hybrid machine. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task HybridIdentityMetadataListByMachines_Validate(string subscriptionId, string resourceGroupName, string machineName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(machineName),machineName); + await eventListener.AssertMinimumLength(nameof(machineName),machineName,1); + await eventListener.AssertMaximumLength(nameof(machineName),machineName,54); + await eventListener.AssertRegEx(nameof(machineName),machineName,@"[a-zA-Z0-9-_\.]"); + } + } + + /// Returns the list of HybridIdentityMetadata of the given vm. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task HybridIdentityMetadataListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/(?[^/]+)/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata'"); + } + + // replace URI parameters with values from identity + var resourceUri = _match.Groups["resourceUri"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + resourceUri + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.HybridIdentityMetadataList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task HybridIdentityMetadataList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.HybridIdentityMetadataList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task HybridIdentityMetadataList_Validate(string resourceUri, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceUri),resourceUri); + } + } + + /// + /// The operation to create or update a logical network. Please note some properties can be set only during logical network + /// creation. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the logical network + /// The logical network resource definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LogicalNetworksCreateOrUpdate(string subscriptionId, string resourceGroupName, string logicalNetworkName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/logicalNetworks/" + + global::System.Uri.EscapeDataString(logicalNetworkName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LogicalNetworksCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// The operation to create or update a logical network. Please note some properties can be set only during logical network + /// creation. + /// + /// + /// The logical network resource definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LogicalNetworksCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/logicalNetworks/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var logicalNetworkName = _match.Groups["logicalNetworkName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/logicalNetworks/" + + logicalNetworkName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LogicalNetworksCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LogicalNetworksCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworks.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the logical network + /// The logical network resource definition. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LogicalNetworksCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string logicalNetworkName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks body, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(logicalNetworkName),logicalNetworkName); + await eventListener.AssertMinimumLength(nameof(logicalNetworkName),logicalNetworkName,2); + await eventListener.AssertMaximumLength(nameof(logicalNetworkName),logicalNetworkName,64); + await eventListener.AssertRegEx(nameof(logicalNetworkName),logicalNetworkName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,62}[_a-zA-Z0-9]$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to delete a logical network. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the logical network + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LogicalNetworksDelete(string subscriptionId, string resourceGroupName, string logicalNetworkName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/logicalNetworks/" + + global::System.Uri.EscapeDataString(logicalNetworkName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LogicalNetworksDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// The operation to delete a logical network. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LogicalNetworksDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/logicalNetworks/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var logicalNetworkName = _match.Groups["logicalNetworkName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/logicalNetworks/" + + logicalNetworkName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LogicalNetworksDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LogicalNetworksDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var _finalUri = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the logical network + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LogicalNetworksDelete_Validate(string subscriptionId, string resourceGroupName, string logicalNetworkName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(logicalNetworkName),logicalNetworkName); + await eventListener.AssertMinimumLength(nameof(logicalNetworkName),logicalNetworkName,2); + await eventListener.AssertMaximumLength(nameof(logicalNetworkName),logicalNetworkName,64); + await eventListener.AssertRegEx(nameof(logicalNetworkName),logicalNetworkName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,62}[_a-zA-Z0-9]$"); + } + } + + /// Gets a logical network + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the logical network + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LogicalNetworksGet(string subscriptionId, string resourceGroupName, string logicalNetworkName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/logicalNetworks/" + + global::System.Uri.EscapeDataString(logicalNetworkName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LogicalNetworksGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Gets a logical network + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LogicalNetworksGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/logicalNetworks/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var logicalNetworkName = _match.Groups["logicalNetworkName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/logicalNetworks/" + + logicalNetworkName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LogicalNetworksGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LogicalNetworksGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworks.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the logical network + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LogicalNetworksGet_Validate(string subscriptionId, string resourceGroupName, string logicalNetworkName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(logicalNetworkName),logicalNetworkName); + await eventListener.AssertMinimumLength(nameof(logicalNetworkName),logicalNetworkName,2); + await eventListener.AssertMaximumLength(nameof(logicalNetworkName),logicalNetworkName,64); + await eventListener.AssertRegEx(nameof(logicalNetworkName),logicalNetworkName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,62}[_a-zA-Z0-9]$"); + } + } + + /// + /// Lists all of the logical networks in the specified resource group. Use the nextLink property in the response to get the + /// next page of logical networks. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LogicalNetworksList(string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/logicalNetworks" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LogicalNetworksList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all of the logical networks in the specified subscription. Use the nextLink property in the response to get the + /// next page of logical networks. + /// + /// The ID of the target subscription. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LogicalNetworksListAll(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.AzureStackHCI/logicalNetworks" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LogicalNetworksListAll_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all of the logical networks in the specified subscription. Use the nextLink property in the response to get the + /// next page of logical networks. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LogicalNetworksListAllViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.AzureStackHCI/logicalNetworks$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/logicalNetworks'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.AzureStackHCI/logicalNetworks" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LogicalNetworksListAll_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LogicalNetworksListAll_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworksListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LogicalNetworksListAll_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + } + } + + /// + /// Lists all of the logical networks in the specified resource group. Use the nextLink property in the response to get the + /// next page of logical networks. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LogicalNetworksListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/logicalNetworks$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/logicalNetworks" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LogicalNetworksList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LogicalNetworksList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworksListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LogicalNetworksList_Validate(string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + } + } + + /// The operation to update a logical network. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the logical network + /// The logical network resource patch definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LogicalNetworksUpdate(string subscriptionId, string resourceGroupName, string logicalNetworkName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/logicalNetworks/" + + global::System.Uri.EscapeDataString(logicalNetworkName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LogicalNetworksUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// The operation to update a logical network. + /// + /// The logical network resource patch definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LogicalNetworksUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/logicalNetworks/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var logicalNetworkName = _match.Groups["logicalNetworkName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/logicalNetworks/" + + logicalNetworkName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LogicalNetworksUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LogicalNetworksUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworks.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the logical network + /// The logical network resource patch definition. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LogicalNetworksUpdate_Validate(string subscriptionId, string resourceGroupName, string logicalNetworkName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequest body, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(logicalNetworkName),logicalNetworkName); + await eventListener.AssertMinimumLength(nameof(logicalNetworkName),logicalNetworkName,2); + await eventListener.AssertMaximumLength(nameof(logicalNetworkName),logicalNetworkName,64); + await eventListener.AssertRegEx(nameof(logicalNetworkName),logicalNetworkName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,62}[_a-zA-Z0-9]$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to create or update the extension. + /// The name of the resource group. The name is case insensitive. + /// The name of the machine where the extension should be created or updated. + /// The name of the machine extension. + /// The ID of the target subscription. + /// Parameters supplied to the Create Machine Extension operation. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachineExtensionsCreateOrUpdate(string resourceGroupName, string machineName, string extensionName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HybridCompute/machines/" + + global::System.Uri.EscapeDataString(machineName) + + "/extensions/" + + global::System.Uri.EscapeDataString(extensionName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachineExtensionsCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// The operation to create or update the extension. + /// + /// Parameters supplied to the Create Machine Extension operation. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachineExtensionsCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HybridCompute/machines/(?[^/]+)/extensions/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var machineName = _match.Groups["machineName"].Value; + var extensionName = _match.Groups["extensionName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HybridCompute/machines/" + + machineName + + "/extensions/" + + extensionName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachineExtensionsCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MachineExtensionsCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtension.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the resource group. The name is case insensitive. + /// The name of the machine where the extension should be created or updated. + /// The name of the machine extension. + /// The ID of the target subscription. + /// Parameters supplied to the Create Machine Extension operation. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MachineExtensionsCreateOrUpdate_Validate(string resourceGroupName, string machineName, string extensionName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension body, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(machineName),machineName); + await eventListener.AssertMinimumLength(nameof(machineName),machineName,1); + await eventListener.AssertMaximumLength(nameof(machineName),machineName,54); + await eventListener.AssertRegEx(nameof(machineName),machineName,@"[a-zA-Z0-9-_\.]"); + await eventListener.AssertNotNull(nameof(extensionName),extensionName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to delete the extension. + /// The name of the resource group. The name is case insensitive. + /// The name of the machine where the extension should be deleted. + /// The name of the machine extension. + /// The ID of the target subscription. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachineExtensionsDelete(string resourceGroupName, string machineName, string extensionName, string subscriptionId, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HybridCompute/machines/" + + global::System.Uri.EscapeDataString(machineName) + + "/extensions/" + + global::System.Uri.EscapeDataString(extensionName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachineExtensionsDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// The operation to delete the extension. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachineExtensionsDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HybridCompute/machines/(?[^/]+)/extensions/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var machineName = _match.Groups["machineName"].Value; + var extensionName = _match.Groups["extensionName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HybridCompute/machines/" + + machineName + + "/extensions/" + + extensionName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachineExtensionsDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MachineExtensionsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The name of the resource group. The name is case insensitive. + /// The name of the machine where the extension should be deleted. + /// The name of the machine extension. + /// The ID of the target subscription. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MachineExtensionsDelete_Validate(string resourceGroupName, string machineName, string extensionName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(machineName),machineName); + await eventListener.AssertMinimumLength(nameof(machineName),machineName,1); + await eventListener.AssertMaximumLength(nameof(machineName),machineName,54); + await eventListener.AssertRegEx(nameof(machineName),machineName,@"[a-zA-Z0-9-_\.]"); + await eventListener.AssertNotNull(nameof(extensionName),extensionName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + } + } + + /// The operation to get the extension. + /// The name of the resource group. The name is case insensitive. + /// The name of the machine containing the extension. + /// The name of the machine extension. + /// The ID of the target subscription. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachineExtensionsGet(string resourceGroupName, string machineName, string extensionName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HybridCompute/machines/" + + global::System.Uri.EscapeDataString(machineName) + + "/extensions/" + + global::System.Uri.EscapeDataString(extensionName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachineExtensionsGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// The operation to get the extension. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachineExtensionsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HybridCompute/machines/(?[^/]+)/extensions/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var machineName = _match.Groups["machineName"].Value; + var extensionName = _match.Groups["extensionName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HybridCompute/machines/" + + machineName + + "/extensions/" + + extensionName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachineExtensionsGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MachineExtensionsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtension.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the resource group. The name is case insensitive. + /// The name of the machine containing the extension. + /// The name of the machine extension. + /// The ID of the target subscription. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MachineExtensionsGet_Validate(string resourceGroupName, string machineName, string extensionName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(machineName),machineName); + await eventListener.AssertMinimumLength(nameof(machineName),machineName,1); + await eventListener.AssertMaximumLength(nameof(machineName),machineName,54); + await eventListener.AssertRegEx(nameof(machineName),machineName,@"[a-zA-Z0-9-_\.]"); + await eventListener.AssertNotNull(nameof(extensionName),extensionName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + } + } + + /// The operation to get all extensions of a non-Azure machine + /// The name of the resource group. The name is case insensitive. + /// The name of the machine containing the extension. + /// The expand expression to apply on the operation. + /// The ID of the target subscription. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachineExtensionsList(string resourceGroupName, string machineName, string Expand, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HybridCompute/machines/" + + global::System.Uri.EscapeDataString(machineName) + + "/extensions" + + "?" + + (string.IsNullOrEmpty(Expand) ? global::System.String.Empty : "$expand=" + global::System.Uri.EscapeDataString(Expand)) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachineExtensionsList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// The operation to get all extensions of a non-Azure machine + /// + /// The expand expression to apply on the operation. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachineExtensionsListViaIdentity(global::System.String viaIdentity, string Expand, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HybridCompute/machines/(?[^/]+)/extensions$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var machineName = _match.Groups["machineName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HybridCompute/machines/" + + machineName + + "/extensions" + + "?" + + (string.IsNullOrEmpty(Expand) ? global::System.String.Empty : "$expand=" + global::System.Uri.EscapeDataString(Expand)) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachineExtensionsList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MachineExtensionsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionsListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the resource group. The name is case insensitive. + /// The name of the machine containing the extension. + /// The expand expression to apply on the operation. + /// The ID of the target subscription. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MachineExtensionsList_Validate(string resourceGroupName, string machineName, string Expand, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(machineName),machineName); + await eventListener.AssertMinimumLength(nameof(machineName),machineName,1); + await eventListener.AssertMaximumLength(nameof(machineName),machineName,54); + await eventListener.AssertRegEx(nameof(machineName),machineName,@"[a-zA-Z0-9-_\.]"); + await eventListener.AssertNotNull(nameof(Expand),Expand); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + } + } + + /// The operation to create or update the extension. + /// The name of the resource group. The name is case insensitive. + /// The name of the machine where the extension should be created or updated. + /// The name of the machine extension. + /// The ID of the target subscription. + /// Parameters supplied to the Create Machine Extension operation. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachineExtensionsUpdate(string resourceGroupName, string machineName, string extensionName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HybridCompute/machines/" + + global::System.Uri.EscapeDataString(machineName) + + "/extensions/" + + global::System.Uri.EscapeDataString(extensionName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachineExtensionsUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// The operation to create or update the extension. + /// + /// Parameters supplied to the Create Machine Extension operation. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachineExtensionsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HybridCompute/machines/(?[^/]+)/extensions/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var machineName = _match.Groups["machineName"].Value; + var extensionName = _match.Groups["extensionName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HybridCompute/machines/" + + machineName + + "/extensions/" + + extensionName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachineExtensionsUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MachineExtensionsUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtension.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The name of the resource group. The name is case insensitive. + /// The name of the machine where the extension should be created or updated. + /// The name of the machine extension. + /// The ID of the target subscription. + /// Parameters supplied to the Create Machine Extension operation. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MachineExtensionsUpdate_Validate(string resourceGroupName, string machineName, string extensionName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdate body, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(machineName),machineName); + await eventListener.AssertMinimumLength(nameof(machineName),machineName,1); + await eventListener.AssertMaximumLength(nameof(machineName),machineName,54); + await eventListener.AssertRegEx(nameof(machineName),machineName,@"[a-zA-Z0-9-_\.]"); + await eventListener.AssertNotNull(nameof(extensionName),extensionName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// The operation to create or update a hybrid machine. Please note some properties can be set only during machine creation. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the hybrid machine. + /// Parameters supplied to the Create hybrid machine operation. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachinesCreateOrUpdate(string subscriptionId, string resourceGroupName, string machineName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HybridCompute/machines/" + + global::System.Uri.EscapeDataString(machineName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachinesCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// The operation to create or update a hybrid machine. Please note some properties can be set only during machine creation. + /// + /// + /// Parameters supplied to the Create hybrid machine operation. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachinesCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HybridCompute/machines/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var machineName = _match.Groups["machineName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HybridCompute/machines/" + + machineName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachinesCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MachinesCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.Machine.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the hybrid machine. + /// Parameters supplied to the Create hybrid machine operation. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MachinesCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string machineName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine body, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(machineName),machineName); + await eventListener.AssertMinimumLength(nameof(machineName),machineName,1); + await eventListener.AssertMaximumLength(nameof(machineName),machineName,54); + await eventListener.AssertRegEx(nameof(machineName),machineName,@"[a-zA-Z0-9-_\.]"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to delete a hybrid machine. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the hybrid machine. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachinesDelete(string subscriptionId, string resourceGroupName, string machineName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HybridCompute/machines/" + + global::System.Uri.EscapeDataString(machineName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachinesDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// The operation to delete a hybrid machine. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachinesDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HybridCompute/machines/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var machineName = _match.Groups["machineName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HybridCompute/machines/" + + machineName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachinesDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MachinesDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the hybrid machine. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MachinesDelete_Validate(string subscriptionId, string resourceGroupName, string machineName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(machineName),machineName); + await eventListener.AssertMinimumLength(nameof(machineName),machineName,1); + await eventListener.AssertMaximumLength(nameof(machineName),machineName,54); + await eventListener.AssertRegEx(nameof(machineName),machineName,@"[a-zA-Z0-9-_\.]"); + } + } + + /// + /// Retrieves information about the model view or the instance view of a hybrid machine. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the hybrid machine. + /// The expand expression to apply on the operation. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachinesGet(string subscriptionId, string resourceGroupName, string machineName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.InstanceViewTypes? Expand, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HybridCompute/machines/" + + global::System.Uri.EscapeDataString(machineName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(Expand) ? global::System.String.Empty : "$expand=" + global::System.Uri.EscapeDataString(Expand)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachinesGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Retrieves information about the model view or the instance view of a hybrid machine. + /// + /// + /// The expand expression to apply on the operation. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachinesGetViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.InstanceViewTypes? Expand, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HybridCompute/machines/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var machineName = _match.Groups["machineName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HybridCompute/machines/" + + machineName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(Expand) ? global::System.String.Empty : "$expand=" + global::System.Uri.EscapeDataString(Expand)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachinesGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MachinesGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.Machine.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the hybrid machine. + /// The expand expression to apply on the operation. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MachinesGet_Validate(string subscriptionId, string resourceGroupName, string machineName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.InstanceViewTypes? Expand, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(machineName),machineName); + await eventListener.AssertMinimumLength(nameof(machineName),machineName,1); + await eventListener.AssertMaximumLength(nameof(machineName),machineName,54); + await eventListener.AssertRegEx(nameof(machineName),machineName,@"[a-zA-Z0-9-_\.]"); + await eventListener.AssertNotNull(nameof(Expand),Expand); + await eventListener.AssertEnum(nameof(Expand),Expand,@"instanceView"); + } + } + + /// + /// Lists all the hybrid machines in the specified resource group. Use the nextLink property in the response to get the next + /// page of hybrid machines. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachinesListByResourceGroup(string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HybridCompute/machines" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachinesListByResourceGroup_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all the hybrid machines in the specified resource group. Use the nextLink property in the response to get the next + /// page of hybrid machines. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachinesListByResourceGroupViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HybridCompute/machines$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HybridCompute/machines" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachinesListByResourceGroup_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MachinesListByResourceGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MachinesListByResourceGroup_Validate(string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + } + } + + /// + /// Lists all the hybrid machines in the specified subscription. Use the nextLink property in the response to get the next + /// page of hybrid machines. + /// + /// The ID of the target subscription. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachinesListBySubscription(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.HybridCompute/machines" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachinesListBySubscription_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all the hybrid machines in the specified subscription. Use the nextLink property in the response to get the next + /// page of hybrid machines. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachinesListBySubscriptionViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.HybridCompute/machines$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/machines'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.HybridCompute/machines" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachinesListBySubscription_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MachinesListBySubscription_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The ID of the target subscription. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MachinesListBySubscription_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + } + } + + /// The operation to update a hybrid machine. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the hybrid machine. + /// Parameters supplied to the Update hybrid machine operation. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachinesUpdate(string subscriptionId, string resourceGroupName, string machineName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HybridCompute/machines/" + + global::System.Uri.EscapeDataString(machineName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachinesUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// The operation to update a hybrid machine. + /// + /// Parameters supplied to the Update hybrid machine operation. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachinesUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HybridCompute/machines/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var machineName = _match.Groups["machineName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HybridCompute/machines/" + + machineName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachinesUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MachinesUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.Machine.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the hybrid machine. + /// Parameters supplied to the Update hybrid machine operation. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MachinesUpdate_Validate(string subscriptionId, string resourceGroupName, string machineName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdate body, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(machineName),machineName); + await eventListener.AssertMinimumLength(nameof(machineName),machineName,1); + await eventListener.AssertMaximumLength(nameof(machineName),machineName,54); + await eventListener.AssertRegEx(nameof(machineName),machineName,@"[a-zA-Z0-9-_\.]"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// The operation to create or update a marketplace gallery image. Please note some properties can be set only during marketplace + /// gallery image creation. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the marketplace gallery image + /// The marketplace gallery image resource definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MarketplaceGalleryImagesCreateOrUpdate(string subscriptionId, string resourceGroupName, string marketplaceGalleryImageName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/" + + global::System.Uri.EscapeDataString(marketplaceGalleryImageName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MarketplaceGalleryImagesCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// The operation to create or update a marketplace gallery image. Please note some properties can be set only during marketplace + /// gallery image creation. + /// + /// + /// The marketplace gallery image resource definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MarketplaceGalleryImagesCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var marketplaceGalleryImageName = _match.Groups["marketplaceGalleryImageName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/" + + marketplaceGalleryImageName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MarketplaceGalleryImagesCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MarketplaceGalleryImagesCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImages.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the marketplace gallery image + /// The marketplace gallery image resource definition. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MarketplaceGalleryImagesCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string marketplaceGalleryImageName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages body, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(marketplaceGalleryImageName),marketplaceGalleryImageName); + await eventListener.AssertMinimumLength(nameof(marketplaceGalleryImageName),marketplaceGalleryImageName,1); + await eventListener.AssertMaximumLength(nameof(marketplaceGalleryImageName),marketplaceGalleryImageName,80); + await eventListener.AssertRegEx(nameof(marketplaceGalleryImageName),marketplaceGalleryImageName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[a-zA-Z0-9]$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to delete a marketplace gallery image. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the marketplace gallery image + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MarketplaceGalleryImagesDelete(string subscriptionId, string resourceGroupName, string marketplaceGalleryImageName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/" + + global::System.Uri.EscapeDataString(marketplaceGalleryImageName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MarketplaceGalleryImagesDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// The operation to delete a marketplace gallery image. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MarketplaceGalleryImagesDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var marketplaceGalleryImageName = _match.Groups["marketplaceGalleryImageName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/" + + marketplaceGalleryImageName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MarketplaceGalleryImagesDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MarketplaceGalleryImagesDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var _finalUri = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the marketplace gallery image + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MarketplaceGalleryImagesDelete_Validate(string subscriptionId, string resourceGroupName, string marketplaceGalleryImageName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(marketplaceGalleryImageName),marketplaceGalleryImageName); + await eventListener.AssertMinimumLength(nameof(marketplaceGalleryImageName),marketplaceGalleryImageName,1); + await eventListener.AssertMaximumLength(nameof(marketplaceGalleryImageName),marketplaceGalleryImageName,80); + await eventListener.AssertRegEx(nameof(marketplaceGalleryImageName),marketplaceGalleryImageName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[a-zA-Z0-9]$"); + } + } + + /// Gets a marketplace gallery image + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the marketplace gallery image + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MarketplaceGalleryImagesGet(string subscriptionId, string resourceGroupName, string marketplaceGalleryImageName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/" + + global::System.Uri.EscapeDataString(marketplaceGalleryImageName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MarketplaceGalleryImagesGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Gets a marketplace gallery image + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MarketplaceGalleryImagesGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var marketplaceGalleryImageName = _match.Groups["marketplaceGalleryImageName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/" + + marketplaceGalleryImageName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MarketplaceGalleryImagesGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MarketplaceGalleryImagesGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImages.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the marketplace gallery image + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MarketplaceGalleryImagesGet_Validate(string subscriptionId, string resourceGroupName, string marketplaceGalleryImageName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(marketplaceGalleryImageName),marketplaceGalleryImageName); + await eventListener.AssertMinimumLength(nameof(marketplaceGalleryImageName),marketplaceGalleryImageName,1); + await eventListener.AssertMaximumLength(nameof(marketplaceGalleryImageName),marketplaceGalleryImageName,80); + await eventListener.AssertRegEx(nameof(marketplaceGalleryImageName),marketplaceGalleryImageName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[a-zA-Z0-9]$"); + } + } + + /// + /// Lists all of the marketplace gallery images in the specified resource group. Use the nextLink property in the response + /// to get the next page of marketplace gallery images. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MarketplaceGalleryImagesList(string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MarketplaceGalleryImagesList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all of the marketplace gallery images in the specified subscription. Use the nextLink property in the response to + /// get the next page of marketplace gallery images. + /// + /// The ID of the target subscription. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MarketplaceGalleryImagesListAll(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MarketplaceGalleryImagesListAll_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all of the marketplace gallery images in the specified subscription. Use the nextLink property in the response to + /// get the next page of marketplace gallery images. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MarketplaceGalleryImagesListAllViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MarketplaceGalleryImagesListAll_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MarketplaceGalleryImagesListAll_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImagesListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The ID of the target subscription. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MarketplaceGalleryImagesListAll_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + } + } + + /// + /// Lists all of the marketplace gallery images in the specified resource group. Use the nextLink property in the response + /// to get the next page of marketplace gallery images. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MarketplaceGalleryImagesListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MarketplaceGalleryImagesList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MarketplaceGalleryImagesList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImagesListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MarketplaceGalleryImagesList_Validate(string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + } + } + + /// The operation to update a marketplace gallery image. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the marketplace gallery image + /// The marketplace gallery image resource patch definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MarketplaceGalleryImagesUpdate(string subscriptionId, string resourceGroupName, string marketplaceGalleryImageName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/" + + global::System.Uri.EscapeDataString(marketplaceGalleryImageName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MarketplaceGalleryImagesUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// The operation to update a marketplace gallery image. + /// + /// The marketplace gallery image resource patch definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MarketplaceGalleryImagesUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var marketplaceGalleryImageName = _match.Groups["marketplaceGalleryImageName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/" + + marketplaceGalleryImageName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MarketplaceGalleryImagesUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MarketplaceGalleryImagesUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImages.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the marketplace gallery image + /// The marketplace gallery image resource patch definition. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MarketplaceGalleryImagesUpdate_Validate(string subscriptionId, string resourceGroupName, string marketplaceGalleryImageName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequest body, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(marketplaceGalleryImageName),marketplaceGalleryImageName); + await eventListener.AssertMinimumLength(nameof(marketplaceGalleryImageName),marketplaceGalleryImageName,1); + await eventListener.AssertMaximumLength(nameof(marketplaceGalleryImageName),marketplaceGalleryImageName,80); + await eventListener.AssertRegEx(nameof(marketplaceGalleryImageName),marketplaceGalleryImageName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[a-zA-Z0-9]$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// The operation to create or update a network interface. Please note some properties can be set only during network interface + /// creation. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the network interface + /// The network interface resource definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task NetworkInterfacesCreateOrUpdate(string subscriptionId, string resourceGroupName, string networkInterfaceName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/networkInterfaces/" + + global::System.Uri.EscapeDataString(networkInterfaceName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.NetworkInterfacesCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// The operation to create or update a network interface. Please note some properties can be set only during network interface + /// creation. + /// + /// + /// The network interface resource definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task NetworkInterfacesCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/networkInterfaces/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var networkInterfaceName = _match.Groups["networkInterfaceName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/networkInterfaces/" + + networkInterfaceName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.NetworkInterfacesCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task NetworkInterfacesCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaces.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the network interface + /// The network interface resource definition. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task NetworkInterfacesCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string networkInterfaceName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces body, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(networkInterfaceName),networkInterfaceName); + await eventListener.AssertMinimumLength(nameof(networkInterfaceName),networkInterfaceName,1); + await eventListener.AssertMaximumLength(nameof(networkInterfaceName),networkInterfaceName,80); + await eventListener.AssertRegEx(nameof(networkInterfaceName),networkInterfaceName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to delete a network interface. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the network interface + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task NetworkInterfacesDelete(string subscriptionId, string resourceGroupName, string networkInterfaceName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/networkInterfaces/" + + global::System.Uri.EscapeDataString(networkInterfaceName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.NetworkInterfacesDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// The operation to delete a network interface. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task NetworkInterfacesDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/networkInterfaces/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var networkInterfaceName = _match.Groups["networkInterfaceName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/networkInterfaces/" + + networkInterfaceName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.NetworkInterfacesDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task NetworkInterfacesDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var _finalUri = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the network interface + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task NetworkInterfacesDelete_Validate(string subscriptionId, string resourceGroupName, string networkInterfaceName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(networkInterfaceName),networkInterfaceName); + await eventListener.AssertMinimumLength(nameof(networkInterfaceName),networkInterfaceName,1); + await eventListener.AssertMaximumLength(nameof(networkInterfaceName),networkInterfaceName,80); + await eventListener.AssertRegEx(nameof(networkInterfaceName),networkInterfaceName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$"); + } + } + + /// Gets a network interface + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the network interface + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task NetworkInterfacesGet(string subscriptionId, string resourceGroupName, string networkInterfaceName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/networkInterfaces/" + + global::System.Uri.EscapeDataString(networkInterfaceName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.NetworkInterfacesGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Gets a network interface + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task NetworkInterfacesGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/networkInterfaces/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var networkInterfaceName = _match.Groups["networkInterfaceName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/networkInterfaces/" + + networkInterfaceName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.NetworkInterfacesGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task NetworkInterfacesGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaces.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the network interface + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task NetworkInterfacesGet_Validate(string subscriptionId, string resourceGroupName, string networkInterfaceName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(networkInterfaceName),networkInterfaceName); + await eventListener.AssertMinimumLength(nameof(networkInterfaceName),networkInterfaceName,1); + await eventListener.AssertMaximumLength(nameof(networkInterfaceName),networkInterfaceName,80); + await eventListener.AssertRegEx(nameof(networkInterfaceName),networkInterfaceName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$"); + } + } + + /// + /// Lists all of the network interfaces in the specified resource group. Use the nextLink property in the response to get + /// the next page of network interfaces. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task NetworkInterfacesList(string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/networkInterfaces" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.NetworkInterfacesList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all of the network interfaces in the specified subscription. Use the nextLink property in the response to get the + /// next page of network interfaces. + /// + /// The ID of the target subscription. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task NetworkInterfacesListAll(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.AzureStackHCI/networkInterfaces" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.NetworkInterfacesListAll_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all of the network interfaces in the specified subscription. Use the nextLink property in the response to get the + /// next page of network interfaces. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task NetworkInterfacesListAllViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.AzureStackHCI/networkInterfaces$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/networkInterfaces'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.AzureStackHCI/networkInterfaces" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.NetworkInterfacesListAll_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task NetworkInterfacesListAll_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfacesListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The ID of the target subscription. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task NetworkInterfacesListAll_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + } + } + + /// + /// Lists all of the network interfaces in the specified resource group. Use the nextLink property in the response to get + /// the next page of network interfaces. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task NetworkInterfacesListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/networkInterfaces$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/networkInterfaces" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.NetworkInterfacesList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task NetworkInterfacesList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfacesListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task NetworkInterfacesList_Validate(string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + } + } + + /// The operation to update a network interface. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the network interface + /// The network interface resource patch definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task NetworkInterfacesUpdate(string subscriptionId, string resourceGroupName, string networkInterfaceName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/networkInterfaces/" + + global::System.Uri.EscapeDataString(networkInterfaceName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.NetworkInterfacesUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// The operation to update a network interface. + /// + /// The network interface resource patch definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task NetworkInterfacesUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/networkInterfaces/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var networkInterfaceName = _match.Groups["networkInterfaceName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/networkInterfaces/" + + networkInterfaceName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.NetworkInterfacesUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task NetworkInterfacesUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaces.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the network interface + /// The network interface resource patch definition. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task NetworkInterfacesUpdate_Validate(string subscriptionId, string resourceGroupName, string networkInterfaceName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequest body, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(networkInterfaceName),networkInterfaceName); + await eventListener.AssertMinimumLength(nameof(networkInterfaceName),networkInterfaceName,1); + await eventListener.AssertMaximumLength(nameof(networkInterfaceName),networkInterfaceName,80); + await eventListener.AssertRegEx(nameof(networkInterfaceName),networkInterfaceName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to get network information of hybrid machine + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the hybrid machine. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task NetworkProfileGet(string subscriptionId, string resourceGroupName, string machineName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HybridCompute/machines/" + + global::System.Uri.EscapeDataString(machineName) + + "/networkProfile" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.NetworkProfileGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// The operation to get network information of hybrid machine + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task NetworkProfileGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HybridCompute/machines/(?[^/]+)/networkProfile$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/networkProfile'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var machineName = _match.Groups["machineName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HybridCompute/machines/" + + machineName + + "/networkProfile" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.NetworkProfileGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task NetworkProfileGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.NetworkProfile.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the hybrid machine. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task NetworkProfileGet_Validate(string subscriptionId, string resourceGroupName, string machineName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(machineName),machineName); + await eventListener.AssertMinimumLength(nameof(machineName),machineName,1); + await eventListener.AssertMaximumLength(nameof(machineName),machineName,54); + await eventListener.AssertRegEx(nameof(machineName),machineName,@"[a-zA-Z0-9-_\.]"); + } + } + + /// List all the supported operations. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task OperationsList(global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.AzureStackHCI/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.OperationsList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Gets a list of hybrid compute operations. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task OperationsList1(global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.HybridCompute/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.OperationsList1_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Gets a list of hybrid compute operations. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task OperationsList1ViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.HybridCompute/operations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.HybridCompute/operations'"); + } + + // replace URI parameters with values from identity + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.HybridCompute/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.OperationsList1_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task OperationsList1_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.OperationListResultAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task OperationsList1_Validate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + + } + } + + /// List all the supported operations. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task OperationsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.AzureStackHCI/operations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.AzureStackHCI/operations'"); + } + + // replace URI parameters with values from identity + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.AzureStackHCI/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.OperationsList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task OperationsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.OperationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task OperationsList_Validate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + + } + } + + /// + /// The operation to create or update a storage container. Please note some properties can be set only during storage container + /// creation. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the storage container + /// The storage container resource definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task StorageContainersCreateOrUpdate(string subscriptionId, string resourceGroupName, string storageContainerName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/storageContainers/" + + global::System.Uri.EscapeDataString(storageContainerName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.StorageContainersCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// The operation to create or update a storage container. Please note some properties can be set only during storage container + /// creation. + /// + /// + /// The storage container resource definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task StorageContainersCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/storageContainers/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var storageContainerName = _match.Groups["storageContainerName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/storageContainers/" + + storageContainerName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.StorageContainersCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task StorageContainersCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainers.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the storage container + /// The storage container resource definition. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task StorageContainersCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string storageContainerName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers body, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(storageContainerName),storageContainerName); + await eventListener.AssertMinimumLength(nameof(storageContainerName),storageContainerName,1); + await eventListener.AssertMaximumLength(nameof(storageContainerName),storageContainerName,80); + await eventListener.AssertRegEx(nameof(storageContainerName),storageContainerName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to delete a storage container. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the storage container + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task StorageContainersDelete(string subscriptionId, string resourceGroupName, string storageContainerName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/storageContainers/" + + global::System.Uri.EscapeDataString(storageContainerName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.StorageContainersDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// The operation to delete a storage container. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task StorageContainersDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/storageContainers/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var storageContainerName = _match.Groups["storageContainerName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/storageContainers/" + + storageContainerName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.StorageContainersDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task StorageContainersDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var _finalUri = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the storage container + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task StorageContainersDelete_Validate(string subscriptionId, string resourceGroupName, string storageContainerName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(storageContainerName),storageContainerName); + await eventListener.AssertMinimumLength(nameof(storageContainerName),storageContainerName,1); + await eventListener.AssertMaximumLength(nameof(storageContainerName),storageContainerName,80); + await eventListener.AssertRegEx(nameof(storageContainerName),storageContainerName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$"); + } + } + + /// Gets a storage container + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the storage container + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task StorageContainersGet(string subscriptionId, string resourceGroupName, string storageContainerName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/storageContainers/" + + global::System.Uri.EscapeDataString(storageContainerName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.StorageContainersGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Gets a storage container + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task StorageContainersGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/storageContainers/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var storageContainerName = _match.Groups["storageContainerName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/storageContainers/" + + storageContainerName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.StorageContainersGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task StorageContainersGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainers.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the storage container + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task StorageContainersGet_Validate(string subscriptionId, string resourceGroupName, string storageContainerName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(storageContainerName),storageContainerName); + await eventListener.AssertMinimumLength(nameof(storageContainerName),storageContainerName,1); + await eventListener.AssertMaximumLength(nameof(storageContainerName),storageContainerName,80); + await eventListener.AssertRegEx(nameof(storageContainerName),storageContainerName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$"); + } + } + + /// + /// Lists all of the storage containers in the specified resource group. Use the nextLink property in the response to get + /// the next page of storage containers. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task StorageContainersList(string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/storageContainers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.StorageContainersList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all of the storage containers in the specified subscription. Use the nextLink property in the response to get the + /// next page of storage containers. + /// + /// The ID of the target subscription. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task StorageContainersListAll(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.AzureStackHCI/storageContainers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.StorageContainersListAll_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all of the storage containers in the specified subscription. Use the nextLink property in the response to get the + /// next page of storage containers. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task StorageContainersListAllViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.AzureStackHCI/storageContainers$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/storageContainers'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.AzureStackHCI/storageContainers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.StorageContainersListAll_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task StorageContainersListAll_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainersListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The ID of the target subscription. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task StorageContainersListAll_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + } + } + + /// + /// Lists all of the storage containers in the specified resource group. Use the nextLink property in the response to get + /// the next page of storage containers. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task StorageContainersListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/storageContainers$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/storageContainers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.StorageContainersList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task StorageContainersList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainersListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task StorageContainersList_Validate(string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + } + } + + /// The operation to update a storage container. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the storage container + /// The storage container resource patch definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task StorageContainersUpdate(string subscriptionId, string resourceGroupName, string storageContainerName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/storageContainers/" + + global::System.Uri.EscapeDataString(storageContainerName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.StorageContainersUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// The operation to update a storage container. + /// + /// The storage container resource patch definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task StorageContainersUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/storageContainers/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var storageContainerName = _match.Groups["storageContainerName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/storageContainers/" + + storageContainerName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.StorageContainersUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task StorageContainersUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainers.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the storage container + /// The storage container resource patch definition. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task StorageContainersUpdate_Validate(string subscriptionId, string resourceGroupName, string storageContainerName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequest body, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(storageContainerName),storageContainerName); + await eventListener.AssertMinimumLength(nameof(storageContainerName),storageContainerName,1); + await eventListener.AssertMaximumLength(nameof(storageContainerName),storageContainerName,80); + await eventListener.AssertRegEx(nameof(storageContainerName),storageContainerName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,78}[_a-zA-Z0-9]$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to Upgrade Machine Extensions. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the hybrid machine. + /// Parameters supplied to the Upgrade Extensions operation. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task UpgradeExtensions(string subscriptionId, string resourceGroupName, string machineName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.HybridCompute/machines/" + + global::System.Uri.EscapeDataString(machineName) + + "/upgradeExtensions" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.UpgradeExtensions_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// The operation to Upgrade Machine Extensions. + /// + /// Parameters supplied to the Upgrade Extensions operation. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task UpgradeExtensionsViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-03-15-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.HybridCompute/machines/(?[^/]+)/upgradeExtensions$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/upgradeExtensions'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var machineName = _match.Groups["machineName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.HybridCompute/machines/" + + machineName + + "/upgradeExtensions" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.UpgradeExtensions_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task UpgradeExtensions_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the hybrid machine. + /// Parameters supplied to the Upgrade Extensions operation. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task UpgradeExtensions_Validate(string subscriptionId, string resourceGroupName, string machineName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade body, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(machineName),machineName); + await eventListener.AssertMinimumLength(nameof(machineName),machineName,1); + await eventListener.AssertMaximumLength(nameof(machineName),machineName,54); + await eventListener.AssertRegEx(nameof(machineName),machineName,@"[a-zA-Z0-9-_\.]"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// The operation to create or update a virtual hard disk. Please note some properties can be set only during virtual hard + /// disk creation. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the virtual hard disk + /// The virtual hard disk resource definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualHardDisksCreateOrUpdate(string subscriptionId, string resourceGroupName, string virtualHardDiskName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/virtualHardDisks/" + + global::System.Uri.EscapeDataString(virtualHardDiskName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualHardDisksCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// The operation to create or update a virtual hard disk. Please note some properties can be set only during virtual hard + /// disk creation. + /// + /// + /// The virtual hard disk resource definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualHardDisksCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/virtualHardDisks/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var virtualHardDiskName = _match.Groups["virtualHardDiskName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/virtualHardDisks/" + + virtualHardDiskName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualHardDisksCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualHardDisksCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisks.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the virtual hard disk + /// The virtual hard disk resource definition. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualHardDisksCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string virtualHardDiskName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks body, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(virtualHardDiskName),virtualHardDiskName); + await eventListener.AssertMinimumLength(nameof(virtualHardDiskName),virtualHardDiskName,1); + await eventListener.AssertMaximumLength(nameof(virtualHardDiskName),virtualHardDiskName,80); + await eventListener.AssertRegEx(nameof(virtualHardDiskName),virtualHardDiskName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,62}[a-zA-Z0-9]$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to delete a virtual hard disk. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the virtual hard disk + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualHardDisksDelete(string subscriptionId, string resourceGroupName, string virtualHardDiskName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/virtualHardDisks/" + + global::System.Uri.EscapeDataString(virtualHardDiskName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualHardDisksDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// The operation to delete a virtual hard disk. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualHardDisksDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/virtualHardDisks/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var virtualHardDiskName = _match.Groups["virtualHardDiskName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/virtualHardDisks/" + + virtualHardDiskName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualHardDisksDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualHardDisksDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var _finalUri = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the virtual hard disk + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualHardDisksDelete_Validate(string subscriptionId, string resourceGroupName, string virtualHardDiskName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(virtualHardDiskName),virtualHardDiskName); + await eventListener.AssertMinimumLength(nameof(virtualHardDiskName),virtualHardDiskName,1); + await eventListener.AssertMaximumLength(nameof(virtualHardDiskName),virtualHardDiskName,80); + await eventListener.AssertRegEx(nameof(virtualHardDiskName),virtualHardDiskName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,62}[a-zA-Z0-9]$"); + } + } + + /// Gets a virtual hard disk + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the virtual hard disk + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualHardDisksGet(string subscriptionId, string resourceGroupName, string virtualHardDiskName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/virtualHardDisks/" + + global::System.Uri.EscapeDataString(virtualHardDiskName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualHardDisksGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Gets a virtual hard disk + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualHardDisksGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/virtualHardDisks/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var virtualHardDiskName = _match.Groups["virtualHardDiskName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/virtualHardDisks/" + + virtualHardDiskName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualHardDisksGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualHardDisksGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisks.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the virtual hard disk + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualHardDisksGet_Validate(string subscriptionId, string resourceGroupName, string virtualHardDiskName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(virtualHardDiskName),virtualHardDiskName); + await eventListener.AssertMinimumLength(nameof(virtualHardDiskName),virtualHardDiskName,1); + await eventListener.AssertMaximumLength(nameof(virtualHardDiskName),virtualHardDiskName,80); + await eventListener.AssertRegEx(nameof(virtualHardDiskName),virtualHardDiskName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,62}[a-zA-Z0-9]$"); + } + } + + /// + /// Lists all of the virtual hard disks in the specified resource group. Use the nextLink property in the response to get + /// the next page of virtual hard disks. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualHardDisksList(string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/virtualHardDisks" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualHardDisksList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all of the virtual hard disks in the specified subscription. Use the nextLink property in the response to get the + /// next page of virtual hard disks. + /// + /// The ID of the target subscription. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualHardDisksListAll(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.AzureStackHCI/virtualHardDisks" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualHardDisksListAll_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all of the virtual hard disks in the specified subscription. Use the nextLink property in the response to get the + /// next page of virtual hard disks. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualHardDisksListAllViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.AzureStackHCI/virtualHardDisks$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualHardDisks'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.AzureStackHCI/virtualHardDisks" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualHardDisksListAll_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualHardDisksListAll_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisksListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The ID of the target subscription. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualHardDisksListAll_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + } + } + + /// + /// Lists all of the virtual hard disks in the specified resource group. Use the nextLink property in the response to get + /// the next page of virtual hard disks. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualHardDisksListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/virtualHardDisks$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/virtualHardDisks" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualHardDisksList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualHardDisksList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisksListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualHardDisksList_Validate(string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + } + } + + /// The operation to update a virtual hard disk. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the virtual hard disk + /// The virtual hard disk resource patch definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualHardDisksUpdate(string subscriptionId, string resourceGroupName, string virtualHardDiskName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.AzureStackHCI/virtualHardDisks/" + + global::System.Uri.EscapeDataString(virtualHardDiskName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualHardDisksUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// The operation to update a virtual hard disk. + /// + /// The virtual hard disk resource patch definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualHardDisksUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.AzureStackHCI/virtualHardDisks/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var virtualHardDiskName = _match.Groups["virtualHardDiskName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.AzureStackHCI/virtualHardDisks/" + + virtualHardDiskName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualHardDisksUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualHardDisksUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisks.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the virtual hard disk + /// The virtual hard disk resource patch definition. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualHardDisksUpdate_Validate(string subscriptionId, string resourceGroupName, string virtualHardDiskName, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequest body, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertMinimumLength(nameof(subscriptionId),subscriptionId,1); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(virtualHardDiskName),virtualHardDiskName); + await eventListener.AssertMinimumLength(nameof(virtualHardDiskName),virtualHardDiskName,1); + await eventListener.AssertMaximumLength(nameof(virtualHardDiskName),virtualHardDiskName,80); + await eventListener.AssertRegEx(nameof(virtualHardDiskName),virtualHardDiskName,@"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-._a-zA-Z0-9]{0,62}[a-zA-Z0-9]$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// The operation to create or update a virtual machine instance. Please note some properties can be set only during virtual + /// machine instance creation. + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// The virtual machine instance resource definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineInstancesCreateOrUpdate(string resourceUri, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + (resourceUri) + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineInstancesCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// The operation to create or update a virtual machine instance. Please note some properties can be set only during virtual + /// machine instance creation. + /// + /// + /// The virtual machine instance resource definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineInstancesCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/(?[^/]+)/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default'"); + } + + // replace URI parameters with values from identity + var resourceUri = _match.Groups["resourceUri"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + resourceUri + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineInstancesCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineInstancesCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstance.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// The virtual machine instance resource definition. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineInstancesCreateOrUpdate_Validate(string resourceUri, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance body, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceUri),resourceUri); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to delete a virtual machine instance. + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineInstancesDelete(string resourceUri, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + (resourceUri) + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineInstancesDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// The operation to delete a virtual machine instance. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineInstancesDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/(?[^/]+)/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default'"); + } + + // replace URI parameters with values from identity + var resourceUri = _match.Groups["resourceUri"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + resourceUri + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineInstancesDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineInstancesDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var _finalUri = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineInstancesDelete_Validate(string resourceUri, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceUri),resourceUri); + } + } + + /// Gets a virtual machine instance + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineInstancesGet(string resourceUri, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + (resourceUri) + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineInstancesGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Gets a virtual machine instance + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineInstancesGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/(?[^/]+)/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default'"); + } + + // replace URI parameters with values from identity + var resourceUri = _match.Groups["resourceUri"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + resourceUri + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineInstancesGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineInstancesGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstance.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineInstancesGet_Validate(string resourceUri, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceUri),resourceUri); + } + } + + /// + /// Lists all of the virtual machine instances within the specified parent resource. + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineInstancesList(string resourceUri, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + (resourceUri) + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineInstancesList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Lists all of the virtual machine instances within the specified parent resource. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineInstancesListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/(?[^/]+)/providers/Microsoft.AzureStackHCI/virtualMachineInstances$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances'"); + } + + // replace URI parameters with values from identity + var resourceUri = _match.Groups["resourceUri"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + resourceUri + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineInstancesList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineInstancesList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineInstancesList_Validate(string resourceUri, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceUri),resourceUri); + } + } + + /// The operation to restart a virtual machine instance. + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineInstancesRestart(string resourceUri, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + (resourceUri) + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/restart" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineInstancesRestart_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// The operation to restart a virtual machine instance. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineInstancesRestartViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/(?[^/]+)/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/restart$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/restart'"); + } + + // replace URI parameters with values from identity + var resourceUri = _match.Groups["resourceUri"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + resourceUri + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/restart" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineInstancesRestart_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineInstancesRestart_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: location + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstance.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineInstancesRestart_Validate(string resourceUri, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceUri),resourceUri); + } + } + + /// The operation to start a virtual machine instance. + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineInstancesStart(string resourceUri, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + (resourceUri) + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/start" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineInstancesStart_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// The operation to start a virtual machine instance. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineInstancesStartViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/(?[^/]+)/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/start$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/start'"); + } + + // replace URI parameters with values from identity + var resourceUri = _match.Groups["resourceUri"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + resourceUri + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/start" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineInstancesStart_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineInstancesStart_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: location + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstance.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineInstancesStart_Validate(string resourceUri, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceUri),resourceUri); + } + } + + /// The operation to stop a virtual machine instance. + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineInstancesStop(string resourceUri, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + (resourceUri) + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/stop" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineInstancesStop_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// The operation to stop a virtual machine instance. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineInstancesStopViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/(?[^/]+)/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/stop$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/stop'"); + } + + // replace URI parameters with values from identity + var resourceUri = _match.Groups["resourceUri"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + resourceUri + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/stop" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineInstancesStop_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineInstancesStop_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: location + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstance.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineInstancesStop_Validate(string resourceUri, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceUri),resourceUri); + } + } + + /// The operation to update a virtual machine instance. + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// The virtual machine instance resource patch definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineInstancesUpdate(string resourceUri, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + (resourceUri) + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineInstancesUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// The operation to update a virtual machine instance. + /// + /// The virtual machine instance resource patch definition. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineInstancesUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-09-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/(?[^/]+)/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default'"); + } + + // replace URI parameters with values from identity + var resourceUri = _match.Groups["resourceUri"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/" + + resourceUri + + "/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineInstancesUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineInstancesUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstance.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource + /// to be extended. + /// The virtual machine instance resource patch definition. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineInstancesUpdate_Validate(string resourceUri, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequest body, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceUri),resourceUri); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ActionType.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ActionType.Completer.cs new file mode 100644 index 000000000000..80b6fdb20ba1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ActionType.Completer.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + /// + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ActionTypeTypeConverter))] + public partial struct ActionType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Internal".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Internal'", "Internal", global::System.Management.Automation.CompletionResultType.ParameterValue, "Internal"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ActionType.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ActionType.TypeConverter.cs new file mode 100644 index 000000000000..7c6ee3ddf95a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ActionType.TypeConverter.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + /// + public partial class ActionTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ActionType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ActionType.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ActionType.cs new file mode 100644 index 000000000000..b544da1cf868 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ActionType.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + /// + public partial struct ActionType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ActionType Internal = @"Internal"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private ActionType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Conversion from arbitrary object to ActionType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new ActionType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type ActionType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ActionType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type ActionType (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is ActionType && Equals((ActionType)obj); + } + + /// Returns hashCode for enum ActionType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for ActionType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to ActionType + /// the value to convert to an instance of . + + public static implicit operator ActionType(string value) + { + return new ActionType(value); + } + + /// Implicit operator to convert ActionType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ActionType e) + { + return e._value; + } + + /// Overriding != operator for enum ActionType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ActionType e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ActionType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum ActionType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ActionType e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ActionType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/AgentConfigurationMode.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/AgentConfigurationMode.Completer.cs new file mode 100644 index 000000000000..c2bcd55519f1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/AgentConfigurationMode.Completer.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// Name of configuration mode to use. Modes are pre-defined configurations of security controls, extension allowlists and + /// guest configuration, maintained by Microsoft. + /// + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationModeTypeConverter))] + public partial struct AgentConfigurationMode : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "full".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'full'", "full", global::System.Management.Automation.CompletionResultType.ParameterValue, "full"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "monitor".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'monitor'", "monitor", global::System.Management.Automation.CompletionResultType.ParameterValue, "monitor"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/AgentConfigurationMode.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/AgentConfigurationMode.TypeConverter.cs new file mode 100644 index 000000000000..6e58986fb2a9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/AgentConfigurationMode.TypeConverter.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// Name of configuration mode to use. Modes are pre-defined configurations of security controls, extension allowlists and + /// guest configuration, maintained by Microsoft. + /// + public partial class AgentConfigurationModeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => AgentConfigurationMode.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/AgentConfigurationMode.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/AgentConfigurationMode.cs new file mode 100644 index 000000000000..afe5f882271a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/AgentConfigurationMode.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// Name of configuration mode to use. Modes are pre-defined configurations of security controls, extension allowlists and + /// guest configuration, maintained by Microsoft. + /// + public partial struct AgentConfigurationMode : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode Full = @"full"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode Monitor = @"monitor"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private AgentConfigurationMode(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Conversion from arbitrary object to AgentConfigurationMode + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new AgentConfigurationMode(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type AgentConfigurationMode + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type AgentConfigurationMode (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is AgentConfigurationMode && Equals((AgentConfigurationMode)obj); + } + + /// Returns hashCode for enum AgentConfigurationMode + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for AgentConfigurationMode + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to AgentConfigurationMode + /// the value to convert to an instance of . + + public static implicit operator AgentConfigurationMode(string value) + { + return new AgentConfigurationMode(value); + } + + /// Implicit operator to convert AgentConfigurationMode to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode e) + { + return e._value; + } + + /// Overriding != operator for enum AgentConfigurationMode + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum AgentConfigurationMode + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AgentConfigurationMode e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/AssessmentModeTypes.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/AssessmentModeTypes.Completer.cs new file mode 100644 index 000000000000..f986fc0168f7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/AssessmentModeTypes.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Specifies the assessment mode. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypesTypeConverter))] + public partial struct AssessmentModeTypes : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ImageDefault".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ImageDefault'", "ImageDefault", global::System.Management.Automation.CompletionResultType.ParameterValue, "ImageDefault"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "AutomaticByPlatform".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'AutomaticByPlatform'", "AutomaticByPlatform", global::System.Management.Automation.CompletionResultType.ParameterValue, "AutomaticByPlatform"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/AssessmentModeTypes.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/AssessmentModeTypes.TypeConverter.cs new file mode 100644 index 000000000000..1a610ae63485 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/AssessmentModeTypes.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Specifies the assessment mode. + public partial class AssessmentModeTypesTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => AssessmentModeTypes.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/AssessmentModeTypes.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/AssessmentModeTypes.cs new file mode 100644 index 000000000000..ba01d3a5b12c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/AssessmentModeTypes.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Specifies the assessment mode. + public partial struct AssessmentModeTypes : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes AutomaticByPlatform = @"AutomaticByPlatform"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes ImageDefault = @"ImageDefault"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private AssessmentModeTypes(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Conversion from arbitrary object to AssessmentModeTypes + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new AssessmentModeTypes(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type AssessmentModeTypes + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type AssessmentModeTypes (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is AssessmentModeTypes && Equals((AssessmentModeTypes)obj); + } + + /// Returns hashCode for enum AssessmentModeTypes + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for AssessmentModeTypes + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to AssessmentModeTypes + /// the value to convert to an instance of . + + public static implicit operator AssessmentModeTypes(string value) + { + return new AssessmentModeTypes(value); + } + + /// Implicit operator to convert AssessmentModeTypes to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes e) + { + return e._value; + } + + /// Overriding != operator for enum AssessmentModeTypes + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum AssessmentModeTypes + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/CloudInitDataSource.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/CloudInitDataSource.Completer.cs new file mode 100644 index 000000000000..4d5a53f60de0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/CloudInitDataSource.Completer.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + /// + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSourceTypeConverter))] + public partial struct CloudInitDataSource : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NoCloud".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'NoCloud'", "NoCloud", global::System.Management.Automation.CompletionResultType.ParameterValue, "NoCloud"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Azure".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Azure'", "Azure", global::System.Management.Automation.CompletionResultType.ParameterValue, "Azure"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/CloudInitDataSource.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/CloudInitDataSource.TypeConverter.cs new file mode 100644 index 000000000000..c29091978d9c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/CloudInitDataSource.TypeConverter.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + /// + public partial class CloudInitDataSourceTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => CloudInitDataSource.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/CloudInitDataSource.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/CloudInitDataSource.cs new file mode 100644 index 000000000000..148711541d64 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/CloudInitDataSource.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + /// + public partial struct CloudInitDataSource : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource Azure = @"Azure"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource NoCloud = @"NoCloud"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private CloudInitDataSource(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Conversion from arbitrary object to CloudInitDataSource + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new CloudInitDataSource(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type CloudInitDataSource + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type CloudInitDataSource (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is CloudInitDataSource && Equals((CloudInitDataSource)obj); + } + + /// Returns hashCode for enum CloudInitDataSource + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for CloudInitDataSource + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to CloudInitDataSource + /// the value to convert to an instance of . + + public static implicit operator CloudInitDataSource(string value) + { + return new CloudInitDataSource(value); + } + + /// Implicit operator to convert CloudInitDataSource to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource e) + { + return e._value; + } + + /// Overriding != operator for enum CloudInitDataSource + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum CloudInitDataSource + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/CreatedByType.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/CreatedByType.Completer.cs new file mode 100644 index 000000000000..30f19695d45b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/CreatedByType.Completer.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The type of identity that created the resource. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByTypeTypeConverter))] + public partial struct CreatedByType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "User".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'User'", "User", global::System.Management.Automation.CompletionResultType.ParameterValue, "User"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Application".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Application'", "Application", global::System.Management.Automation.CompletionResultType.ParameterValue, "Application"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ManagedIdentity".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ManagedIdentity'", "ManagedIdentity", global::System.Management.Automation.CompletionResultType.ParameterValue, "ManagedIdentity"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Key".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Key'", "Key", global::System.Management.Automation.CompletionResultType.ParameterValue, "Key"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/CreatedByType.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/CreatedByType.TypeConverter.cs new file mode 100644 index 000000000000..8744608cf8e2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/CreatedByType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The type of identity that created the resource. + public partial class CreatedByTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => CreatedByType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/CreatedByType.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/CreatedByType.cs new file mode 100644 index 000000000000..3e0c8287b0c4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/CreatedByType.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The type of identity that created the resource. + public partial struct CreatedByType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType Application = @"Application"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType Key = @"Key"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType ManagedIdentity = @"ManagedIdentity"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType User = @"User"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to CreatedByType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new CreatedByType(global::System.Convert.ToString(value)); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private CreatedByType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Compares values of enum type CreatedByType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type CreatedByType (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is CreatedByType && Equals((CreatedByType)obj); + } + + /// Returns hashCode for enum CreatedByType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for CreatedByType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to CreatedByType + /// the value to convert to an instance of . + + public static implicit operator CreatedByType(string value) + { + return new CreatedByType(value); + } + + /// Implicit operator to convert CreatedByType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType e) + { + return e._value; + } + + /// Overriding != operator for enum CreatedByType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum CreatedByType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CreatedByType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/DiskFileFormat.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/DiskFileFormat.Completer.cs new file mode 100644 index 000000000000..ef486080b413 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/DiskFileFormat.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The format of the actual VHD file [vhd, vhdx] + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormatTypeConverter))] + public partial struct DiskFileFormat : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "vhdx".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'vhdx'", "vhdx", global::System.Management.Automation.CompletionResultType.ParameterValue, "vhdx"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "vhd".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'vhd'", "vhd", global::System.Management.Automation.CompletionResultType.ParameterValue, "vhd"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/DiskFileFormat.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/DiskFileFormat.TypeConverter.cs new file mode 100644 index 000000000000..f75085771735 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/DiskFileFormat.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The format of the actual VHD file [vhd, vhdx] + public partial class DiskFileFormatTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => DiskFileFormat.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/DiskFileFormat.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/DiskFileFormat.cs new file mode 100644 index 000000000000..8e16b9801b28 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/DiskFileFormat.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The format of the actual VHD file [vhd, vhdx] + public partial struct DiskFileFormat : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat Vhd = @"vhd"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat Vhdx = @"vhdx"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to DiskFileFormat + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new DiskFileFormat(global::System.Convert.ToString(value)); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private DiskFileFormat(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Compares values of enum type DiskFileFormat + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type DiskFileFormat (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is DiskFileFormat && Equals((DiskFileFormat)obj); + } + + /// Returns hashCode for enum DiskFileFormat + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for DiskFileFormat + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to DiskFileFormat + /// the value to convert to an instance of . + + public static implicit operator DiskFileFormat(string value) + { + return new DiskFileFormat(value); + } + + /// Implicit operator to convert DiskFileFormat to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat e) + { + return e._value; + } + + /// Overriding != operator for enum DiskFileFormat + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum DiskFileFormat + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ExtendedLocationTypes.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ExtendedLocationTypes.Completer.cs new file mode 100644 index 000000000000..5e25a2f9a7ac --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ExtendedLocationTypes.Completer.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The type of extendedLocation. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypesTypeConverter))] + public partial struct ExtendedLocationTypes : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "CustomLocation".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'CustomLocation'", "CustomLocation", global::System.Management.Automation.CompletionResultType.ParameterValue, "CustomLocation"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ExtendedLocationTypes.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ExtendedLocationTypes.TypeConverter.cs new file mode 100644 index 000000000000..a52ba0eacfa2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ExtendedLocationTypes.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The type of extendedLocation. + public partial class ExtendedLocationTypesTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ExtendedLocationTypes.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ExtendedLocationTypes.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ExtendedLocationTypes.cs new file mode 100644 index 000000000000..884b6fa08e14 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ExtendedLocationTypes.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The type of extendedLocation. + public partial struct ExtendedLocationTypes : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes CustomLocation = @"CustomLocation"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to ExtendedLocationTypes + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new ExtendedLocationTypes(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type ExtendedLocationTypes + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type ExtendedLocationTypes (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is ExtendedLocationTypes && Equals((ExtendedLocationTypes)obj); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private ExtendedLocationTypes(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns hashCode for enum ExtendedLocationTypes + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for ExtendedLocationTypes + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to ExtendedLocationTypes + /// the value to convert to an instance of . + + public static implicit operator ExtendedLocationTypes(string value) + { + return new ExtendedLocationTypes(value); + } + + /// Implicit operator to convert ExtendedLocationTypes to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes e) + { + return e._value; + } + + /// Overriding != operator for enum ExtendedLocationTypes + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum ExtendedLocationTypes + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/HyperVGeneration.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/HyperVGeneration.Completer.cs new file mode 100644 index 000000000000..4ffaa055fb09 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/HyperVGeneration.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The hypervisor generation of the Virtual Machine [V1, V2] + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGenerationTypeConverter))] + public partial struct HyperVGeneration : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "V1".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'V1'", "V1", global::System.Management.Automation.CompletionResultType.ParameterValue, "V1"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "V2".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'V2'", "V2", global::System.Management.Automation.CompletionResultType.ParameterValue, "V2"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/HyperVGeneration.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/HyperVGeneration.TypeConverter.cs new file mode 100644 index 000000000000..ce38b25ed806 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/HyperVGeneration.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The hypervisor generation of the Virtual Machine [V1, V2] + public partial class HyperVGenerationTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => HyperVGeneration.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/HyperVGeneration.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/HyperVGeneration.cs new file mode 100644 index 000000000000..00cc47675a52 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/HyperVGeneration.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The hypervisor generation of the Virtual Machine [V1, V2] + public partial struct HyperVGeneration : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration V1 = @"V1"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration V2 = @"V2"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to HyperVGeneration + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new HyperVGeneration(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type HyperVGeneration + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type HyperVGeneration (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is HyperVGeneration && Equals((HyperVGeneration)obj); + } + + /// Returns hashCode for enum HyperVGeneration + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private HyperVGeneration(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for HyperVGeneration + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to HyperVGeneration + /// the value to convert to an instance of . + + public static implicit operator HyperVGeneration(string value) + { + return new HyperVGeneration(value); + } + + /// Implicit operator to convert HyperVGeneration to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration e) + { + return e._value; + } + + /// Overriding != operator for enum HyperVGeneration + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum HyperVGeneration + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/IPAllocationMethodEnum.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/IPAllocationMethodEnum.Completer.cs new file mode 100644 index 000000000000..82e6c9d44f20 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/IPAllocationMethodEnum.Completer.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic' + /// + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnumTypeConverter))] + public partial struct IPAllocationMethodEnum : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Dynamic".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Dynamic'", "Dynamic", global::System.Management.Automation.CompletionResultType.ParameterValue, "Dynamic"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Static".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Static'", "Static", global::System.Management.Automation.CompletionResultType.ParameterValue, "Static"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/IPAllocationMethodEnum.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/IPAllocationMethodEnum.TypeConverter.cs new file mode 100644 index 000000000000..cfd259a35cdc --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/IPAllocationMethodEnum.TypeConverter.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic' + /// + public partial class IPAllocationMethodEnumTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => IPAllocationMethodEnum.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/IPAllocationMethodEnum.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/IPAllocationMethodEnum.cs new file mode 100644 index 000000000000..5fbcd79ab126 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/IPAllocationMethodEnum.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic' + /// + public partial struct IPAllocationMethodEnum : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum Dynamic = @"Dynamic"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum Static = @"Static"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to IPAllocationMethodEnum + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new IPAllocationMethodEnum(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type IPAllocationMethodEnum + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type IPAllocationMethodEnum (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is IPAllocationMethodEnum && Equals((IPAllocationMethodEnum)obj); + } + + /// Returns hashCode for enum IPAllocationMethodEnum + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private IPAllocationMethodEnum(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for IPAllocationMethodEnum + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to IPAllocationMethodEnum + /// the value to convert to an instance of . + + public static implicit operator IPAllocationMethodEnum(string value) + { + return new IPAllocationMethodEnum(value); + } + + /// Implicit operator to convert IPAllocationMethodEnum to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum e) + { + return e._value; + } + + /// Overriding != operator for enum IPAllocationMethodEnum + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum IPAllocationMethodEnum + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPAllocationMethodEnum e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/IPPoolTypeEnum.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/IPPoolTypeEnum.Completer.cs new file mode 100644 index 000000000000..6678dbe9a3a4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/IPPoolTypeEnum.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Type of the IP Pool [vm, vippool] + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPPoolTypeEnumTypeConverter))] + public partial struct IPPoolTypeEnum : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "vm".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'vm'", "vm", global::System.Management.Automation.CompletionResultType.ParameterValue, "vm"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "vippool".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'vippool'", "vippool", global::System.Management.Automation.CompletionResultType.ParameterValue, "vippool"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/IPPoolTypeEnum.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/IPPoolTypeEnum.TypeConverter.cs new file mode 100644 index 000000000000..8f161101d7e0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/IPPoolTypeEnum.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Type of the IP Pool [vm, vippool] + public partial class IPPoolTypeEnumTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => IPPoolTypeEnum.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/IPPoolTypeEnum.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/IPPoolTypeEnum.cs new file mode 100644 index 000000000000..807173941ca0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/IPPoolTypeEnum.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Type of the IP Pool [vm, vippool] + public partial struct IPPoolTypeEnum : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPPoolTypeEnum VM = @"vm"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPPoolTypeEnum Vippool = @"vippool"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to IPPoolTypeEnum + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new IPPoolTypeEnum(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type IPPoolTypeEnum + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPPoolTypeEnum e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type IPPoolTypeEnum (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is IPPoolTypeEnum && Equals((IPPoolTypeEnum)obj); + } + + /// Returns hashCode for enum IPPoolTypeEnum + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private IPPoolTypeEnum(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for IPPoolTypeEnum + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to IPPoolTypeEnum + /// the value to convert to an instance of . + + public static implicit operator IPPoolTypeEnum(string value) + { + return new IPPoolTypeEnum(value); + } + + /// Implicit operator to convert IPPoolTypeEnum to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPPoolTypeEnum e) + { + return e._value; + } + + /// Overriding != operator for enum IPPoolTypeEnum + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPPoolTypeEnum e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPPoolTypeEnum e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum IPPoolTypeEnum + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPPoolTypeEnum e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.IPPoolTypeEnum e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/InstanceViewTypes.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/InstanceViewTypes.Completer.cs new file mode 100644 index 000000000000..71a41d39ab20 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/InstanceViewTypes.Completer.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Argument completer implementation for InstanceViewTypes. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.InstanceViewTypesTypeConverter))] + public partial struct InstanceViewTypes : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "instanceView".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'instanceView'", "instanceView", global::System.Management.Automation.CompletionResultType.ParameterValue, "instanceView"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/InstanceViewTypes.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/InstanceViewTypes.TypeConverter.cs new file mode 100644 index 000000000000..1c1ca854b90e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/InstanceViewTypes.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// TypeConverter implementation for InstanceViewTypes. + public partial class InstanceViewTypesTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => InstanceViewTypes.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/InstanceViewTypes.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/InstanceViewTypes.cs new file mode 100644 index 000000000000..e48e832b8234 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/InstanceViewTypes.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + public partial struct InstanceViewTypes : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.InstanceViewTypes InstanceView = @"instanceView"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to InstanceViewTypes + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new InstanceViewTypes(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type InstanceViewTypes + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.InstanceViewTypes e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type InstanceViewTypes (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is InstanceViewTypes && Equals((InstanceViewTypes)obj); + } + + /// Returns hashCode for enum InstanceViewTypes + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private InstanceViewTypes(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for InstanceViewTypes + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to InstanceViewTypes + /// the value to convert to an instance of . + + public static implicit operator InstanceViewTypes(string value) + { + return new InstanceViewTypes(value); + } + + /// Implicit operator to convert InstanceViewTypes to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.InstanceViewTypes e) + { + return e._value; + } + + /// Overriding != operator for enum InstanceViewTypes + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.InstanceViewTypes e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.InstanceViewTypes e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum InstanceViewTypes + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.InstanceViewTypes e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.InstanceViewTypes e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/LastAttemptStatusEnum.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/LastAttemptStatusEnum.Completer.cs new file mode 100644 index 000000000000..8e96e99597a5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/LastAttemptStatusEnum.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Specifies the status of Agent Upgrade. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnumTypeConverter))] + public partial struct LastAttemptStatusEnum : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Success".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Success'", "Success", global::System.Management.Automation.CompletionResultType.ParameterValue, "Success"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Failed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Failed'", "Failed", global::System.Management.Automation.CompletionResultType.ParameterValue, "Failed"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/LastAttemptStatusEnum.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/LastAttemptStatusEnum.TypeConverter.cs new file mode 100644 index 000000000000..337603f05700 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/LastAttemptStatusEnum.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Specifies the status of Agent Upgrade. + public partial class LastAttemptStatusEnumTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => LastAttemptStatusEnum.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/LastAttemptStatusEnum.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/LastAttemptStatusEnum.cs new file mode 100644 index 000000000000..671aae53be02 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/LastAttemptStatusEnum.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Specifies the status of Agent Upgrade. + public partial struct LastAttemptStatusEnum : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum Failed = @"Failed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum Success = @"Success"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to LastAttemptStatusEnum + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new LastAttemptStatusEnum(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type LastAttemptStatusEnum + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type LastAttemptStatusEnum (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is LastAttemptStatusEnum && Equals((LastAttemptStatusEnum)obj); + } + + /// Returns hashCode for enum LastAttemptStatusEnum + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private LastAttemptStatusEnum(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for LastAttemptStatusEnum + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to LastAttemptStatusEnum + /// the value to convert to an instance of . + + public static implicit operator LastAttemptStatusEnum(string value) + { + return new LastAttemptStatusEnum(value); + } + + /// Implicit operator to convert LastAttemptStatusEnum to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum e) + { + return e._value; + } + + /// Overriding != operator for enum LastAttemptStatusEnum + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum LastAttemptStatusEnum + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.LastAttemptStatusEnum e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/OperatingSystemTypes.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/OperatingSystemTypes.Completer.cs new file mode 100644 index 000000000000..8f850d9f769e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/OperatingSystemTypes.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Operating system type that the gallery image uses [Windows, Linux] + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypesTypeConverter))] + public partial struct OperatingSystemTypes : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Windows".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Windows'", "Windows", global::System.Management.Automation.CompletionResultType.ParameterValue, "Windows"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Linux".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Linux'", "Linux", global::System.Management.Automation.CompletionResultType.ParameterValue, "Linux"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/OperatingSystemTypes.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/OperatingSystemTypes.TypeConverter.cs new file mode 100644 index 000000000000..c7a3684f4757 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/OperatingSystemTypes.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Operating system type that the gallery image uses [Windows, Linux] + public partial class OperatingSystemTypesTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => OperatingSystemTypes.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/OperatingSystemTypes.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/OperatingSystemTypes.cs new file mode 100644 index 000000000000..1d0f8732a2af --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/OperatingSystemTypes.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Operating system type that the gallery image uses [Windows, Linux] + public partial struct OperatingSystemTypes : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes Linux = @"Linux"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes Windows = @"Windows"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to OperatingSystemTypes + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new OperatingSystemTypes(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type OperatingSystemTypes + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type OperatingSystemTypes (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is OperatingSystemTypes && Equals((OperatingSystemTypes)obj); + } + + /// Returns hashCode for enum OperatingSystemTypes + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private OperatingSystemTypes(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for OperatingSystemTypes + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to OperatingSystemTypes + /// the value to convert to an instance of . + + public static implicit operator OperatingSystemTypes(string value) + { + return new OperatingSystemTypes(value); + } + + /// Implicit operator to convert OperatingSystemTypes to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes e) + { + return e._value; + } + + /// Overriding != operator for enum OperatingSystemTypes + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum OperatingSystemTypes + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/Origin.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/Origin.Completer.cs new file mode 100644 index 000000000000..632300eafadd --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/Origin.Completer.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is + /// "user,system" + /// + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OriginTypeConverter))] + public partial struct Origin : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "user".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'user'", "user", global::System.Management.Automation.CompletionResultType.ParameterValue, "user"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "system".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'system'", "system", global::System.Management.Automation.CompletionResultType.ParameterValue, "system"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "user,system".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'user,system'", "user,system", global::System.Management.Automation.CompletionResultType.ParameterValue, "user,system"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/Origin.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/Origin.TypeConverter.cs new file mode 100644 index 000000000000..6f72d278ce2a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/Origin.TypeConverter.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is + /// "user,system" + /// + public partial class OriginTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => Origin.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/Origin.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/Origin.cs new file mode 100644 index 000000000000..5304b701b28f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/Origin.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is + /// "user,system" + /// + public partial struct Origin : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Origin System = @"system"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Origin User = @"user"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Origin UserSystem = @"user,system"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to Origin + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new Origin(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type Origin + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Origin e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type Origin (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is Origin && Equals((Origin)obj); + } + + /// Returns hashCode for enum Origin + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private Origin(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for Origin + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to Origin + /// the value to convert to an instance of . + + public static implicit operator Origin(string value) + { + return new Origin(value); + } + + /// Implicit operator to convert Origin to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Origin e) + { + return e._value; + } + + /// Overriding != operator for enum Origin + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Origin e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Origin e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum Origin + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Origin e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Origin e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PatchModeTypes.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PatchModeTypes.Completer.cs new file mode 100644 index 000000000000..7a89a361b2ec --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PatchModeTypes.Completer.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Specifies the patch mode. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypesTypeConverter))] + public partial struct PatchModeTypes : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ImageDefault".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ImageDefault'", "ImageDefault", global::System.Management.Automation.CompletionResultType.ParameterValue, "ImageDefault"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "AutomaticByPlatform".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'AutomaticByPlatform'", "AutomaticByPlatform", global::System.Management.Automation.CompletionResultType.ParameterValue, "AutomaticByPlatform"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "AutomaticByOS".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'AutomaticByOS'", "AutomaticByOS", global::System.Management.Automation.CompletionResultType.ParameterValue, "AutomaticByOS"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Manual".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Manual'", "Manual", global::System.Management.Automation.CompletionResultType.ParameterValue, "Manual"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PatchModeTypes.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PatchModeTypes.TypeConverter.cs new file mode 100644 index 000000000000..1fdec4e96f64 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PatchModeTypes.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Specifies the patch mode. + public partial class PatchModeTypesTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => PatchModeTypes.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PatchModeTypes.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PatchModeTypes.cs new file mode 100644 index 000000000000..37a024ee06da --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PatchModeTypes.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Specifies the patch mode. + public partial struct PatchModeTypes : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes AutomaticByOS = @"AutomaticByOS"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes AutomaticByPlatform = @"AutomaticByPlatform"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes ImageDefault = @"ImageDefault"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes Manual = @"Manual"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to PatchModeTypes + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new PatchModeTypes(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type PatchModeTypes + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type PatchModeTypes (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is PatchModeTypes && Equals((PatchModeTypes)obj); + } + + /// Returns hashCode for enum PatchModeTypes + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private PatchModeTypes(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for PatchModeTypes + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to PatchModeTypes + /// the value to convert to an instance of . + + public static implicit operator PatchModeTypes(string value) + { + return new PatchModeTypes(value); + } + + /// Implicit operator to convert PatchModeTypes to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes e) + { + return e._value; + } + + /// Overriding != operator for enum PatchModeTypes + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum PatchModeTypes + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PowerStateEnum.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PowerStateEnum.Completer.cs new file mode 100644 index 000000000000..eddf1c17100f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PowerStateEnum.Completer.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The power state of the virtual machine instance + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnumTypeConverter))] + public partial struct PowerStateEnum : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Deallocated".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Deallocated'", "Deallocated", global::System.Management.Automation.CompletionResultType.ParameterValue, "Deallocated"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Deallocating".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Deallocating'", "Deallocating", global::System.Management.Automation.CompletionResultType.ParameterValue, "Deallocating"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Running".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Running'", "Running", global::System.Management.Automation.CompletionResultType.ParameterValue, "Running"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Starting".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Starting'", "Starting", global::System.Management.Automation.CompletionResultType.ParameterValue, "Starting"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Stopped".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Stopped'", "Stopped", global::System.Management.Automation.CompletionResultType.ParameterValue, "Stopped"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Stopping".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Stopping'", "Stopping", global::System.Management.Automation.CompletionResultType.ParameterValue, "Stopping"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Unknown".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Unknown'", "Unknown", global::System.Management.Automation.CompletionResultType.ParameterValue, "Unknown"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PowerStateEnum.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PowerStateEnum.TypeConverter.cs new file mode 100644 index 000000000000..e8437d924471 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PowerStateEnum.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The power state of the virtual machine instance + public partial class PowerStateEnumTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => PowerStateEnum.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PowerStateEnum.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PowerStateEnum.cs new file mode 100644 index 000000000000..83f1e83b9b73 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PowerStateEnum.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The power state of the virtual machine instance + public partial struct PowerStateEnum : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum Deallocated = @"Deallocated"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum Deallocating = @"Deallocating"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum Running = @"Running"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum Starting = @"Starting"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum Stopped = @"Stopped"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum Stopping = @"Stopping"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum Unknown = @"Unknown"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to PowerStateEnum + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new PowerStateEnum(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type PowerStateEnum + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type PowerStateEnum (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is PowerStateEnum && Equals((PowerStateEnum)obj); + } + + /// Returns hashCode for enum PowerStateEnum + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private PowerStateEnum(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for PowerStateEnum + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to PowerStateEnum + /// the value to convert to an instance of . + + public static implicit operator PowerStateEnum(string value) + { + return new PowerStateEnum(value); + } + + /// Implicit operator to convert PowerStateEnum to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum e) + { + return e._value; + } + + /// Overriding != operator for enum PowerStateEnum + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum PowerStateEnum + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PowerStateEnum e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PrivateCloudKind.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PrivateCloudKind.Completer.cs new file mode 100644 index 000000000000..54392e6074cf --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PrivateCloudKind.Completer.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc. + /// + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKindTypeConverter))] + public partial struct PrivateCloudKind : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "AVS".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'AVS'", "AVS", global::System.Management.Automation.CompletionResultType.ParameterValue, "AVS"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "HCI".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'HCI'", "HCI", global::System.Management.Automation.CompletionResultType.ParameterValue, "HCI"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "SCVMM".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'SCVMM'", "SCVMM", global::System.Management.Automation.CompletionResultType.ParameterValue, "SCVMM"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "VMware".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'VMware'", "VMware", global::System.Management.Automation.CompletionResultType.ParameterValue, "VMware"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PrivateCloudKind.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PrivateCloudKind.TypeConverter.cs new file mode 100644 index 000000000000..f7539e9ee0d6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PrivateCloudKind.TypeConverter.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc. + /// + public partial class PrivateCloudKindTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => PrivateCloudKind.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PrivateCloudKind.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PrivateCloudKind.cs new file mode 100644 index 000000000000..2055413ba68c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/PrivateCloudKind.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc. + /// + public partial struct PrivateCloudKind : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind Avs = @"AVS"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind Hci = @"HCI"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind Scvmm = @"SCVMM"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind VMware = @"VMware"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to PrivateCloudKind + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new PrivateCloudKind(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type PrivateCloudKind + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type PrivateCloudKind (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is PrivateCloudKind && Equals((PrivateCloudKind)obj); + } + + /// Returns hashCode for enum PrivateCloudKind + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private PrivateCloudKind(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for PrivateCloudKind + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to PrivateCloudKind + /// the value to convert to an instance of . + + public static implicit operator PrivateCloudKind(string value) + { + return new PrivateCloudKind(value); + } + + /// Implicit operator to convert PrivateCloudKind to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind e) + { + return e._value; + } + + /// Overriding != operator for enum PrivateCloudKind + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum PrivateCloudKind + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ProvisioningAction.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ProvisioningAction.Completer.cs new file mode 100644 index 000000000000..f4e690c386b3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ProvisioningAction.Completer.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Defines the different types of operations for guest agent. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningActionTypeConverter))] + public partial struct ProvisioningAction : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "install".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'install'", "install", global::System.Management.Automation.CompletionResultType.ParameterValue, "install"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "uninstall".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'uninstall'", "uninstall", global::System.Management.Automation.CompletionResultType.ParameterValue, "uninstall"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "repair".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'repair'", "repair", global::System.Management.Automation.CompletionResultType.ParameterValue, "repair"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ProvisioningAction.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ProvisioningAction.TypeConverter.cs new file mode 100644 index 000000000000..fa8471f62096 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ProvisioningAction.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Defines the different types of operations for guest agent. + public partial class ProvisioningActionTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ProvisioningAction.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ProvisioningAction.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ProvisioningAction.cs new file mode 100644 index 000000000000..ba0abc7c9437 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ProvisioningAction.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Defines the different types of operations for guest agent. + public partial struct ProvisioningAction : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction Install = @"install"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction Repair = @"repair"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction Uninstall = @"uninstall"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to ProvisioningAction + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new ProvisioningAction(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type ProvisioningAction + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type ProvisioningAction (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is ProvisioningAction && Equals((ProvisioningAction)obj); + } + + /// Returns hashCode for enum ProvisioningAction + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private ProvisioningAction(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for ProvisioningAction + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to ProvisioningAction + /// the value to convert to an instance of . + + public static implicit operator ProvisioningAction(string value) + { + return new ProvisioningAction(value); + } + + /// Implicit operator to convert ProvisioningAction to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction e) + { + return e._value; + } + + /// Overriding != operator for enum ProvisioningAction + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum ProvisioningAction + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ProvisioningStateEnum.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ProvisioningStateEnum.Completer.cs new file mode 100644 index 000000000000..42a8abd088b2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ProvisioningStateEnum.Completer.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Provisioning state of the gallery image. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnumTypeConverter))] + public partial struct ProvisioningStateEnum : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Succeeded".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Succeeded'", "Succeeded", global::System.Management.Automation.CompletionResultType.ParameterValue, "Succeeded"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Failed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Failed'", "Failed", global::System.Management.Automation.CompletionResultType.ParameterValue, "Failed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "InProgress".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'InProgress'", "InProgress", global::System.Management.Automation.CompletionResultType.ParameterValue, "InProgress"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Accepted".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Accepted'", "Accepted", global::System.Management.Automation.CompletionResultType.ParameterValue, "Accepted"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Deleting".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Deleting'", "Deleting", global::System.Management.Automation.CompletionResultType.ParameterValue, "Deleting"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Canceled".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Canceled'", "Canceled", global::System.Management.Automation.CompletionResultType.ParameterValue, "Canceled"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ProvisioningStateEnum.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ProvisioningStateEnum.TypeConverter.cs new file mode 100644 index 000000000000..60fa0a500caf --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ProvisioningStateEnum.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Provisioning state of the gallery image. + public partial class ProvisioningStateEnumTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ProvisioningStateEnum.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ProvisioningStateEnum.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ProvisioningStateEnum.cs new file mode 100644 index 000000000000..43bf7487dc23 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ProvisioningStateEnum.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Provisioning state of the gallery image. + public partial struct ProvisioningStateEnum : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum Accepted = @"Accepted"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum Canceled = @"Canceled"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum Deleting = @"Deleting"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum Failed = @"Failed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum InProgress = @"InProgress"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum Succeeded = @"Succeeded"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to ProvisioningStateEnum + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new ProvisioningStateEnum(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type ProvisioningStateEnum + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type ProvisioningStateEnum (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is ProvisioningStateEnum && Equals((ProvisioningStateEnum)obj); + } + + /// Returns hashCode for enum ProvisioningStateEnum + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private ProvisioningStateEnum(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for ProvisioningStateEnum + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to ProvisioningStateEnum + /// the value to convert to an instance of . + + public static implicit operator ProvisioningStateEnum(string value) + { + return new ProvisioningStateEnum(value); + } + + /// Implicit operator to convert ProvisioningStateEnum to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum e) + { + return e._value; + } + + /// Overriding != operator for enum ProvisioningStateEnum + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum ProvisioningStateEnum + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningStateEnum e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ResourceIdentityType.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ResourceIdentityType.Completer.cs new file mode 100644 index 000000000000..39a991715399 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ResourceIdentityType.Completer.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The identity type. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityTypeTypeConverter))] + public partial struct ResourceIdentityType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "SystemAssigned".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'SystemAssigned'", "SystemAssigned", global::System.Management.Automation.CompletionResultType.ParameterValue, "SystemAssigned"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ResourceIdentityType.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ResourceIdentityType.TypeConverter.cs new file mode 100644 index 000000000000..ee77626487bf --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ResourceIdentityType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The identity type. + public partial class ResourceIdentityTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ResourceIdentityType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ResourceIdentityType.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ResourceIdentityType.cs new file mode 100644 index 000000000000..e599263b3adb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/ResourceIdentityType.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The identity type. + public partial struct ResourceIdentityType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType SystemAssigned = @"SystemAssigned"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to ResourceIdentityType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new ResourceIdentityType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type ResourceIdentityType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type ResourceIdentityType (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is ResourceIdentityType && Equals((ResourceIdentityType)obj); + } + + /// Returns hashCode for enum ResourceIdentityType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private ResourceIdentityType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for ResourceIdentityType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to ResourceIdentityType + /// the value to convert to an instance of . + + public static implicit operator ResourceIdentityType(string value) + { + return new ResourceIdentityType(value); + } + + /// Implicit operator to convert ResourceIdentityType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType e) + { + return e._value; + } + + /// Overriding != operator for enum ResourceIdentityType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum ResourceIdentityType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/SecurityTypes.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/SecurityTypes.Completer.cs new file mode 100644 index 000000000000..5209ac4c6843 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/SecurityTypes.Completer.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for SecurityType + /// to function. + /// + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypesTypeConverter))] + public partial struct SecurityTypes : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "TrustedLaunch".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'TrustedLaunch'", "TrustedLaunch", global::System.Management.Automation.CompletionResultType.ParameterValue, "TrustedLaunch"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ConfidentialVM".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ConfidentialVM'", "ConfidentialVM", global::System.Management.Automation.CompletionResultType.ParameterValue, "ConfidentialVM"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/SecurityTypes.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/SecurityTypes.TypeConverter.cs new file mode 100644 index 000000000000..4f3a26833138 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/SecurityTypes.TypeConverter.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for SecurityType + /// to function. + /// + public partial class SecurityTypesTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => SecurityTypes.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/SecurityTypes.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/SecurityTypes.cs new file mode 100644 index 000000000000..fdd87bdc2e70 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/SecurityTypes.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for SecurityType + /// to function. + /// + public partial struct SecurityTypes : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes ConfidentialVM = @"ConfidentialVM"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes TrustedLaunch = @"TrustedLaunch"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to SecurityTypes + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new SecurityTypes(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type SecurityTypes + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type SecurityTypes (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is SecurityTypes && Equals((SecurityTypes)obj); + } + + /// Returns hashCode for enum SecurityTypes + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private SecurityTypes(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for SecurityTypes + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to SecurityTypes + /// the value to convert to an instance of . + + public static implicit operator SecurityTypes(string value) + { + return new SecurityTypes(value); + } + + /// Implicit operator to convert SecurityTypes to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes e) + { + return e._value; + } + + /// Overriding != operator for enum SecurityTypes + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum SecurityTypes + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/Status.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/Status.Completer.cs new file mode 100644 index 000000000000..25f44f4fdfde --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/Status.Completer.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypeConverter))] + public partial struct Status : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Succeeded".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Succeeded'", "Succeeded", global::System.Management.Automation.CompletionResultType.ParameterValue, "Succeeded"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Failed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Failed'", "Failed", global::System.Management.Automation.CompletionResultType.ParameterValue, "Failed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "InProgress".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'InProgress'", "InProgress", global::System.Management.Automation.CompletionResultType.ParameterValue, "InProgress"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/Status.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/Status.TypeConverter.cs new file mode 100644 index 000000000000..a03b39af6e30 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/Status.TypeConverter.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + public partial class StatusTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => Status.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/Status.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/Status.cs new file mode 100644 index 000000000000..d3c2c1e7b63c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/Status.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// + /// The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + /// + public partial struct Status : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status Failed = @"Failed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status InProgress = @"InProgress"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status Succeeded = @"Succeeded"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to Status + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new Status(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type Status + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type Status (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is Status && Equals((Status)obj); + } + + /// Returns hashCode for enum Status + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private Status(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for Status + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to Status + /// the value to convert to an instance of . + + public static implicit operator Status(string value) + { + return new Status(value); + } + + /// Implicit operator to convert Status to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status e) + { + return e._value; + } + + /// Overriding != operator for enum Status + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum Status + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.Status e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/StatusLevelTypes.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/StatusLevelTypes.Completer.cs new file mode 100644 index 000000000000..9157d8c5ada5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/StatusLevelTypes.Completer.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The level code. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypesTypeConverter))] + public partial struct StatusLevelTypes : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Info".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Info'", "Info", global::System.Management.Automation.CompletionResultType.ParameterValue, "Info"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Warning".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Warning'", "Warning", global::System.Management.Automation.CompletionResultType.ParameterValue, "Warning"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Error".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Error'", "Error", global::System.Management.Automation.CompletionResultType.ParameterValue, "Error"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/StatusLevelTypes.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/StatusLevelTypes.TypeConverter.cs new file mode 100644 index 000000000000..e1169264106c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/StatusLevelTypes.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The level code. + public partial class StatusLevelTypesTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => StatusLevelTypes.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/StatusLevelTypes.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/StatusLevelTypes.cs new file mode 100644 index 000000000000..9ce4c9486cc3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/StatusLevelTypes.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The level code. + public partial struct StatusLevelTypes : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes Error = @"Error"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes Info = @"Info"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes Warning = @"Warning"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to StatusLevelTypes + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new StatusLevelTypes(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type StatusLevelTypes + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type StatusLevelTypes (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is StatusLevelTypes && Equals((StatusLevelTypes)obj); + } + + /// Returns hashCode for enum StatusLevelTypes + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private StatusLevelTypes(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for StatusLevelTypes + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to StatusLevelTypes + /// the value to convert to an instance of . + + public static implicit operator StatusLevelTypes(string value) + { + return new StatusLevelTypes(value); + } + + /// Implicit operator to convert StatusLevelTypes to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes e) + { + return e._value; + } + + /// Overriding != operator for enum StatusLevelTypes + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum StatusLevelTypes + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/StatusTypes.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/StatusTypes.Completer.cs new file mode 100644 index 000000000000..79fddbbb5fd9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/StatusTypes.Completer.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The status of the hybrid machine agent. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypesTypeConverter))] + public partial struct StatusTypes : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Connected".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Connected'", "Connected", global::System.Management.Automation.CompletionResultType.ParameterValue, "Connected"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Disconnected".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Disconnected'", "Disconnected", global::System.Management.Automation.CompletionResultType.ParameterValue, "Disconnected"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Error".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Error'", "Error", global::System.Management.Automation.CompletionResultType.ParameterValue, "Error"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Succeeded".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Succeeded'", "Succeeded", global::System.Management.Automation.CompletionResultType.ParameterValue, "Succeeded"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "InProgress".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'InProgress'", "InProgress", global::System.Management.Automation.CompletionResultType.ParameterValue, "InProgress"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Failed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Failed'", "Failed", global::System.Management.Automation.CompletionResultType.ParameterValue, "Failed"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/StatusTypes.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/StatusTypes.TypeConverter.cs new file mode 100644 index 000000000000..8fe3e72b48ad --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/StatusTypes.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The status of the hybrid machine agent. + public partial class StatusTypesTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => StatusTypes.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/StatusTypes.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/StatusTypes.cs new file mode 100644 index 000000000000..1976ae0ac65d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/StatusTypes.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// The status of the hybrid machine agent. + public partial struct StatusTypes : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes Connected = @"Connected"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes Disconnected = @"Disconnected"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes Error = @"Error"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes Failed = @"Failed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes InProgress = @"InProgress"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes Succeeded = @"Succeeded"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to StatusTypes + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new StatusTypes(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type StatusTypes + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type StatusTypes (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is StatusTypes && Equals((StatusTypes)obj); + } + + /// Returns hashCode for enum StatusTypes + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private StatusTypes(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for StatusTypes + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to StatusTypes + /// the value to convert to an instance of . + + public static implicit operator StatusTypes(string value) + { + return new StatusTypes(value); + } + + /// Implicit operator to convert StatusTypes to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes e) + { + return e._value; + } + + /// Overriding != operator for enum StatusTypes + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum StatusTypes + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusTypes e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/VMSizeEnum.Completer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/VMSizeEnum.Completer.cs new file mode 100644 index 000000000000..fd0e602ee9e4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/VMSizeEnum.Completer.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// Argument completer implementation for VMSizeEnum. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnumTypeConverter))] + public partial struct VMSizeEnum : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Default".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Default'", "Default", global::System.Management.Automation.CompletionResultType.ParameterValue, "Default"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_A2_v2".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Standard_A2_v2'", "Standard_A2_v2", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_A2_v2"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_A4_v2".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Standard_A4_v2'", "Standard_A4_v2", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_A4_v2"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_D2s_v3".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Standard_D2s_v3'", "Standard_D2s_v3", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_D2s_v3"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_D4s_v3".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Standard_D4s_v3'", "Standard_D4s_v3", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_D4s_v3"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_D8s_v3".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Standard_D8s_v3'", "Standard_D8s_v3", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_D8s_v3"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_D16s_v3".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Standard_D16s_v3'", "Standard_D16s_v3", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_D16s_v3"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_D32s_v3".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Standard_D32s_v3'", "Standard_D32s_v3", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_D32s_v3"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_DS2_v2".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Standard_DS2_v2'", "Standard_DS2_v2", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_DS2_v2"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_DS3_v2".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Standard_DS3_v2'", "Standard_DS3_v2", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_DS3_v2"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_DS4_v2".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Standard_DS4_v2'", "Standard_DS4_v2", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_DS4_v2"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_DS5_v2".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Standard_DS5_v2'", "Standard_DS5_v2", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_DS5_v2"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_DS13_v2".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Standard_DS13_v2'", "Standard_DS13_v2", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_DS13_v2"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_K8S_v1".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Standard_K8S_v1'", "Standard_K8S_v1", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_K8S_v1"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_K8S2_v1".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Standard_K8S2_v1'", "Standard_K8S2_v1", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_K8S2_v1"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_K8S3_v1".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Standard_K8S3_v1'", "Standard_K8S3_v1", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_K8S3_v1"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_K8S4_v1".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Standard_K8S4_v1'", "Standard_K8S4_v1", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_K8S4_v1"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_NK6".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Standard_NK6'", "Standard_NK6", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_NK6"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_NK12".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Standard_NK12'", "Standard_NK12", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_NK12"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_NV6".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Standard_NV6'", "Standard_NV6", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_NV6"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_NV12".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Standard_NV12'", "Standard_NV12", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_NV12"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_K8S5_v1".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Standard_K8S5_v1'", "Standard_K8S5_v1", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_K8S5_v1"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Custom".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Custom'", "Custom", global::System.Management.Automation.CompletionResultType.ParameterValue, "Custom"); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/VMSizeEnum.TypeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/VMSizeEnum.TypeConverter.cs new file mode 100644 index 000000000000..14955f023bb4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/VMSizeEnum.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + /// TypeConverter implementation for VMSizeEnum. + public partial class VMSizeEnumTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => VMSizeEnum.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/VMSizeEnum.cs b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/VMSizeEnum.cs new file mode 100644 index 000000000000..08368dc62ba7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/api/Support/VMSizeEnum.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support +{ + + public partial struct VMSizeEnum : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum Custom = @"Custom"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum Default = @"Default"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum StandardA2V2 = @"Standard_A2_v2"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum StandardA4V2 = @"Standard_A4_v2"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum StandardD16SV3 = @"Standard_D16s_v3"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum StandardD2SV3 = @"Standard_D2s_v3"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum StandardD32SV3 = @"Standard_D32s_v3"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum StandardD4SV3 = @"Standard_D4s_v3"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum StandardD8SV3 = @"Standard_D8s_v3"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum StandardDs13V2 = @"Standard_DS13_v2"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum StandardDs2V2 = @"Standard_DS2_v2"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum StandardDs3V2 = @"Standard_DS3_v2"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum StandardDs4V2 = @"Standard_DS4_v2"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum StandardDs5V2 = @"Standard_DS5_v2"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum StandardK8S2V1 = @"Standard_K8S2_v1"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum StandardK8S3V1 = @"Standard_K8S3_v1"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum StandardK8S4V1 = @"Standard_K8S4_v1"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum StandardK8S5V1 = @"Standard_K8S5_v1"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum StandardK8SV1 = @"Standard_K8S_v1"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum StandardNk12 = @"Standard_NK12"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum StandardNk6 = @"Standard_NK6"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum StandardNv12 = @"Standard_NV12"; + + public static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum StandardNv6 = @"Standard_NV6"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to VMSizeEnum + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new VMSizeEnum(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type VMSizeEnum + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type VMSizeEnum (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is VMSizeEnum && Equals((VMSizeEnum)obj); + } + + /// Returns hashCode for enum VMSizeEnum + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for VMSizeEnum + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private VMSizeEnum(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Implicit operator to convert string to VMSizeEnum + /// the value to convert to an instance of . + + public static implicit operator VMSizeEnum(string value) + { + return new VMSizeEnum(value); + } + + /// Implicit operator to convert VMSizeEnum to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum e) + { + return e._value; + } + + /// Overriding != operator for enum VMSizeEnum + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum VMSizeEnum + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum e1, Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmAgentVersion_Get.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmAgentVersion_Get.cs new file mode 100644 index 000000000000..28718b63b2d0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmAgentVersion_Get.cs @@ -0,0 +1,387 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// Gets an Agent Version along with the download link currently present. + /// + /// [OpenAPI] Get=>GET:"/providers/Microsoft.HybridCompute/osType/{osType}/agentVersions/{version}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmAgentVersion_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Gets an Agent Version along with the download link currently present.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/providers/Microsoft.HybridCompute/osType/{osType}/agentVersions/{version}", ApiVersion = "2023-03-15-preview")] + public partial class GetAzStackHCIVmAgentVersion_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _oSType; + + /// Defines the os type + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Defines the os type")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Defines the os type", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string OSType { get => this._oSType; set => this._oSType = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _version; + + /// + /// Defines the agent version. To get latest, use latest or else a specific agent version. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Defines the agent version. To get latest, use latest or else a specific agent version.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Defines the agent version. To get latest, use latest or else a specific agent version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Version { get => this._version; set => this._version = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGenerated + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmAgentVersion_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AgentVersionGet(OSType, Version, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { OSType=OSType,Version=Version}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGenerated + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { OSType=OSType, Version=Version }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { OSType=OSType, Version=Version }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmAgentVersion_List.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmAgentVersion_List.cs new file mode 100644 index 000000000000..63df009ca593 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmAgentVersion_List.cs @@ -0,0 +1,393 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// Gets all Agent Versions along with the download link currently present. + /// + /// [OpenAPI] List=>GET:"/providers/Microsoft.HybridCompute/osType/{osType}/agentVersions" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmAgentVersion_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsList))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Gets all Agent Versions along with the download link currently present.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/providers/Microsoft.HybridCompute/osType/{osType}/agentVersions", ApiVersion = "2023-03-15-preview")] + public partial class GetAzStackHCIVmAgentVersion_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _oSType; + + /// Defines the os type. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Defines the os type.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Defines the os type.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string OSType { get => this._oSType; set => this._oSType = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGenerated + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsList + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmAgentVersion_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AgentVersionList(OSType, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { OSType=OSType}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20.IErrorResponseAutoGenerated + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { OSType=OSType }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { OSType=OSType }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsList + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // nested-array / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.AgentVersionList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmExtensionMetadata_Get.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmExtensionMetadata_Get.cs new file mode 100644 index 000000000000..2579323fbacf --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmExtensionMetadata_Get.cs @@ -0,0 +1,436 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// Gets an Extension Metadata based on location, publisher, extensionType and version + /// + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions/{version}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmExtensionMetadata_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Gets an Extension Metadata based on location, publisher, extensionType and version")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions/{version}", ApiVersion = "2023-03-15-preview")] + public partial class GetAzStackHCIVmExtensionMetadata_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _extensionType; + + /// The extensionType of the Extension being received. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The extensionType of the Extension being received.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The extensionType of the Extension being received.", + SerializedName = @"extensionType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ExtensionType { get => this._extensionType; set => this._extensionType = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _location; + + /// The location of the Extension being received. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The location of the Extension being received.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The location of the Extension being received.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _publisher; + + /// The publisher of the Extension being received. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The publisher of the Extension being received.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The publisher of the Extension being received.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Publisher { get => this._publisher; set => this._publisher = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _version; + + /// The version of the Extension being received. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The version of the Extension being received.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The version of the Extension being received.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Version { get => this._version; set => this._version = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmExtensionMetadata_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ExtensionMetadataGet(SubscriptionId, Location, Publisher, ExtensionType, Version, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,Location=Location,Publisher=Publisher,ExtensionType=ExtensionType,Version=Version}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, Location=Location, Publisher=Publisher, ExtensionType=ExtensionType, Version=Version }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, Location=Location, Publisher=Publisher, ExtensionType=ExtensionType, Version=Version }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmExtensionMetadata_List.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmExtensionMetadata_List.cs new file mode 100644 index 000000000000..6aa48dce1676 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmExtensionMetadata_List.cs @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// Gets all Extension versions based on location, publisher, extensionType + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmExtensionMetadata_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Gets all Extension versions based on location, publisher, extensionType")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions", ApiVersion = "2023-03-15-preview")] + public partial class GetAzStackHCIVmExtensionMetadata_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _extensionType; + + /// The extensionType of the Extension being received. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The extensionType of the Extension being received.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The extensionType of the Extension being received.", + SerializedName = @"extensionType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ExtensionType { get => this._extensionType; set => this._extensionType = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _location; + + /// The location of the Extension being received. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The location of the Extension being received.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The location of the Extension being received.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _publisher; + + /// The publisher of the Extension being received. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The publisher of the Extension being received.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The publisher of the Extension being received.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Publisher { get => this._publisher; set => this._publisher = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmExtensionMetadata_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ExtensionMetadataList(SubscriptionId, Location, Publisher, ExtensionType, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,Location=Location,Publisher=Publisher,ExtensionType=ExtensionType}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, Location=Location, Publisher=Publisher, ExtensionType=ExtensionType }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, Location=Location, Publisher=Publisher, ExtensionType=ExtensionType }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValueListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / + WriteObject((await response).Value, true); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmGalleryImage_Get.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmGalleryImage_Get.cs new file mode 100644 index 000000000000..410f19a17e51 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmGalleryImage_Get.cs @@ -0,0 +1,407 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// Gets a gallery image + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmGalleryImage_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Gets a gallery image")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmGalleryImage_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the gallery image + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the gallery image")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the gallery image", + SerializedName = @"galleryImageName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("GalleryImageName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmGalleryImage_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GalleryImagesGet(SubscriptionId, ResourceGroupName, Name, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmGalleryImage_List.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmGalleryImage_List.cs new file mode 100644 index 000000000000..76808cbc43c0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmGalleryImage_List.cs @@ -0,0 +1,417 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// Lists all of the gallery images in the specified resource group. Use the nextLink property in the response to get the + /// next page of gallery images. + /// + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmGalleryImage_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Lists all of the gallery images in the specified resource group. Use the nextLink property in the response to get the next page of gallery images.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmGalleryImage_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmGalleryImage_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GalleryImagesList(SubscriptionId, ResourceGroupName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GalleryImagesList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmGalleryImage_List1.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmGalleryImage_List1.cs new file mode 100644 index 000000000000..a4315273e1c1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmGalleryImage_List1.cs @@ -0,0 +1,403 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// Lists all of the gallery images in the specified subscription. Use the nextLink property in the response to get the next + /// page of gallery images. + /// + /// + /// [OpenAPI] ListAll=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/galleryImages" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmGalleryImage_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Lists all of the gallery images in the specified subscription. Use the nextLink property in the response to get the next page of gallery images.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/galleryImages", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmGalleryImage_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmGalleryImage_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GalleryImagesListAll(SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GalleryImagesListAll_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmGuestAgent_Get.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmGuestAgent_Get.cs new file mode 100644 index 000000000000..dd61639c9e81 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmGuestAgent_Get.cs @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// Implements GuestAgent GET method. + /// + /// [OpenAPI] Get=>GET:"/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmGuestAgent_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Implements GuestAgent GET method.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmGuestAgent_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceUri; + + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.", + SerializedName = @"resourceUri", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceUri { get => this._resourceUri; set => this._resourceUri = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmGuestAgent_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GuestAgentGet(ResourceUri, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmGuestAgent_List.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmGuestAgent_List.cs new file mode 100644 index 000000000000..97ecdf20ba4c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmGuestAgent_List.cs @@ -0,0 +1,395 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// Returns the list of GuestAgent of the given vm. + /// + /// [OpenAPI] List=>GET:"/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmGuestAgent_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Returns the list of GuestAgent of the given vm.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmGuestAgent_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceUri; + + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.", + SerializedName = @"resourceUri", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceUri { get => this._resourceUri; set => this._resourceUri = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentList + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmGuestAgent_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GuestAgentsList(ResourceUri, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgentList + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GuestAgentsList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmHybridIdentityMetadata_Get.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmHybridIdentityMetadata_Get.cs new file mode 100644 index 000000000000..e54fa0d57060 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmHybridIdentityMetadata_Get.cs @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// Implements HybridIdentityMetadata GET method. + /// + /// [OpenAPI] Get=>GET:"/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata/default" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmHybridIdentityMetadata_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Implements HybridIdentityMetadata GET method.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata/default", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmHybridIdentityMetadata_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceUri; + + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.", + SerializedName = @"resourceUri", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceUri { get => this._resourceUri; set => this._resourceUri = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmHybridIdentityMetadata_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.HybridIdentityMetadataGet(ResourceUri, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmHybridIdentityMetadata_Get1.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmHybridIdentityMetadata_Get1.cs new file mode 100644 index 000000000000..6143d79ca074 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmHybridIdentityMetadata_Get1.cs @@ -0,0 +1,420 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// Implements HybridIdentityMetadata GET method. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/hybridIdentityMetadata/{metadataName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmHybridIdentityMetadata_Get1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Implements HybridIdentityMetadata GET method.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/hybridIdentityMetadata/{metadataName}", ApiVersion = "2023-03-15-preview")] + public partial class GetAzStackHCIVmHybridIdentityMetadata_Get1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _machineName; + + /// The name of the hybrid machine. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the hybrid machine.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the hybrid machine.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string MachineName { get => this._machineName; set => this._machineName = value; } + + /// Backing field for property. + private string _metadataName; + + /// Name of the HybridIdentityMetadata. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the HybridIdentityMetadata.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the HybridIdentityMetadata.", + SerializedName = @"metadataName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string MetadataName { get => this._metadataName; set => this._metadataName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmHybridIdentityMetadata_Get1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.HybridIdentityMetadataGet1(SubscriptionId, ResourceGroupName, MachineName, MetadataName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,MachineName=MachineName,MetadataName=MetadataName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, MachineName=MachineName, MetadataName=MetadataName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, MachineName=MachineName, MetadataName=MetadataName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmHybridIdentityMetadata_GetViaIdentity1.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmHybridIdentityMetadata_GetViaIdentity1.cs new file mode 100644 index 000000000000..ef18854c260f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmHybridIdentityMetadata_GetViaIdentity1.cs @@ -0,0 +1,389 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// Implements HybridIdentityMetadata GET method. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/hybridIdentityMetadata/{metadataName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmHybridIdentityMetadata_GetViaIdentity1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Implements HybridIdentityMetadata GET method.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/hybridIdentityMetadata/{metadataName}", ApiVersion = "2023-03-15-preview")] + public partial class GetAzStackHCIVmHybridIdentityMetadata_GetViaIdentity1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmHybridIdentityMetadata_GetViaIdentity1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.HybridIdentityMetadataGet1ViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MachineName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MachineName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MetadataName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MetadataName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.HybridIdentityMetadataGet1(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.MachineName ?? null, InputObject.MetadataName ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmHybridIdentityMetadata_List.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmHybridIdentityMetadata_List.cs new file mode 100644 index 000000000000..366dd2a26c16 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmHybridIdentityMetadata_List.cs @@ -0,0 +1,395 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// Returns the list of HybridIdentityMetadata of the given vm. + /// + /// [OpenAPI] List=>GET:"/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmHybridIdentityMetadata_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Returns the list of HybridIdentityMetadata of the given vm.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmHybridIdentityMetadata_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceUri; + + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.", + SerializedName = @"resourceUri", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceUri { get => this._resourceUri; set => this._resourceUri = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataList + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmHybridIdentityMetadata_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.HybridIdentityMetadataList(ResourceUri, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadataList + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.HybridIdentityMetadataList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmHybridIdentityMetadata_List1.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmHybridIdentityMetadata_List1.cs new file mode 100644 index 000000000000..9529d02c14e5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmHybridIdentityMetadata_List1.cs @@ -0,0 +1,428 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// Returns the list of HybridIdentityMetadata of the given machine. + /// + /// [OpenAPI] ListByMachines=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/hybridIdentityMetadata" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmHybridIdentityMetadata_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Returns the list of HybridIdentityMetadata of the given machine.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/hybridIdentityMetadata", ApiVersion = "2023-03-15-preview")] + public partial class GetAzStackHCIVmHybridIdentityMetadata_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _machineName; + + /// The name of the hybrid machine. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the hybrid machine.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the hybrid machine.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string MachineName { get => this._machineName; set => this._machineName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataListAutoGenerated + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmHybridIdentityMetadata_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.HybridIdentityMetadataListByMachines(SubscriptionId, ResourceGroupName, MachineName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,MachineName=MachineName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, MachineName=MachineName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, MachineName=MachineName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataListAutoGenerated + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.HybridIdentityMetadataListByMachines_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmLogicalNetwork_Get.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmLogicalNetwork_Get.cs new file mode 100644 index 000000000000..7eba48ea4943 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmLogicalNetwork_Get.cs @@ -0,0 +1,406 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// Gets a logical network + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmLogicalNetwork_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Gets a logical network")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmLogicalNetwork_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the logical network + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the logical network")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the logical network", + SerializedName = @"logicalNetworkName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("LogicalNetworkName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmLogicalNetwork_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.LogicalNetworksGet(SubscriptionId, ResourceGroupName, Name, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmLogicalNetwork_List.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmLogicalNetwork_List.cs new file mode 100644 index 000000000000..5d20bee687f9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmLogicalNetwork_List.cs @@ -0,0 +1,416 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// Lists all of the logical networks in the specified resource group. Use the nextLink property in the response to get the + /// next page of logical networks. + /// + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmLogicalNetwork_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Lists all of the logical networks in the specified resource group. Use the nextLink property in the response to get the next page of logical networks.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmLogicalNetwork_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmLogicalNetwork_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.LogicalNetworksList(SubscriptionId, ResourceGroupName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.LogicalNetworksList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmLogicalNetwork_List1.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmLogicalNetwork_List1.cs new file mode 100644 index 000000000000..2e15439da469 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmLogicalNetwork_List1.cs @@ -0,0 +1,402 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// Lists all of the logical networks in the specified subscription. Use the nextLink property in the response to get the + /// next page of logical networks. + /// + /// + /// [OpenAPI] ListAll=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/logicalNetworks" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmLogicalNetwork_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Lists all of the logical networks in the specified subscription. Use the nextLink property in the response to get the next page of logical networks.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/logicalNetworks", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmLogicalNetwork_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmLogicalNetwork_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.LogicalNetworksListAll(SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.LogicalNetworksListAll_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMachineExtension_Get.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMachineExtension_Get.cs new file mode 100644 index 000000000000..92e85918660e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMachineExtension_Get.cs @@ -0,0 +1,420 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to get the extension. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmMachineExtension_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to get the extension.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}", ApiVersion = "2023-03-15-preview")] + public partial class GetAzStackHCIVmMachineExtension_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _extensionName; + + /// The name of the machine extension. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the machine extension.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the machine extension.", + SerializedName = @"extensionName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ExtensionName { get => this._extensionName; set => this._extensionName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _machineName; + + /// The name of the machine containing the extension. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the machine containing the extension.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the machine containing the extension.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string MachineName { get => this._machineName; set => this._machineName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmMachineExtension_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MachineExtensionsGet(ResourceGroupName, MachineName, ExtensionName, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,MachineName=MachineName,ExtensionName=ExtensionName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, MachineName=MachineName, ExtensionName=ExtensionName, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, MachineName=MachineName, ExtensionName=ExtensionName, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMachineExtension_List.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMachineExtension_List.cs new file mode 100644 index 000000000000..176533b0a86c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMachineExtension_List.cs @@ -0,0 +1,442 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to get all extensions of a non-Azure machine + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmMachineExtension_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to get all extensions of a non-Azure machine")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions", ApiVersion = "2023-03-15-preview")] + public partial class GetAzStackHCIVmMachineExtension_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _expand; + + /// The expand expression to apply on the operation. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The expand expression to apply on the operation.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The expand expression to apply on the operation.", + SerializedName = @"$expand", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Query)] + public string Expand { get => this._expand; set => this._expand = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _machineName; + + /// The name of the machine containing the extension. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the machine containing the extension.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the machine containing the extension.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string MachineName { get => this._machineName; set => this._machineName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionsListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmMachineExtension_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MachineExtensionsList(ResourceGroupName, MachineName, this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,MachineName=MachineName,Expand=this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, MachineName=MachineName, Expand=this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, MachineName=MachineName, Expand=this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionsListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MachineExtensionsList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMachine_Get.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMachine_Get.cs new file mode 100644 index 000000000000..4f9acbc89483 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMachine_Get.cs @@ -0,0 +1,424 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// Retrieves information about the model view or the instance view of a hybrid machine. + /// + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmMachine_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Retrieves information about the model view or the instance view of a hybrid machine.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}", ApiVersion = "2023-03-15-preview")] + public partial class GetAzStackHCIVmMachine_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.InstanceViewTypes _expand; + + /// The expand expression to apply on the operation. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The expand expression to apply on the operation.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The expand expression to apply on the operation.", + SerializedName = @"$expand", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.InstanceViewTypes) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Query)] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.InstanceViewTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.InstanceViewTypes Expand { get => this._expand; set => this._expand = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the hybrid machine. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the hybrid machine.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the hybrid machine.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("MachineName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmMachine_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MachinesGet(SubscriptionId, ResourceGroupName, Name, this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,Expand=this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, Expand=this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, Expand=this.InvocationInformation.BoundParameters.ContainsKey("Expand") ? Expand : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMachine_List.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMachine_List.cs new file mode 100644 index 000000000000..f633b97a1b5c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMachine_List.cs @@ -0,0 +1,417 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// Lists all the hybrid machines in the specified resource group. Use the nextLink property in the response to get the next + /// page of hybrid machines. + /// + /// + /// [OpenAPI] ListByResourceGroup=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmMachine_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Lists all the hybrid machines in the specified resource group. Use the nextLink property in the response to get the next page of hybrid machines.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines", ApiVersion = "2023-03-15-preview")] + public partial class GetAzStackHCIVmMachine_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmMachine_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MachinesListByResourceGroup(SubscriptionId, ResourceGroupName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MachinesListByResourceGroup_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMachine_List1.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMachine_List1.cs new file mode 100644 index 000000000000..4ec6243b0864 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMachine_List1.cs @@ -0,0 +1,403 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// Lists all the hybrid machines in the specified subscription. Use the nextLink property in the response to get the next + /// page of hybrid machines. + /// + /// + /// [OpenAPI] ListBySubscription=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/machines" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmMachine_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Lists all the hybrid machines in the specified subscription. Use the nextLink property in the response to get the next page of hybrid machines.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/machines", ApiVersion = "2023-03-15-preview")] + public partial class GetAzStackHCIVmMachine_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmMachine_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MachinesListBySubscription(SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MachinesListBySubscription_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMarketplaceGalleryImage_Get.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMarketplaceGalleryImage_Get.cs new file mode 100644 index 000000000000..99fdb84ea2ec --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMarketplaceGalleryImage_Get.cs @@ -0,0 +1,407 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// Gets a marketplace gallery image + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmMarketplaceGalleryImage_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Gets a marketplace gallery image")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmMarketplaceGalleryImage_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the marketplace gallery image + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the marketplace gallery image")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the marketplace gallery image", + SerializedName = @"marketplaceGalleryImageName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("MarketplaceGalleryImageName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmMarketplaceGalleryImage_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MarketplaceGalleryImagesGet(SubscriptionId, ResourceGroupName, Name, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMarketplaceGalleryImage_List.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMarketplaceGalleryImage_List.cs new file mode 100644 index 000000000000..7fd6320f970f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMarketplaceGalleryImage_List.cs @@ -0,0 +1,417 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// Lists all of the marketplace gallery images in the specified resource group. Use the nextLink property in the response + /// to get the next page of marketplace gallery images. + /// + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmMarketplaceGalleryImage_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Lists all of the marketplace gallery images in the specified resource group. Use the nextLink property in the response to get the next page of marketplace gallery images.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmMarketplaceGalleryImage_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmMarketplaceGalleryImage_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MarketplaceGalleryImagesList(SubscriptionId, ResourceGroupName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MarketplaceGalleryImagesList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMarketplaceGalleryImage_List1.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMarketplaceGalleryImage_List1.cs new file mode 100644 index 000000000000..2153c5b4b696 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmMarketplaceGalleryImage_List1.cs @@ -0,0 +1,403 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// Lists all of the marketplace gallery images in the specified subscription. Use the nextLink property in the response to + /// get the next page of marketplace gallery images. + /// + /// + /// [OpenAPI] ListAll=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmMarketplaceGalleryImage_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Lists all of the marketplace gallery images in the specified subscription. Use the nextLink property in the response to get the next page of marketplace gallery images.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmMarketplaceGalleryImage_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmMarketplaceGalleryImage_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MarketplaceGalleryImagesListAll(SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MarketplaceGalleryImagesListAll_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmNetworkInterface_Get.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmNetworkInterface_Get.cs new file mode 100644 index 000000000000..37d45b02fd26 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmNetworkInterface_Get.cs @@ -0,0 +1,406 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// Gets a network interface + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmNetworkInterface_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Gets a network interface")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmNetworkInterface_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the network interface + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the network interface")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the network interface", + SerializedName = @"networkInterfaceName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("NetworkInterfaceName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmNetworkInterface_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.NetworkInterfacesGet(SubscriptionId, ResourceGroupName, Name, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmNetworkInterface_List.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmNetworkInterface_List.cs new file mode 100644 index 000000000000..652b65c57e1f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmNetworkInterface_List.cs @@ -0,0 +1,416 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// Lists all of the network interfaces in the specified resource group. Use the nextLink property in the response to get + /// the next page of network interfaces. + /// + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmNetworkInterface_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Lists all of the network interfaces in the specified resource group. Use the nextLink property in the response to get the next page of network interfaces.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmNetworkInterface_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmNetworkInterface_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.NetworkInterfacesList(SubscriptionId, ResourceGroupName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.NetworkInterfacesList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmNetworkInterface_List1.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmNetworkInterface_List1.cs new file mode 100644 index 000000000000..a5789d832ced --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmNetworkInterface_List1.cs @@ -0,0 +1,402 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// Lists all of the network interfaces in the specified subscription. Use the nextLink property in the response to get the + /// next page of network interfaces. + /// + /// + /// [OpenAPI] ListAll=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/networkInterfaces" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmNetworkInterface_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Lists all of the network interfaces in the specified subscription. Use the nextLink property in the response to get the next page of network interfaces.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/networkInterfaces", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmNetworkInterface_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmNetworkInterface_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.NetworkInterfacesListAll(SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.NetworkInterfacesListAll_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmNetworkProfile_Get.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmNetworkProfile_Get.cs new file mode 100644 index 000000000000..fae4ac5994fb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmNetworkProfile_Get.cs @@ -0,0 +1,407 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to get network information of hybrid machine + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/networkProfile" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmNetworkProfile_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to get network information of hybrid machine")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/networkProfile", ApiVersion = "2023-03-15-preview")] + public partial class GetAzStackHCIVmNetworkProfile_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _machineName; + + /// The name of the hybrid machine. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the hybrid machine.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the hybrid machine.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string MachineName { get => this._machineName; set => this._machineName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfile + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmNetworkProfile_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.NetworkProfileGet(SubscriptionId, ResourceGroupName, MachineName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,MachineName=MachineName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, MachineName=MachineName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, MachineName=MachineName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkProfile + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // nested-array / networkInterfaces / + WriteObject((await response).NetworkInterface, true); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmOperation_List.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmOperation_List.cs new file mode 100644 index 000000000000..02bfe6ccf949 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmOperation_List.cs @@ -0,0 +1,379 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// List all the supported operations. + /// + /// [OpenAPI] List=>GET:"/providers/Microsoft.AzureStackHCI/operations" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmOperation_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"List all the supported operations.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/providers/Microsoft.AzureStackHCI/operations", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmOperation_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmOperation_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.OperationsList(onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperationListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.OperationsList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmOperation_List1.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmOperation_List1.cs new file mode 100644 index 000000000000..300bd317de19 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmOperation_List1.cs @@ -0,0 +1,358 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// Gets a list of hybrid compute operations. + /// + /// [OpenAPI] List=>GET:"/providers/Microsoft.HybridCompute/operations" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmOperation_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Gets a list of hybrid compute operations.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/providers/Microsoft.HybridCompute/operations", ApiVersion = "2023-03-15-preview")] + public partial class GetAzStackHCIVmOperation_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationListResultAutoGenerated + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmOperation_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.OperationsList1(onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationListResultAutoGenerated + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / + WriteObject((await response).Value, true); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmStoragePath_Get.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmStoragePath_Get.cs new file mode 100644 index 000000000000..943bd05c9d03 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmStoragePath_Get.cs @@ -0,0 +1,406 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// Gets a storage container + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmStoragePath_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Gets a storage container")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmStoragePath_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the storage container + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the storage container")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the storage container", + SerializedName = @"storageContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("StorageContainerName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmStoragePath_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.StorageContainersGet(SubscriptionId, ResourceGroupName, Name, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmStoragePath_List.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmStoragePath_List.cs new file mode 100644 index 000000000000..1ffda0f7b192 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmStoragePath_List.cs @@ -0,0 +1,416 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// Lists all of the storage containers in the specified resource group. Use the nextLink property in the response to get + /// the next page of storage containers. + /// + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmStoragePath_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Lists all of the storage containers in the specified resource group. Use the nextLink property in the response to get the next page of storage containers.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmStoragePath_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmStoragePath_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.StorageContainersList(SubscriptionId, ResourceGroupName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.StorageContainersList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmStoragePath_List1.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmStoragePath_List1.cs new file mode 100644 index 000000000000..e976a80d4368 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmStoragePath_List1.cs @@ -0,0 +1,402 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// Lists all of the storage containers in the specified subscription. Use the nextLink property in the response to get the + /// next page of storage containers. + /// + /// + /// [OpenAPI] ListAll=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/storageContainers" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmStoragePath_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Lists all of the storage containers in the specified subscription. Use the nextLink property in the response to get the next page of storage containers.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/storageContainers", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmStoragePath_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmStoragePath_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.StorageContainersListAll(SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.StorageContainersListAll_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmVirtualHardDisk_Get.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmVirtualHardDisk_Get.cs new file mode 100644 index 000000000000..c28bd1adfc6d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmVirtualHardDisk_Get.cs @@ -0,0 +1,406 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// Gets a virtual hard disk + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmVirtualHardDisk_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Gets a virtual hard disk")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmVirtualHardDisk_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the virtual hard disk + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the virtual hard disk")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the virtual hard disk", + SerializedName = @"virtualHardDiskName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("VirtualHardDiskName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmVirtualHardDisk_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualHardDisksGet(SubscriptionId, ResourceGroupName, Name, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmVirtualHardDisk_List.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmVirtualHardDisk_List.cs new file mode 100644 index 000000000000..7cc9b4d82d7e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmVirtualHardDisk_List.cs @@ -0,0 +1,416 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// Lists all of the virtual hard disks in the specified resource group. Use the nextLink property in the response to get + /// the next page of virtual hard disks. + /// + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmVirtualHardDisk_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Lists all of the virtual hard disks in the specified resource group. Use the nextLink property in the response to get the next page of virtual hard disks.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmVirtualHardDisk_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmVirtualHardDisk_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualHardDisksList(SubscriptionId, ResourceGroupName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualHardDisksList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmVirtualHardDisk_List1.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmVirtualHardDisk_List1.cs new file mode 100644 index 000000000000..d5bcaa4c7e5f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmVirtualHardDisk_List1.cs @@ -0,0 +1,402 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// Lists all of the virtual hard disks in the specified subscription. Use the nextLink property in the response to get the + /// next page of virtual hard disks. + /// + /// + /// [OpenAPI] ListAll=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualHardDisks" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmVirtualHardDisk_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Lists all of the virtual hard disks in the specified subscription. Use the nextLink property in the response to get the next page of virtual hard disks.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualHardDisks", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmVirtualHardDisk_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmVirtualHardDisk_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualHardDisksListAll(SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualHardDisksListAll_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmVirtualMachine_Get.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmVirtualMachine_Get.cs new file mode 100644 index 000000000000..8a0d712f1e76 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmVirtualMachine_Get.cs @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// Gets a virtual machine instance + /// + /// [OpenAPI] Get=>GET:"/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmVirtualMachine_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Gets a virtual machine instance")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmVirtualMachine_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceUri; + + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.", + SerializedName = @"resourceUri", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceUri { get => this._resourceUri; set => this._resourceUri = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmVirtualMachine_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualMachineInstancesGet(ResourceUri, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmVirtualMachine_List.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmVirtualMachine_List.cs new file mode 100644 index 000000000000..8da85763433a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/GetAzStackHCIVmVirtualMachine_List.cs @@ -0,0 +1,397 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// Lists all of the virtual machine instances within the specified parent resource. + /// + /// + /// [OpenAPI] List=>GET:"/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzStackHCIVmVirtualMachine_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Lists all of the virtual machine instances within the specified parent resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances", ApiVersion = "2023-09-01-preview")] + public partial class GetAzStackHCIVmVirtualMachine_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceUri; + + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.", + SerializedName = @"resourceUri", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceUri { get => this._resourceUri; set => this._resourceUri = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceListResult + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzStackHCIVmVirtualMachine_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualMachineInstancesList(ResourceUri, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceListResult + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualMachineInstancesList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmGalleryImage_CreateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmGalleryImage_CreateExpanded.cs new file mode 100644 index 000000000000..ee7b597f6c68 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmGalleryImage_CreateExpanded.cs @@ -0,0 +1,634 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// The operation to create or update a gallery image. Please note some properties can be set only during gallery image creation. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStackHCIVmGalleryImage_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to create or update a gallery image. Please note some properties can be set only during gallery image creation.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}", ApiVersion = "2023-09-01-preview")] + public partial class NewAzStackHCIVmGalleryImage_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The gallery images resource definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages _galleryImagesBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImages(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure]")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure]", + SerializedName = @"cloudInitDataSource", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource CloudInitDataSource { get => _galleryImagesBody.CloudInitDataSource ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource)""); set => _galleryImagesBody.CloudInitDataSource = value; } + + /// The name of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string CustomLocationId { get => _galleryImagesBody.ExtendedLocationName ?? null; set => _galleryImagesBody.ExtendedLocationName = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The type of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the extended location.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"""CustomLocation""")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.DoNotExport] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes ExtendedLocationType { get => _galleryImagesBody.ExtendedLocationType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes)""); set => _galleryImagesBody.ExtendedLocationType = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// The hypervisor generation of the Virtual Machine [V1, V2] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The hypervisor generation of the Virtual Machine [V1, V2]")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The hypervisor generation of the Virtual Machine [V1, V2]", + SerializedName = @"hyperVGeneration", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration HyperVGeneration { get => _galleryImagesBody.HyperVGeneration ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration)""); set => _galleryImagesBody.HyperVGeneration = value; } + + /// location of the image the gallery image should be created from + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "location of the image the gallery image should be created from")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"location of the image the gallery image should be created from", + SerializedName = @"imagePath", + PossibleTypes = new [] { typeof(string) })] + public string ImagePath { get => _galleryImagesBody.ImagePath ?? null; set => _galleryImagesBody.ImagePath = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _galleryImagesBody.Location ?? null; set => _galleryImagesBody.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the gallery image + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the gallery image")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the gallery image", + SerializedName = @"galleryImageName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("GalleryImageName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// Operating system type that the gallery image uses [Windows, Linux] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Operating system type that the gallery image uses [Windows, Linux]")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Operating system type that the gallery image uses [Windows, Linux]", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes OSType { get => _galleryImagesBody.OSType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes)""); set => _galleryImagesBody.OSType = value; } + + /// The name of the gallery image definition offer. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the gallery image definition offer.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition offer.", + SerializedName = @"offer", + PossibleTypes = new [] { typeof(string) })] + public string Offer { get => _galleryImagesBody.IdentifierOffer ?? null; set => _galleryImagesBody.IdentifierOffer = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The name of the gallery image definition publisher. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the gallery image definition publisher.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition publisher.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + public string Publisher { get => _galleryImagesBody.IdentifierPublisher ?? null; set => _galleryImagesBody.IdentifierPublisher = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// The name of the gallery image definition SKU. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the gallery image definition SKU.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition SKU.", + SerializedName = @"sku", + PossibleTypes = new [] { typeof(string) })] + public string Sku { get => _galleryImagesBody.IdentifierSku ?? null; set => _galleryImagesBody.IdentifierSku = value; } + + /// Storage ContainerID of the storage container to be used for gallery image + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Storage ContainerID of the storage container to be used for gallery image")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Storage ContainerID of the storage container to be used for gallery image", + SerializedName = @"containerId", + PossibleTypes = new [] { typeof(string) })] + public string StoragePathId { get => _galleryImagesBody.ContainerId ?? null; set => _galleryImagesBody.ContainerId = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => _galleryImagesBody.Tag ?? null /* object */; set => _galleryImagesBody.Tag = value; } + + /// This is the version of the gallery image. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "This is the version of the gallery image.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"This is the version of the gallery image.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string Version { get => _galleryImagesBody.VersionName ?? null; set => _galleryImagesBody.VersionName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzStackHCIVmGalleryImage_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.NewAzStackHCIVmGalleryImage_CreateExpanded Clone() + { + var clone = new NewAzStackHCIVmGalleryImage_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._galleryImagesBody = this._galleryImagesBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzStackHCIVmGalleryImage_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'GalleryImagesCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GalleryImagesCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, _galleryImagesBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_galleryImagesBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_galleryImagesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_galleryImagesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmGuestAgent_CreateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmGuestAgent_CreateExpanded.cs new file mode 100644 index 000000000000..3978e6318938 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmGuestAgent_CreateExpanded.cs @@ -0,0 +1,478 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// Create Or Update GuestAgent. + /// + /// [OpenAPI] Create=>PUT:"/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStackHCIVmGuestAgent_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Create Or Update GuestAgent.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default", ApiVersion = "2023-09-01-preview")] + public partial class NewAzStackHCIVmGuestAgent_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Defines the GuestAgent. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent _body = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GuestAgent(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// The password to connect with the guest. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The password to connect with the guest.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The password to connect with the guest.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + public string CredentialsPassword { get => _body.CredentialsPassword ?? null; set => _body.CredentialsPassword = value; } + + /// The username to connect with the guest. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The username to connect with the guest.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The username to connect with the guest.", + SerializedName = @"username", + PossibleTypes = new [] { typeof(string) })] + public string CredentialsUsername { get => _body.CredentialsUsername ?? null; set => _body.CredentialsUsername = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The guest agent provisioning action. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The guest agent provisioning action.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The guest agent provisioning action.", + SerializedName = @"provisioningAction", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction ProvisioningAction { get => _body.ProvisioningAction ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction)""); set => _body.ProvisioningAction = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceUri; + + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.", + SerializedName = @"resourceUri", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceUri { get => this._resourceUri; set => this._resourceUri = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzStackHCIVmGuestAgent_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.NewAzStackHCIVmGuestAgent_CreateExpanded Clone() + { + var clone = new NewAzStackHCIVmGuestAgent_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._body = this._body; + clone.ResourceUri = this.ResourceUri; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzStackHCIVmGuestAgent_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'GuestAgentCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GuestAgentCreate(ResourceUri, _body, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri,body=_body}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri, body=_body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri, body=_body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmLogicalNetwork_CreateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmLogicalNetwork_CreateExpanded.cs new file mode 100644 index 000000000000..2523fd14eee2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmLogicalNetwork_CreateExpanded.cs @@ -0,0 +1,566 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// The operation to create or update a logical network. Please note some properties can be set only during logical network + /// creation. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStackHCIVmLogicalNetwork_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to create or update a logical network. Please note some properties can be set only during logical network creation.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}", ApiVersion = "2023-09-01-preview")] + public partial class NewAzStackHCIVmLogicalNetwork_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The logical network resource definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks _logicalNetworksBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworks(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// The name of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string CustomLocationId { get => _logicalNetworksBody.ExtendedLocationName ?? null; set => _logicalNetworksBody.ExtendedLocationName = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The list of DNS servers IP addresses. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The list of DNS servers IP addresses.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of DNS servers IP addresses.", + SerializedName = @"dnsServers", + PossibleTypes = new [] { typeof(string) })] + public string[] DnsServer { get => _logicalNetworksBody.DhcpOptionDnsServer ?? null /* arrayOf */; set => _logicalNetworksBody.DhcpOptionDnsServer = value; } + + /// The type of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the extended location.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"""CustomLocation""")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.DoNotExport] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes ExtendedLocationType { get => _logicalNetworksBody.ExtendedLocationType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes)""); set => _logicalNetworksBody.ExtendedLocationType = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _logicalNetworksBody.Location ?? null; set => _logicalNetworksBody.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the logical network + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the logical network")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the logical network", + SerializedName = @"logicalNetworkName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("LogicalNetworkName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Subnet - list of subnets under the logical network + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Subnet - list of subnets under the logical network")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Subnet - list of subnets under the logical network", + SerializedName = @"subnets", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet[] Subnet { get => _logicalNetworksBody.Subnet ?? null /* arrayOf */; set => _logicalNetworksBody.Subnet = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => _logicalNetworksBody.Tag ?? null /* object */; set => _logicalNetworksBody.Tag = value; } + + /// name of the network switch to be used for VMs + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "name of the network switch to be used for VMs")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"name of the network switch to be used for VMs", + SerializedName = @"vmSwitchName", + PossibleTypes = new [] { typeof(string) })] + public string VMSwitchName { get => _logicalNetworksBody.VMSwitchName ?? null; set => _logicalNetworksBody.VMSwitchName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzStackHCIVmLogicalNetwork_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.NewAzStackHCIVmLogicalNetwork_CreateExpanded Clone() + { + var clone = new NewAzStackHCIVmLogicalNetwork_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._logicalNetworksBody = this._logicalNetworksBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzStackHCIVmLogicalNetwork_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'LogicalNetworksCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.LogicalNetworksCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, _logicalNetworksBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_logicalNetworksBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_logicalNetworksBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_logicalNetworksBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmMachineExtension_CreateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmMachineExtension_CreateExpanded.cs new file mode 100644 index 000000000000..2720d511528c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmMachineExtension_CreateExpanded.cs @@ -0,0 +1,702 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to create or update the extension. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStackHCIVmMachineExtension_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to create or update the extension.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}", ApiVersion = "2023-03-15-preview")] + public partial class NewAzStackHCIVmMachineExtension_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Describes a Machine Extension. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension _extensionParametersBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtension(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// + /// Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, + /// however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true.", + SerializedName = @"autoUpgradeMinorVersion", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter AutoUpgradeMinorVersion { get => _extensionParametersBody.AutoUpgradeMinorVersion ?? default(global::System.Management.Automation.SwitchParameter); set => _extensionParametersBody.AutoUpgradeMinorVersion = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// + /// Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available.", + SerializedName = @"enableAutomaticUpgrade", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter EnableAutomaticUpgrade { get => _extensionParametersBody.EnableAutomaticUpgrade ?? default(global::System.Management.Automation.SwitchParameter); set => _extensionParametersBody.EnableAutomaticUpgrade = value; } + + /// Backing field for property. + private string _extensionName; + + /// The name of the machine extension. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the machine extension.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the machine extension.", + SerializedName = @"extensionName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ExtensionName { get => this._extensionName; set => this._extensionName = value; } + + /// + /// How the extension handler should be forced to update even if the extension configuration has not changed. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "How the extension handler should be forced to update even if the extension configuration has not changed.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"How the extension handler should be forced to update even if the extension configuration has not changed.", + SerializedName = @"forceUpdateTag", + PossibleTypes = new [] { typeof(string) })] + public string ForceUpdateTag { get => _extensionParametersBody.ForceUpdateTag ?? null; set => _extensionParametersBody.ForceUpdateTag = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// The machine extension name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The machine extension name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The machine extension name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string InstanceViewName { get => _extensionParametersBody.InstanceViewName ?? null; set => _extensionParametersBody.InstanceViewName = value; } + + /// Specifies the type of the extension; an example is "CustomScriptExtension". + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the type of the extension; an example is \"CustomScriptExtension\".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the type of the extension; an example is ""CustomScriptExtension"".", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + public string InstanceViewType { get => _extensionParametersBody.InstanceViewType ?? null; set => _extensionParametersBody.InstanceViewType = value; } + + /// Specifies the version of the script handler. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the version of the script handler.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the version of the script handler.", + SerializedName = @"typeHandlerVersion", + PossibleTypes = new [] { typeof(string) })] + public string InstanceViewTypeHandlerVersion { get => _extensionParametersBody.InstanceViewTypeHandlerVersion ?? null; set => _extensionParametersBody.InstanceViewTypeHandlerVersion = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _extensionParametersBody.Location ?? null; set => _extensionParametersBody.Location = value; } + + /// Backing field for property. + private string _machineName; + + /// The name of the machine where the extension should be created or updated. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the machine where the extension should be created or updated.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the machine where the extension should be created or updated.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string MachineName { get => this._machineName; set => this._machineName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// Specifies the type of the extension; an example is "CustomScriptExtension". + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the type of the extension; an example is \"CustomScriptExtension\".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the type of the extension; an example is ""CustomScriptExtension"".", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + public string PropertiesType { get => _extensionParametersBody.PropertiesType ?? null; set => _extensionParametersBody.PropertiesType = value; } + + /// + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.", + SerializedName = @"protectedSettings", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings ProtectedSetting { get => _extensionParametersBody.ProtectedSetting ?? null /* object */; set => _extensionParametersBody.ProtectedSetting = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The name of the extension handler publisher. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the extension handler publisher.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extension handler publisher.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + public string Publisher { get => _extensionParametersBody.Publisher ?? null; set => _extensionParametersBody.Publisher = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Json formatted public settings for the extension. + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Json formatted public settings for the extension.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Json formatted public settings for the extension.", + SerializedName = @"settings", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings Setting { get => _extensionParametersBody.Setting ?? null /* object */; set => _extensionParametersBody.Setting = value; } + + /// The status code. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The status code.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + public string StatusCode { get => _extensionParametersBody.StatusCode ?? null; set => _extensionParametersBody.StatusCode = value; } + + /// The short localizable label for the status. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The short localizable label for the status.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The short localizable label for the status.", + SerializedName = @"displayStatus", + PossibleTypes = new [] { typeof(string) })] + public string StatusDisplayStatus { get => _extensionParametersBody.StatusDisplayStatus ?? null; set => _extensionParametersBody.StatusDisplayStatus = value; } + + /// The level code. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The level code.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The level code.", + SerializedName = @"level", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes StatusLevel { get => _extensionParametersBody.StatusLevel ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes)""); set => _extensionParametersBody.StatusLevel = value; } + + /// The detailed status message, including for alerts and error messages. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The detailed status message, including for alerts and error messages.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The detailed status message, including for alerts and error messages.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + public string StatusMessage { get => _extensionParametersBody.StatusMessage ?? null; set => _extensionParametersBody.StatusMessage = value; } + + /// The time of the status. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The time of the status.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The time of the status.", + SerializedName = @"time", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + public global::System.DateTime StatusTime { get => _extensionParametersBody.StatusTime ?? default(global::System.DateTime); set => _extensionParametersBody.StatusTime = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => _extensionParametersBody.Tag ?? null /* object */; set => _extensionParametersBody.Tag = value; } + + /// Specifies the version of the script handler. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the version of the script handler.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the version of the script handler.", + SerializedName = @"typeHandlerVersion", + PossibleTypes = new [] { typeof(string) })] + public string TypeHandlerVersion { get => _extensionParametersBody.TypeHandlerVersion ?? null; set => _extensionParametersBody.TypeHandlerVersion = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzStackHCIVmMachineExtension_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.NewAzStackHCIVmMachineExtension_CreateExpanded Clone() + { + var clone = new NewAzStackHCIVmMachineExtension_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._extensionParametersBody = this._extensionParametersBody; + clone.ResourceGroupName = this.ResourceGroupName; + clone.MachineName = this.MachineName; + clone.ExtensionName = this.ExtensionName; + clone.SubscriptionId = this.SubscriptionId; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzStackHCIVmMachineExtension_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'MachineExtensionsCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MachineExtensionsCreateOrUpdate(ResourceGroupName, MachineName, ExtensionName, SubscriptionId, _extensionParametersBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,MachineName=MachineName,ExtensionName=ExtensionName,SubscriptionId=SubscriptionId,body=_extensionParametersBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, MachineName=MachineName, ExtensionName=ExtensionName, SubscriptionId=SubscriptionId, body=_extensionParametersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, MachineName=MachineName, ExtensionName=ExtensionName, SubscriptionId=SubscriptionId, body=_extensionParametersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmMachine_CreateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmMachine_CreateExpanded.cs new file mode 100644 index 000000000000..10e0cd19e130 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmMachine_CreateExpanded.cs @@ -0,0 +1,712 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// The operation to create or update a hybrid machine. Please note some properties can be set only during machine creation. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStackHCIVmMachine_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to create or update a hybrid machine. Please note some properties can be set only during machine creation.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}", ApiVersion = "2023-03-15-preview")] + public partial class NewAzStackHCIVmMachine_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Describes a hybrid machine. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine _parametersBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.Machine(); + + /// The correlation ID passed in from RSM per upgrade. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The correlation ID passed in from RSM per upgrade.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The correlation ID passed in from RSM per upgrade.", + SerializedName = @"correlationId", + PossibleTypes = new [] { typeof(string) })] + public string AgentUpgradeCorrelationId { get => _parametersBody.AgentUpgradeCorrelationId ?? null; set => _parametersBody.AgentUpgradeCorrelationId = value; } + + /// Specifies the version info w.r.t AgentUpgrade for the machine. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the version info w.r.t AgentUpgrade for the machine.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the version info w.r.t AgentUpgrade for the machine.", + SerializedName = @"desiredVersion", + PossibleTypes = new [] { typeof(string) })] + public string AgentUpgradeDesiredVersion { get => _parametersBody.AgentUpgradeDesiredVersion ?? null; set => _parametersBody.AgentUpgradeDesiredVersion = value; } + + /// Specifies if RSM should try to upgrade this machine + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies if RSM should try to upgrade this machine")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies if RSM should try to upgrade this machine", + SerializedName = @"enableAutomaticUpgrade", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter AgentUpgradeEnableAutomaticUpgrade { get => _parametersBody.AgentUpgradeEnableAutomaticUpgrade ?? default(global::System.Management.Automation.SwitchParameter); set => _parametersBody.AgentUpgradeEnableAutomaticUpgrade = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// Public Key that the client provides to be used during initial resource onboarding + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Public Key that the client provides to be used during initial resource onboarding")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Public Key that the client provides to be used during initial resource onboarding", + SerializedName = @"clientPublicKey", + PossibleTypes = new [] { typeof(string) })] + public string ClientPublicKey { get => _parametersBody.ClientPublicKey ?? null; set => _parametersBody.ClientPublicKey = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Machine Extensions information (deprecated field) + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Machine Extensions information (deprecated field)")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Machine Extensions information (deprecated field)", + SerializedName = @"extensions", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView[] Extension { get => _parametersBody.Extension ?? null /* arrayOf */; set => _parametersBody.Extension = value; } + + /// The behavior of the service when the Arc-enabled machine starts up. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The behavior of the service when the Arc-enabled machine starts up.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The behavior of the service when the Arc-enabled machine starts up.", + SerializedName = @"startupType", + PossibleTypes = new [] { typeof(string) })] + public string ExtensionServiceStartupType { get => _parametersBody.ExtensionServiceStartupType ?? null; set => _parametersBody.ExtensionServiceStartupType = value; } + + /// The current status of the service. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The current status of the service.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The current status of the service.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + public string ExtensionServiceStatus { get => _parametersBody.ExtensionServiceStatus ?? null; set => _parametersBody.ExtensionServiceStatus = value; } + + /// The behavior of the service when the Arc-enabled machine starts up. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The behavior of the service when the Arc-enabled machine starts up.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The behavior of the service when the Arc-enabled machine starts up.", + SerializedName = @"startupType", + PossibleTypes = new [] { typeof(string) })] + public string GuestConfigurationServiceStartupType { get => _parametersBody.GuestConfigurationServiceStartupType ?? null; set => _parametersBody.GuestConfigurationServiceStartupType = value; } + + /// The current status of the service. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The current status of the service.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The current status of the service.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + public string GuestConfigurationServiceStatus { get => _parametersBody.GuestConfigurationServiceStatus ?? null; set => _parametersBody.GuestConfigurationServiceStatus = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// The identity type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The identity type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identity type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType IdentityType { get => _parametersBody.IdentityType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType)""); set => _parametersBody.IdentityType = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc.", + SerializedName = @"kind", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind Kind { get => _parametersBody.Kind ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind)""); set => _parametersBody.Kind = value; } + + /// Specifies the assessment mode. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the assessment mode.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the assessment mode.", + SerializedName = @"assessmentMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes LinuxConfigurationPatchSettingsAssessmentMode { get => _parametersBody.LinuxConfigurationPatchSettingsAssessmentMode ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes)""); set => _parametersBody.LinuxConfigurationPatchSettingsAssessmentMode = value; } + + /// Specifies the patch mode. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the patch mode.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the patch mode.", + SerializedName = @"patchMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes LinuxConfigurationPatchSettingsPatchMode { get => _parametersBody.LinuxConfigurationPatchSettingsPatchMode ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes)""); set => _parametersBody.LinuxConfigurationPatchSettingsPatchMode = value; } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _parametersBody.Location ?? null; set => _parametersBody.Location = value; } + + /// The city or locality where the resource is located. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The city or locality where the resource is located.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The city or locality where the resource is located.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + public string LocationDataCity { get => _parametersBody.LocationDataCity ?? null; set => _parametersBody.LocationDataCity = value; } + + /// The country or region where the resource is located + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The country or region where the resource is located")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The country or region where the resource is located", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + public string LocationDataCountryOrRegion { get => _parametersBody.LocationDataCountryOrRegion ?? null; set => _parametersBody.LocationDataCountryOrRegion = value; } + + /// The district, state, or province where the resource is located. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The district, state, or province where the resource is located.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The district, state, or province where the resource is located.", + SerializedName = @"district", + PossibleTypes = new [] { typeof(string) })] + public string LocationDataDistrict { get => _parametersBody.LocationDataDistrict ?? null; set => _parametersBody.LocationDataDistrict = value; } + + /// A canonical name for the geographic or physical location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "A canonical name for the geographic or physical location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A canonical name for the geographic or physical location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string LocationDataName { get => _parametersBody.LocationDataName ?? null; set => _parametersBody.LocationDataName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Specifies whether any MS SQL instance is discovered on the machine. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies whether any MS SQL instance is discovered on the machine.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies whether any MS SQL instance is discovered on the machine.", + SerializedName = @"mssqlDiscovered", + PossibleTypes = new [] { typeof(string) })] + public string MssqlDiscovered { get => _parametersBody.MssqlDiscovered ?? null; set => _parametersBody.MssqlDiscovered = value; } + + /// Backing field for property. + private string _name; + + /// The name of the hybrid machine. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the hybrid machine.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the hybrid machine.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("MachineName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// The type of Operating System (windows/linux). + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of Operating System (windows/linux).")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of Operating System (windows/linux).", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + public string OSType { get => _parametersBody.OSType ?? null; set => _parametersBody.OSType = value; } + + /// + /// The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any.", + SerializedName = @"parentClusterResourceId", + PossibleTypes = new [] { typeof(string) })] + public string ParentClusterResourceId { get => _parametersBody.ParentClusterResourceId ?? null; set => _parametersBody.ParentClusterResourceId = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The resource id of the private link scope this machine is assigned to, if any. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The resource id of the private link scope this machine is assigned to, if any.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource id of the private link scope this machine is assigned to, if any.", + SerializedName = @"privateLinkScopeResourceId", + PossibleTypes = new [] { typeof(string) })] + public string PrivateLinkScopeResourceId { get => _parametersBody.PrivateLinkScopeResourceId ?? null; set => _parametersBody.PrivateLinkScopeResourceId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => _parametersBody.Tag ?? null /* object */; set => _parametersBody.Tag = value; } + + /// Specifies the hybrid machine unique ID. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the hybrid machine unique ID.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the hybrid machine unique ID.", + SerializedName = @"vmId", + PossibleTypes = new [] { typeof(string) })] + public string VMId { get => _parametersBody.VMId ?? null; set => _parametersBody.VMId = value; } + + /// Specifies the assessment mode. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the assessment mode.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the assessment mode.", + SerializedName = @"assessmentMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes WindowsConfigurationPatchSettingsAssessmentMode { get => _parametersBody.WindowsConfigurationPatchSettingsAssessmentMode ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes)""); set => _parametersBody.WindowsConfigurationPatchSettingsAssessmentMode = value; } + + /// Specifies the patch mode. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the patch mode.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the patch mode.", + SerializedName = @"patchMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes WindowsConfigurationPatchSettingsPatchMode { get => _parametersBody.WindowsConfigurationPatchSettingsPatchMode ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes)""); set => _parametersBody.WindowsConfigurationPatchSettingsPatchMode = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzStackHCIVmMachine_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'MachinesCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MachinesCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, _parametersBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_parametersBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_parametersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_parametersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmMarketplaceGalleryImage_CreateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmMarketplaceGalleryImage_CreateExpanded.cs new file mode 100644 index 000000000000..dedfa9e2f439 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmMarketplaceGalleryImage_CreateExpanded.cs @@ -0,0 +1,626 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// The operation to create or update a marketplace gallery image. Please note some properties can be set only during marketplace + /// gallery image creation. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStackHCIVmMarketplaceGalleryImage_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to create or update a marketplace gallery image. Please note some properties can be set only during marketplace gallery image creation.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}", ApiVersion = "2023-09-01-preview")] + public partial class NewAzStackHCIVmMarketplaceGalleryImage_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The marketplace gallery image resource definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages _marketplaceGalleryImagesBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImages(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure]")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure]", + SerializedName = @"cloudInitDataSource", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource CloudInitDataSource { get => _marketplaceGalleryImagesBody.CloudInitDataSource ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource)""); set => _marketplaceGalleryImagesBody.CloudInitDataSource = value; } + + /// The name of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string CustomLocationId { get => _marketplaceGalleryImagesBody.ExtendedLocationName ?? null; set => _marketplaceGalleryImagesBody.ExtendedLocationName = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The type of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the extended location.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"""CustomLocation""")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.DoNotExport] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes ExtendedLocationType { get => _marketplaceGalleryImagesBody.ExtendedLocationType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes)""); set => _marketplaceGalleryImagesBody.ExtendedLocationType = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// The hypervisor generation of the Virtual Machine [V1, V2] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The hypervisor generation of the Virtual Machine [V1, V2]")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The hypervisor generation of the Virtual Machine [V1, V2]", + SerializedName = @"hyperVGeneration", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration HyperVGeneration { get => _marketplaceGalleryImagesBody.HyperVGeneration ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration)""); set => _marketplaceGalleryImagesBody.HyperVGeneration = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _marketplaceGalleryImagesBody.Location ?? null; set => _marketplaceGalleryImagesBody.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the marketplace gallery image + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the marketplace gallery image")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the marketplace gallery image", + SerializedName = @"marketplaceGalleryImageName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("MarketplaceGalleryImageName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// Operating system type that the gallery image uses [Windows, Linux] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Operating system type that the gallery image uses [Windows, Linux]")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Operating system type that the gallery image uses [Windows, Linux]", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes OSType { get => _marketplaceGalleryImagesBody.OSType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes)""); set => _marketplaceGalleryImagesBody.OSType = value; } + + /// The name of the gallery image definition offer. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the gallery image definition offer.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition offer.", + SerializedName = @"offer", + PossibleTypes = new [] { typeof(string) })] + public string Offer { get => _marketplaceGalleryImagesBody.IdentifierOffer ?? null; set => _marketplaceGalleryImagesBody.IdentifierOffer = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The name of the gallery image definition publisher. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the gallery image definition publisher.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition publisher.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + public string Publisher { get => _marketplaceGalleryImagesBody.IdentifierPublisher ?? null; set => _marketplaceGalleryImagesBody.IdentifierPublisher = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// The name of the gallery image definition SKU. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the gallery image definition SKU.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition SKU.", + SerializedName = @"sku", + PossibleTypes = new [] { typeof(string) })] + public string Sku { get => _marketplaceGalleryImagesBody.IdentifierSku ?? null; set => _marketplaceGalleryImagesBody.IdentifierSku = value; } + + /// + /// Storage ContainerID of the storage container to be used for marketplace gallery image + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Storage ContainerID of the storage container to be used for marketplace gallery image")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Storage ContainerID of the storage container to be used for marketplace gallery image", + SerializedName = @"containerId", + PossibleTypes = new [] { typeof(string) })] + public string StoragePathId { get => _marketplaceGalleryImagesBody.ContainerId ?? null; set => _marketplaceGalleryImagesBody.ContainerId = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => _marketplaceGalleryImagesBody.Tag ?? null /* object */; set => _marketplaceGalleryImagesBody.Tag = value; } + + /// This is the version of the gallery image. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "This is the version of the gallery image.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"This is the version of the gallery image.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string Version { get => _marketplaceGalleryImagesBody.VersionName ?? null; set => _marketplaceGalleryImagesBody.VersionName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzStackHCIVmMarketplaceGalleryImage_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.NewAzStackHCIVmMarketplaceGalleryImage_CreateExpanded Clone() + { + var clone = new NewAzStackHCIVmMarketplaceGalleryImage_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._marketplaceGalleryImagesBody = this._marketplaceGalleryImagesBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzStackHCIVmMarketplaceGalleryImage_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'MarketplaceGalleryImagesCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MarketplaceGalleryImagesCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, _marketplaceGalleryImagesBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_marketplaceGalleryImagesBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_marketplaceGalleryImagesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_marketplaceGalleryImagesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmNetworkInterface_CreateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmNetworkInterface_CreateExpanded.cs new file mode 100644 index 000000000000..820f024cbfb7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmNetworkInterface_CreateExpanded.cs @@ -0,0 +1,566 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// The operation to create or update a network interface. Please note some properties can be set only during network interface + /// creation. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStackHCIVmNetworkInterface_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to create or update a network interface. Please note some properties can be set only during network interface creation.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}", ApiVersion = "2023-09-01-preview")] + public partial class NewAzStackHCIVmNetworkInterface_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The network interface resource definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces _networkInterfacesBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaces(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// The name of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string CustomLocationId { get => _networkInterfacesBody.ExtendedLocationName ?? null; set => _networkInterfacesBody.ExtendedLocationName = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// List of DNS server IP Addresses for the interface + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of DNS server IP Addresses for the interface")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of DNS server IP Addresses for the interface", + SerializedName = @"dnsServers", + PossibleTypes = new [] { typeof(string) })] + public string[] DnsServer { get => _networkInterfacesBody.DnsSettingDnsServer ?? null /* arrayOf */; set => _networkInterfacesBody.DnsSettingDnsServer = value; } + + /// The type of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the extended location.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"""CustomLocation""")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.DoNotExport] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes ExtendedLocationType { get => _networkInterfacesBody.ExtendedLocationType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes)""); set => _networkInterfacesBody.ExtendedLocationType = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// IPConfigurations - A list of IPConfigurations of the network interface. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "IPConfigurations - A list of IPConfigurations of the network interface.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"IPConfigurations - A list of IPConfigurations of the network interface.", + SerializedName = @"ipConfigurations", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration[] IPConfiguration { get => _networkInterfacesBody.IPConfiguration ?? null /* arrayOf */; set => _networkInterfacesBody.IPConfiguration = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _networkInterfacesBody.Location ?? null; set => _networkInterfacesBody.Location = value; } + + /// MacAddress - The MAC address of the network interface. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "MacAddress - The MAC address of the network interface.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"MacAddress - The MAC address of the network interface.", + SerializedName = @"macAddress", + PossibleTypes = new [] { typeof(string) })] + public string MacAddress { get => _networkInterfacesBody.MacAddress ?? null; set => _networkInterfacesBody.MacAddress = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the network interface + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the network interface")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the network interface", + SerializedName = @"networkInterfaceName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("NetworkInterfaceName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => _networkInterfacesBody.Tag ?? null /* object */; set => _networkInterfacesBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzStackHCIVmNetworkInterface_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.NewAzStackHCIVmNetworkInterface_CreateExpanded Clone() + { + var clone = new NewAzStackHCIVmNetworkInterface_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._networkInterfacesBody = this._networkInterfacesBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzStackHCIVmNetworkInterface_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'NetworkInterfacesCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.NetworkInterfacesCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, _networkInterfacesBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_networkInterfacesBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_networkInterfacesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_networkInterfacesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmStoragePath_CreateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmStoragePath_CreateExpanded.cs new file mode 100644 index 000000000000..bcfde5cc2b10 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmStoragePath_CreateExpanded.cs @@ -0,0 +1,542 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// The operation to create or update a storage container. Please note some properties can be set only during storage container + /// creation. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStackHCIVmStoragePath_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to create or update a storage container. Please note some properties can be set only during storage container creation.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}", ApiVersion = "2023-09-01-preview")] + public partial class NewAzStackHCIVmStoragePath_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The storage container resource definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers _storageContainersBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainers(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// The name of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string CustomLocationId { get => _storageContainersBody.ExtendedLocationName ?? null; set => _storageContainersBody.ExtendedLocationName = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The type of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the extended location.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"""CustomLocation""")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.DoNotExport] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes ExtendedLocationType { get => _storageContainersBody.ExtendedLocationType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes)""); set => _storageContainersBody.ExtendedLocationType = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _storageContainersBody.Location ?? null; set => _storageContainersBody.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the storage container + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the storage container")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the storage container", + SerializedName = @"storageContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("StorageContainerName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// Path of the storage container on the disk + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Path of the storage container on the disk")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Path of the storage container on the disk", + SerializedName = @"path", + PossibleTypes = new [] { typeof(string) })] + public string Path { get => _storageContainersBody.Path ?? null; set => _storageContainersBody.Path = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => _storageContainersBody.Tag ?? null /* object */; set => _storageContainersBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzStackHCIVmStoragePath_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.NewAzStackHCIVmStoragePath_CreateExpanded Clone() + { + var clone = new NewAzStackHCIVmStoragePath_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._storageContainersBody = this._storageContainersBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzStackHCIVmStoragePath_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'StorageContainersCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.StorageContainersCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, _storageContainersBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_storageContainersBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_storageContainersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_storageContainersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmVirtualHardDisk_CreateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmVirtualHardDisk_CreateExpanded.cs new file mode 100644 index 000000000000..d71078b50e15 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmVirtualHardDisk_CreateExpanded.cs @@ -0,0 +1,621 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// The operation to create or update a virtual hard disk. Please note some properties can be set only during virtual hard + /// disk creation. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStackHCIVmVirtualHardDisk_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to create or update a virtual hard disk. Please note some properties can be set only during virtual hard disk creation.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}", ApiVersion = "2023-09-01-preview")] + public partial class NewAzStackHCIVmVirtualHardDisk_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The virtual hard disk resource definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks _virtualHardDisksBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisks(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// . + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @".", + SerializedName = @"blockSizeBytes", + PossibleTypes = new [] { typeof(int) })] + public int BlockSizeByte { get => _virtualHardDisksBody.BlockSizeByte ?? default(int); set => _virtualHardDisksBody.BlockSizeByte = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// The name of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string CustomLocationId { get => _virtualHardDisksBody.ExtendedLocationName ?? null; set => _virtualHardDisksBody.ExtendedLocationName = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The format of the actual VHD file [vhd, vhdx] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The format of the actual VHD file [vhd, vhdx]")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The format of the actual VHD file [vhd, vhdx]", + SerializedName = @"diskFileFormat", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat DiskFileFormat { get => _virtualHardDisksBody.DiskFileFormat ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat)""); set => _virtualHardDisksBody.DiskFileFormat = value; } + + /// Boolean for enabling dynamic sizing on the virtual hard disk + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Boolean for enabling dynamic sizing on the virtual hard disk")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Boolean for enabling dynamic sizing on the virtual hard disk", + SerializedName = @"dynamic", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter Dynamic { get => _virtualHardDisksBody.Dynamic ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualHardDisksBody.Dynamic = value; } + + /// The type of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the extended location.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"""CustomLocation""")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.DoNotExport] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes ExtendedLocationType { get => _virtualHardDisksBody.ExtendedLocationType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes)""); set => _virtualHardDisksBody.ExtendedLocationType = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// The hypervisor generation of the Virtual Machine [V1, V2] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The hypervisor generation of the Virtual Machine [V1, V2]")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The hypervisor generation of the Virtual Machine [V1, V2]", + SerializedName = @"hyperVGeneration", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration HyperVGeneration { get => _virtualHardDisksBody.HyperVGeneration ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration)""); set => _virtualHardDisksBody.HyperVGeneration = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _virtualHardDisksBody.Location ?? null; set => _virtualHardDisksBody.Location = value; } + + /// . + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @".", + SerializedName = @"logicalSectorBytes", + PossibleTypes = new [] { typeof(int) })] + public int LogicalSectorByte { get => _virtualHardDisksBody.LogicalSectorByte ?? default(int); set => _virtualHardDisksBody.LogicalSectorByte = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the virtual hard disk + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the virtual hard disk")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the virtual hard disk", + SerializedName = @"virtualHardDiskName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("VirtualHardDiskName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// . + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @".", + SerializedName = @"physicalSectorBytes", + PossibleTypes = new [] { typeof(int) })] + public int PhysicalSectorByte { get => _virtualHardDisksBody.PhysicalSectorByte ?? default(int); set => _virtualHardDisksBody.PhysicalSectorByte = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Size of the disk in GB + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Size of the disk in GB")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Size of the disk in GB", + SerializedName = @"diskSizeGB", + PossibleTypes = new [] { typeof(long) })] + public long SizeGb { get => _virtualHardDisksBody.DiskSizeGb ?? default(long); set => _virtualHardDisksBody.DiskSizeGb = value; } + + /// Storage ContainerID of the storage container to be used for VHD + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Storage ContainerID of the storage container to be used for VHD")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Storage ContainerID of the storage container to be used for VHD", + SerializedName = @"containerId", + PossibleTypes = new [] { typeof(string) })] + public string StoragePathId { get => _virtualHardDisksBody.ContainerId ?? null; set => _virtualHardDisksBody.ContainerId = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => _virtualHardDisksBody.Tag ?? null /* object */; set => _virtualHardDisksBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzStackHCIVmVirtualHardDisk_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.NewAzStackHCIVmVirtualHardDisk_CreateExpanded Clone() + { + var clone = new NewAzStackHCIVmVirtualHardDisk_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._virtualHardDisksBody = this._virtualHardDisksBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzStackHCIVmVirtualHardDisk_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualHardDisksCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualHardDisksCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, _virtualHardDisksBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_virtualHardDisksBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_virtualHardDisksBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_virtualHardDisksBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmVirtualMachine_CreateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmVirtualMachine_CreateExpanded.cs new file mode 100644 index 000000000000..af0c00640c64 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/NewAzStackHCIVmVirtualMachine_CreateExpanded.cs @@ -0,0 +1,873 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// The operation to create or update a virtual machine instance. Please note some properties can be set only during virtual + /// machine instance creation. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzStackHCIVmVirtualMachine_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to create or update a virtual machine instance. Please note some properties can be set only during virtual machine instance creation.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", ApiVersion = "2023-09-01-preview")] + public partial class NewAzStackHCIVmVirtualMachine_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The virtual machine instance resource definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance _virtualMachineInstanceBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstance(); + + /// AdminPassword - admin password + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "AdminPassword - admin password")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"AdminPassword - admin password", + SerializedName = @"adminPassword", + PossibleTypes = new [] { typeof(string) })] + public string AdminPassword { get => _virtualMachineInstanceBody.OSProfileAdminPassword ?? null; set => _virtualMachineInstanceBody.OSProfileAdminPassword = value; } + + /// AdminUsername - admin username + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "AdminUsername - admin username")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"AdminUsername - admin username", + SerializedName = @"adminUsername", + PossibleTypes = new [] { typeof(string) })] + public string AdminUsername { get => _virtualMachineInstanceBody.OSProfileAdminUsername ?? null; set => _virtualMachineInstanceBody.OSProfileAdminUsername = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// ComputerName - name of the compute + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "ComputerName - name of the compute")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ComputerName - name of the compute", + SerializedName = @"computerName", + PossibleTypes = new [] { typeof(string) })] + public string ComputerName { get => _virtualMachineInstanceBody.OSProfileComputerName ?? null; set => _virtualMachineInstanceBody.OSProfileComputerName = value; } + + /// The name of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string CustomLocationId { get => _virtualMachineInstanceBody.ExtendedLocationName ?? null; set => _virtualMachineInstanceBody.ExtendedLocationName = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// + /// DisablePasswordAuthentication - whether password authentication should be disabled + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "DisablePasswordAuthentication - whether password authentication should be disabled")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"DisablePasswordAuthentication - whether password authentication should be disabled", + SerializedName = @"disablePasswordAuthentication", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter DisablePasswordAuthentication { get => _virtualMachineInstanceBody.LinuxConfigurationDisablePasswordAuthentication ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.LinuxConfigurationDisablePasswordAuthentication = value; } + + /// . + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @".", + SerializedName = @"maximumMemoryMB", + PossibleTypes = new [] { typeof(long) })] + public long DynamicMemoryMaximumMemoryInMb { get => _virtualMachineInstanceBody.DynamicMemoryConfigMaximumMemoryMb ?? default(long); set => _virtualMachineInstanceBody.DynamicMemoryConfigMaximumMemoryMb = value; } + + /// . + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @".", + SerializedName = @"minimumMemoryMB", + PossibleTypes = new [] { typeof(long) })] + public long DynamicMemoryMinimumMemoryInMb { get => _virtualMachineInstanceBody.DynamicMemoryConfigMinimumMemoryMb ?? default(long); set => _virtualMachineInstanceBody.DynamicMemoryConfigMinimumMemoryMb = value; } + + /// + /// Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage + /// of the total memory that the virtual machine instance is thought to need. This only applies to virtual systems with dynamic + /// memory enabled. This property can be in the range of 5 to 2000. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage of the total memory that the virtual machine instance is thought to need. This only applies to virtual systems with dynamic memory enabled. This property can be in the range of 5 to 2000.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage of the total memory that the virtual machine instance is thought to need. This only applies to virtual systems with dynamic memory enabled. This property can be in the range of 5 to 2000.", + SerializedName = @"targetMemoryBuffer", + PossibleTypes = new [] { typeof(int) })] + public int DynamicMemoryTargetBuffer { get => _virtualMachineInstanceBody.DynamicMemoryConfigTargetMemoryBuffer ?? default(int); set => _virtualMachineInstanceBody.DynamicMemoryConfigTargetMemoryBuffer = value; } + + /// Whether to EnableAutomaticUpdates on the machine + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Whether to EnableAutomaticUpdates on the machine")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Whether to EnableAutomaticUpdates on the machine", + SerializedName = @"enableAutomaticUpdates", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter EnableAutomaticUpdate { get => _virtualMachineInstanceBody.WindowConfigurationEnableAutomaticUpdate ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.WindowConfigurationEnableAutomaticUpdate = value; } + + /// . + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @".", + SerializedName = @"enableTPM", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter EnableTpm { get => _virtualMachineInstanceBody.SecurityProfileEnableTpm ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.SecurityProfileEnableTpm = value; } + + /// The type of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the extended location.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"""CustomLocation""")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.DoNotExport] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes ExtendedLocationType { get => _virtualMachineInstanceBody.ExtendedLocationType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes)""); set => _virtualMachineInstanceBody.ExtendedLocationType = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// The HTTP proxy server endpoint to use. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The HTTP proxy server endpoint to use.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The HTTP proxy server endpoint to use.", + SerializedName = @"httpProxy", + PossibleTypes = new [] { typeof(string) })] + public string HttpProxyConfigHttpProxy { get => _virtualMachineInstanceBody.HttpProxyConfigHttpProxy ?? null; set => _virtualMachineInstanceBody.HttpProxyConfigHttpProxy = value; } + + /// The HTTPS proxy server endpoint to use. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The HTTPS proxy server endpoint to use.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The HTTPS proxy server endpoint to use.", + SerializedName = @"httpsProxy", + PossibleTypes = new [] { typeof(string) })] + public string HttpProxyConfigHttpsProxy { get => _virtualMachineInstanceBody.HttpProxyConfigHttpsProxy ?? null; set => _virtualMachineInstanceBody.HttpProxyConfigHttpsProxy = value; } + + /// The endpoints that should not go through proxy. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The endpoints that should not go through proxy.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The endpoints that should not go through proxy.", + SerializedName = @"noProxy", + PossibleTypes = new [] { typeof(string) })] + public string[] HttpProxyConfigNoProxy { get => _virtualMachineInstanceBody.HttpProxyConfigNoProxy ?? null /* arrayOf */; set => _virtualMachineInstanceBody.HttpProxyConfigNoProxy = value; } + + /// Alternative CA cert to use for connecting to proxy servers. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Alternative CA cert to use for connecting to proxy servers.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Alternative CA cert to use for connecting to proxy servers.", + SerializedName = @"trustedCa", + PossibleTypes = new [] { typeof(string) })] + public string HttpProxyConfigTrustedCa { get => _virtualMachineInstanceBody.HttpProxyConfigTrustedCa ?? null; set => _virtualMachineInstanceBody.HttpProxyConfigTrustedCa = value; } + + /// The identity type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The identity type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identity type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType IdentityType { get => _virtualMachineInstanceBody.IdentityType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType)""); set => _virtualMachineInstanceBody.IdentityType = value; } + + /// Resource ID of the image + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource ID of the image")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource ID of the image", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + public string ImageId { get => _virtualMachineInstanceBody.ImageReferenceId ?? null; set => _virtualMachineInstanceBody.ImageReferenceId = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter LinuxConfigurationProvisionVMAgent { get => _virtualMachineInstanceBody.LinuxConfigurationProvisionVMAgent ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.LinuxConfigurationProvisionVMAgent = value; } + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter LinuxConfigurationProvisionVMConfigAgent { get => _virtualMachineInstanceBody.LinuxConfigurationProvisionVMConfigAgent ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.LinuxConfigurationProvisionVMConfigAgent = value; } + + /// The list of SSH public keys used to authenticate with linux based VMs. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The list of SSH public keys used to authenticate with linux based VMs.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of SSH public keys used to authenticate with linux based VMs.", + SerializedName = @"publicKeys", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] LinuxConfigurationSshPublicKey { get => _virtualMachineInstanceBody.LinuxConfigurationSshPublicKey ?? null /* arrayOf */; set => _virtualMachineInstanceBody.LinuxConfigurationSshPublicKey = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance", + SerializedName = @"networkInterfaces", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem[] NetworkProfileNetworkInterface { get => _virtualMachineInstanceBody.NetworkProfileNetworkInterface ?? null /* arrayOf */; set => _virtualMachineInstanceBody.NetworkProfileNetworkInterface = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// Resource ID of the OS disk + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource ID of the OS disk")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource ID of the OS disk", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + public string OSDiskId { get => _virtualMachineInstanceBody.OSDiskId ?? null; set => _virtualMachineInstanceBody.OSDiskId = value; } + + /// + /// This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or + /// a specialized VHD. Possible values are: **Windows,** **Linux.** + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. Possible values are: **Windows,** **Linux.**")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. Possible values are: **Windows,** **Linux.**", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes OSDiskOstype { get => _virtualMachineInstanceBody.OSDiskOstype ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes)""); set => _virtualMachineInstanceBody.OSDiskOstype = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Unique identifier defined by ARC to identify the guest of the VM. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Unique identifier defined by ARC to identify the guest of the VM.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Unique identifier defined by ARC to identify the guest of the VM.", + SerializedName = @"resourceUid", + PossibleTypes = new [] { typeof(string) })] + public string ResourceUid { get => _virtualMachineInstanceBody.ResourceUid ?? null; set => _virtualMachineInstanceBody.ResourceUid = value; } + + /// Backing field for property. + private string _resourceUri; + + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.", + SerializedName = @"resourceUri", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceUri { get => this._resourceUri; set => this._resourceUri = value; } + + /// + /// Specifies whether secure boot should be enabled on the virtual machine instance. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies whether secure boot should be enabled on the virtual machine instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies whether secure boot should be enabled on the virtual machine instance.", + SerializedName = @"secureBootEnabled", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter SecureBootEnabled { get => _virtualMachineInstanceBody.UefiSettingSecureBootEnabled ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.UefiSettingSecureBootEnabled = value; } + + /// + /// Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for SecurityType + /// to function. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for SecurityType to function.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for SecurityType to function.", + SerializedName = @"securityType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes SecurityProfileSecurityType { get => _virtualMachineInstanceBody.SecurityProfileSecurityType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes)""); set => _virtualMachineInstanceBody.SecurityProfileSecurityType = value; } + + /// Id of the storage container that hosts the VM configuration file + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Id of the storage container that hosts the VM configuration file")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Id of the storage container that hosts the VM configuration file", + SerializedName = @"vmConfigStoragePathId", + PossibleTypes = new [] { typeof(string) })] + public string StoragePathId { get => _virtualMachineInstanceBody.StorageProfileVMConfigStoragePathId ?? null; set => _virtualMachineInstanceBody.StorageProfileVMConfigStoragePathId = value; } + + /// adds data disks to the virtual machine instance + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "adds data disks to the virtual machine instance")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"adds data disks to the virtual machine instance", + SerializedName = @"dataDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem[] StorageProfileDataDisk { get => _virtualMachineInstanceBody.StorageProfileDataDisk ?? null /* arrayOf */; set => _virtualMachineInstanceBody.StorageProfileDataDisk = value; } + + /// TimeZone for the virtual machine instance + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "TimeZone for the virtual machine instance")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"TimeZone for the virtual machine instance", + SerializedName = @"timeZone", + PossibleTypes = new [] { typeof(string) })] + public string TimeZone { get => _virtualMachineInstanceBody.WindowConfigurationTimeZone ?? null; set => _virtualMachineInstanceBody.WindowConfigurationTimeZone = value; } + + /// RAM in MB for the virtual machine instance + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "RAM in MB for the virtual machine instance")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"RAM in MB for the virtual machine instance", + SerializedName = @"memoryMB", + PossibleTypes = new [] { typeof(long) })] + public long VmMemory { get => _virtualMachineInstanceBody.HardwareProfileMemoryMb ?? default(long); set => _virtualMachineInstanceBody.HardwareProfileMemoryMb = value; } + + /// number of processors for the virtual machine instance + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "number of processors for the virtual machine instance")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"number of processors for the virtual machine instance", + SerializedName = @"processors", + PossibleTypes = new [] { typeof(int) })] + public int VmProcessor { get => _virtualMachineInstanceBody.HardwareProfileProcessor ?? default(int); set => _virtualMachineInstanceBody.HardwareProfileProcessor = value; } + + /// . + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @".", + SerializedName = @"vmSize", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum VmSize { get => _virtualMachineInstanceBody.HardwareProfileVMSize ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum)""); set => _virtualMachineInstanceBody.HardwareProfileVMSize = value; } + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter WindowConfigurationProvisionVMAgent { get => _virtualMachineInstanceBody.WindowConfigurationProvisionVMAgent ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.WindowConfigurationProvisionVMAgent = value; } + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter WindowConfigurationProvisionVMConfigAgent { get => _virtualMachineInstanceBody.WindowConfigurationProvisionVMConfigAgent ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.WindowConfigurationProvisionVMConfigAgent = value; } + + /// The list of SSH public keys used to authenticate with linux based VMs. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The list of SSH public keys used to authenticate with linux based VMs.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of SSH public keys used to authenticate with linux based VMs.", + SerializedName = @"publicKeys", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] WindowsConfigurationSshPublicKey { get => _virtualMachineInstanceBody.WindowsConfigurationSshPublicKey ?? null /* arrayOf */; set => _virtualMachineInstanceBody.WindowsConfigurationSshPublicKey = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzStackHCIVmVirtualMachine_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.NewAzStackHCIVmVirtualMachine_CreateExpanded Clone() + { + var clone = new NewAzStackHCIVmVirtualMachine_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._virtualMachineInstanceBody = this._virtualMachineInstanceBody; + clone.ResourceUri = this.ResourceUri; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzStackHCIVmVirtualMachine_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualMachineInstancesCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualMachineInstancesCreateOrUpdate(ResourceUri, _virtualMachineInstanceBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri,body=_virtualMachineInstanceBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri, body=_virtualMachineInstanceBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri, body=_virtualMachineInstanceBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmGalleryImage_Delete.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmGalleryImage_Delete.cs new file mode 100644 index 000000000000..dbe3a1641412 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmGalleryImage_Delete.cs @@ -0,0 +1,512 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to delete a gallery image. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStackHCIVmGalleryImage_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to delete a gallery image.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}", ApiVersion = "2023-09-01-preview")] + public partial class RemoveAzStackHCIVmGalleryImage_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the gallery image + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the gallery image")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the gallery image", + SerializedName = @"galleryImageName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("GalleryImageName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStackHCIVmGalleryImage_Delete + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.RemoveAzStackHCIVmGalleryImage_Delete Clone() + { + var clone = new RemoveAzStackHCIVmGalleryImage_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'GalleryImagesDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GalleryImagesDelete(SubscriptionId, ResourceGroupName, Name, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzStackHCIVmGalleryImage_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmGalleryImage_DeleteViaIdentity.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmGalleryImage_DeleteViaIdentity.cs new file mode 100644 index 000000000000..41b0caaa4f94 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmGalleryImage_DeleteViaIdentity.cs @@ -0,0 +1,490 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to delete a gallery image. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStackHCIVmGalleryImage_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to delete a gallery image.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}", ApiVersion = "2023-09-01-preview")] + public partial class RemoveAzStackHCIVmGalleryImage_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStackHCIVmGalleryImage_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.RemoveAzStackHCIVmGalleryImage_DeleteViaIdentity Clone() + { + var clone = new RemoveAzStackHCIVmGalleryImage_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'GalleryImagesDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.GalleryImagesDeleteViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.GalleryImageName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.GalleryImageName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.GalleryImagesDelete(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.GalleryImageName ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzStackHCIVmGalleryImage_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmGuestAgent_Delete.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmGuestAgent_Delete.cs new file mode 100644 index 000000000000..9c64e3805327 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmGuestAgent_Delete.cs @@ -0,0 +1,445 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// Implements GuestAgent DELETE method. + /// + /// [OpenAPI] Delete=>DELETE:"/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStackHCIVmGuestAgent_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Implements GuestAgent DELETE method.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default", ApiVersion = "2023-09-01-preview")] + public partial class RemoveAzStackHCIVmGuestAgent_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceUri; + + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.", + SerializedName = @"resourceUri", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceUri { get => this._resourceUri; set => this._resourceUri = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStackHCIVmGuestAgent_Delete + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.RemoveAzStackHCIVmGuestAgent_Delete Clone() + { + var clone = new RemoveAzStackHCIVmGuestAgent_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceUri = this.ResourceUri; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'GuestAgentDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GuestAgentDelete(ResourceUri, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzStackHCIVmGuestAgent_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmGuestAgent_DeleteViaIdentity.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmGuestAgent_DeleteViaIdentity.cs new file mode 100644 index 000000000000..95a5938fae91 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmGuestAgent_DeleteViaIdentity.cs @@ -0,0 +1,448 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// Implements GuestAgent DELETE method. + /// + /// [OpenAPI] Delete=>DELETE:"/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStackHCIVmGuestAgent_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"Implements GuestAgent DELETE method.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default", ApiVersion = "2023-09-01-preview")] + public partial class RemoveAzStackHCIVmGuestAgent_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStackHCIVmGuestAgent_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.RemoveAzStackHCIVmGuestAgent_DeleteViaIdentity Clone() + { + var clone = new RemoveAzStackHCIVmGuestAgent_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'GuestAgentDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.GuestAgentDeleteViaIdentity(InputObject.Id, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceUri) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceUri"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.GuestAgentDelete(InputObject.ResourceUri ?? null, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzStackHCIVmGuestAgent_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmLogicalNetwork_Delete.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmLogicalNetwork_Delete.cs new file mode 100644 index 000000000000..ff2545ab5da9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmLogicalNetwork_Delete.cs @@ -0,0 +1,512 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to delete a logical network. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStackHCIVmLogicalNetwork_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to delete a logical network.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}", ApiVersion = "2023-09-01-preview")] + public partial class RemoveAzStackHCIVmLogicalNetwork_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the logical network + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the logical network")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the logical network", + SerializedName = @"logicalNetworkName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("LogicalNetworkName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStackHCIVmLogicalNetwork_Delete + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.RemoveAzStackHCIVmLogicalNetwork_Delete Clone() + { + var clone = new RemoveAzStackHCIVmLogicalNetwork_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'LogicalNetworksDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.LogicalNetworksDelete(SubscriptionId, ResourceGroupName, Name, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzStackHCIVmLogicalNetwork_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmLogicalNetwork_DeleteViaIdentity.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmLogicalNetwork_DeleteViaIdentity.cs new file mode 100644 index 000000000000..67c5ba7f5d20 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmLogicalNetwork_DeleteViaIdentity.cs @@ -0,0 +1,490 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to delete a logical network. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStackHCIVmLogicalNetwork_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to delete a logical network.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}", ApiVersion = "2023-09-01-preview")] + public partial class RemoveAzStackHCIVmLogicalNetwork_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStackHCIVmLogicalNetwork_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.RemoveAzStackHCIVmLogicalNetwork_DeleteViaIdentity Clone() + { + var clone = new RemoveAzStackHCIVmLogicalNetwork_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'LogicalNetworksDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.LogicalNetworksDeleteViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.LogicalNetworkName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.LogicalNetworkName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.LogicalNetworksDelete(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.LogicalNetworkName ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzStackHCIVmLogicalNetwork_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmMachineExtension_Delete.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmMachineExtension_Delete.cs new file mode 100644 index 000000000000..ff558b5b368d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmMachineExtension_Delete.cs @@ -0,0 +1,526 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to delete the extension. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStackHCIVmMachineExtension_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to delete the extension.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}", ApiVersion = "2023-03-15-preview")] + public partial class RemoveAzStackHCIVmMachineExtension_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _extensionName; + + /// The name of the machine extension. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the machine extension.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the machine extension.", + SerializedName = @"extensionName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ExtensionName { get => this._extensionName; set => this._extensionName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _machineName; + + /// The name of the machine where the extension should be deleted. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the machine where the extension should be deleted.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the machine where the extension should be deleted.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string MachineName { get => this._machineName; set => this._machineName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStackHCIVmMachineExtension_Delete + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.RemoveAzStackHCIVmMachineExtension_Delete Clone() + { + var clone = new RemoveAzStackHCIVmMachineExtension_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceGroupName = this.ResourceGroupName; + clone.MachineName = this.MachineName; + clone.ExtensionName = this.ExtensionName; + clone.SubscriptionId = this.SubscriptionId; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'MachineExtensionsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MachineExtensionsDelete(ResourceGroupName, MachineName, ExtensionName, SubscriptionId, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,MachineName=MachineName,ExtensionName=ExtensionName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzStackHCIVmMachineExtension_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, MachineName=MachineName, ExtensionName=ExtensionName, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, MachineName=MachineName, ExtensionName=ExtensionName, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmMachineExtension_DeleteViaIdentity.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmMachineExtension_DeleteViaIdentity.cs new file mode 100644 index 000000000000..8057162107a3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmMachineExtension_DeleteViaIdentity.cs @@ -0,0 +1,494 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to delete the extension. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStackHCIVmMachineExtension_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to delete the extension.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}", ApiVersion = "2023-03-15-preview")] + public partial class RemoveAzStackHCIVmMachineExtension_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStackHCIVmMachineExtension_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.RemoveAzStackHCIVmMachineExtension_DeleteViaIdentity Clone() + { + var clone = new RemoveAzStackHCIVmMachineExtension_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'MachineExtensionsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.MachineExtensionsDeleteViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MachineName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MachineName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ExtensionName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ExtensionName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.MachineExtensionsDelete(InputObject.ResourceGroupName ?? null, InputObject.MachineName ?? null, InputObject.ExtensionName ?? null, InputObject.SubscriptionId ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzStackHCIVmMachineExtension_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmMachine_Delete.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmMachine_Delete.cs new file mode 100644 index 000000000000..42de842ee6e4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmMachine_Delete.cs @@ -0,0 +1,446 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to delete a hybrid machine. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStackHCIVmMachine_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to delete a hybrid machine.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}", ApiVersion = "2023-03-15-preview")] + public partial class RemoveAzStackHCIVmMachine_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the hybrid machine. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the hybrid machine.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the hybrid machine.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("MachineName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'MachinesDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MachinesDelete(SubscriptionId, ResourceGroupName, Name, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzStackHCIVmMachine_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmMachine_DeleteViaIdentity.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmMachine_DeleteViaIdentity.cs new file mode 100644 index 000000000000..00aba708847c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmMachine_DeleteViaIdentity.cs @@ -0,0 +1,427 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to delete a hybrid machine. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStackHCIVmMachine_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to delete a hybrid machine.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}", ApiVersion = "2023-03-15-preview")] + public partial class RemoveAzStackHCIVmMachine_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'MachinesDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.MachinesDeleteViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MachineName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MachineName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.MachinesDelete(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.MachineName ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzStackHCIVmMachine_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmMarketplaceGalleryImage_Delete.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmMarketplaceGalleryImage_Delete.cs new file mode 100644 index 000000000000..28924ef2a044 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmMarketplaceGalleryImage_Delete.cs @@ -0,0 +1,512 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to delete a marketplace gallery image. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStackHCIVmMarketplaceGalleryImage_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to delete a marketplace gallery image.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}", ApiVersion = "2023-09-01-preview")] + public partial class RemoveAzStackHCIVmMarketplaceGalleryImage_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the marketplace gallery image + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the marketplace gallery image")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the marketplace gallery image", + SerializedName = @"marketplaceGalleryImageName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("MarketplaceGalleryImageName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStackHCIVmMarketplaceGalleryImage_Delete + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.RemoveAzStackHCIVmMarketplaceGalleryImage_Delete Clone() + { + var clone = new RemoveAzStackHCIVmMarketplaceGalleryImage_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'MarketplaceGalleryImagesDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MarketplaceGalleryImagesDelete(SubscriptionId, ResourceGroupName, Name, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzStackHCIVmMarketplaceGalleryImage_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmMarketplaceGalleryImage_DeleteViaIdentity.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmMarketplaceGalleryImage_DeleteViaIdentity.cs new file mode 100644 index 000000000000..8282b999c871 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmMarketplaceGalleryImage_DeleteViaIdentity.cs @@ -0,0 +1,492 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to delete a marketplace gallery image. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStackHCIVmMarketplaceGalleryImage_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to delete a marketplace gallery image.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}", ApiVersion = "2023-09-01-preview")] + public partial class RemoveAzStackHCIVmMarketplaceGalleryImage_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzStackHCIVmMarketplaceGalleryImage_DeleteViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.RemoveAzStackHCIVmMarketplaceGalleryImage_DeleteViaIdentity Clone() + { + var clone = new RemoveAzStackHCIVmMarketplaceGalleryImage_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'MarketplaceGalleryImagesDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.MarketplaceGalleryImagesDeleteViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MarketplaceGalleryImageName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MarketplaceGalleryImageName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.MarketplaceGalleryImagesDelete(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.MarketplaceGalleryImageName ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzStackHCIVmMarketplaceGalleryImage_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmNetworkInterface_Delete.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmNetworkInterface_Delete.cs new file mode 100644 index 000000000000..34012280ef7c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmNetworkInterface_Delete.cs @@ -0,0 +1,512 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to delete a network interface. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStackHCIVmNetworkInterface_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to delete a network interface.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}", ApiVersion = "2023-09-01-preview")] + public partial class RemoveAzStackHCIVmNetworkInterface_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the network interface + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the network interface")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the network interface", + SerializedName = @"networkInterfaceName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("NetworkInterfaceName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStackHCIVmNetworkInterface_Delete + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.RemoveAzStackHCIVmNetworkInterface_Delete Clone() + { + var clone = new RemoveAzStackHCIVmNetworkInterface_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'NetworkInterfacesDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.NetworkInterfacesDelete(SubscriptionId, ResourceGroupName, Name, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzStackHCIVmNetworkInterface_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmNetworkInterface_DeleteViaIdentity.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmNetworkInterface_DeleteViaIdentity.cs new file mode 100644 index 000000000000..b79939b738af --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmNetworkInterface_DeleteViaIdentity.cs @@ -0,0 +1,490 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to delete a network interface. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStackHCIVmNetworkInterface_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to delete a network interface.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}", ApiVersion = "2023-09-01-preview")] + public partial class RemoveAzStackHCIVmNetworkInterface_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStackHCIVmNetworkInterface_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.RemoveAzStackHCIVmNetworkInterface_DeleteViaIdentity Clone() + { + var clone = new RemoveAzStackHCIVmNetworkInterface_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'NetworkInterfacesDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.NetworkInterfacesDeleteViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.NetworkInterfaceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.NetworkInterfaceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.NetworkInterfacesDelete(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.NetworkInterfaceName ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzStackHCIVmNetworkInterface_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmStoragePath_Delete.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmStoragePath_Delete.cs new file mode 100644 index 000000000000..d021a359108a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmStoragePath_Delete.cs @@ -0,0 +1,512 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to delete a storage container. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStackHCIVmStoragePath_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to delete a storage container.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}", ApiVersion = "2023-09-01-preview")] + public partial class RemoveAzStackHCIVmStoragePath_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the storage container + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the storage container")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the storage container", + SerializedName = @"storageContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("StorageContainerName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStackHCIVmStoragePath_Delete + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.RemoveAzStackHCIVmStoragePath_Delete Clone() + { + var clone = new RemoveAzStackHCIVmStoragePath_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'StorageContainersDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.StorageContainersDelete(SubscriptionId, ResourceGroupName, Name, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzStackHCIVmStoragePath_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmStoragePath_DeleteViaIdentity.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmStoragePath_DeleteViaIdentity.cs new file mode 100644 index 000000000000..0a7e900280d2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmStoragePath_DeleteViaIdentity.cs @@ -0,0 +1,490 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to delete a storage container. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStackHCIVmStoragePath_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to delete a storage container.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}", ApiVersion = "2023-09-01-preview")] + public partial class RemoveAzStackHCIVmStoragePath_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStackHCIVmStoragePath_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.RemoveAzStackHCIVmStoragePath_DeleteViaIdentity Clone() + { + var clone = new RemoveAzStackHCIVmStoragePath_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'StorageContainersDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.StorageContainersDeleteViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.StorageContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.StorageContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.StorageContainersDelete(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.StorageContainerName ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzStackHCIVmStoragePath_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmVirtualHardDisk_Delete.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmVirtualHardDisk_Delete.cs new file mode 100644 index 000000000000..6730ba12020e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmVirtualHardDisk_Delete.cs @@ -0,0 +1,512 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to delete a virtual hard disk. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStackHCIVmVirtualHardDisk_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to delete a virtual hard disk.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}", ApiVersion = "2023-09-01-preview")] + public partial class RemoveAzStackHCIVmVirtualHardDisk_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the virtual hard disk + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the virtual hard disk")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the virtual hard disk", + SerializedName = @"virtualHardDiskName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("VirtualHardDiskName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStackHCIVmVirtualHardDisk_Delete + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.RemoveAzStackHCIVmVirtualHardDisk_Delete Clone() + { + var clone = new RemoveAzStackHCIVmVirtualHardDisk_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualHardDisksDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualHardDisksDelete(SubscriptionId, ResourceGroupName, Name, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzStackHCIVmVirtualHardDisk_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmVirtualHardDisk_DeleteViaIdentity.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmVirtualHardDisk_DeleteViaIdentity.cs new file mode 100644 index 000000000000..cccb02734a92 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmVirtualHardDisk_DeleteViaIdentity.cs @@ -0,0 +1,490 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to delete a virtual hard disk. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStackHCIVmVirtualHardDisk_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to delete a virtual hard disk.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}", ApiVersion = "2023-09-01-preview")] + public partial class RemoveAzStackHCIVmVirtualHardDisk_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStackHCIVmVirtualHardDisk_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.RemoveAzStackHCIVmVirtualHardDisk_DeleteViaIdentity Clone() + { + var clone = new RemoveAzStackHCIVmVirtualHardDisk_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualHardDisksDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.VirtualHardDisksDeleteViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.VirtualHardDiskName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VirtualHardDiskName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.VirtualHardDisksDelete(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.VirtualHardDiskName ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzStackHCIVmVirtualHardDisk_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmVirtualMachine_Delete.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmVirtualMachine_Delete.cs new file mode 100644 index 000000000000..c485cbaec07f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmVirtualMachine_Delete.cs @@ -0,0 +1,479 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to delete a virtual machine instance. + /// + /// [OpenAPI] Delete=>DELETE:"/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStackHCIVmVirtualMachine_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to delete a virtual machine instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", ApiVersion = "2023-09-01-preview")] + public partial class RemoveAzStackHCIVmVirtualMachine_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceUri; + + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.", + SerializedName = @"resourceUri", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceUri { get => this._resourceUri; set => this._resourceUri = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStackHCIVmVirtualMachine_Delete + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.RemoveAzStackHCIVmVirtualMachine_Delete Clone() + { + var clone = new RemoveAzStackHCIVmVirtualMachine_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceUri = this.ResourceUri; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualMachineInstancesDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualMachineInstancesDelete(ResourceUri, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzStackHCIVmVirtualMachine_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmVirtualMachine_DeleteViaIdentity.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmVirtualMachine_DeleteViaIdentity.cs new file mode 100644 index 000000000000..ceaec16455a4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RemoveAzStackHCIVmVirtualMachine_DeleteViaIdentity.cs @@ -0,0 +1,482 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to delete a virtual machine instance. + /// + /// [OpenAPI] Delete=>DELETE:"/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzStackHCIVmVirtualMachine_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to delete a virtual machine instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", ApiVersion = "2023-09-01-preview")] + public partial class RemoveAzStackHCIVmVirtualMachine_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzStackHCIVmVirtualMachine_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.RemoveAzStackHCIVmVirtualMachine_DeleteViaIdentity Clone() + { + var clone = new RemoveAzStackHCIVmVirtualMachine_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualMachineInstancesDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.VirtualMachineInstancesDeleteViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceUri) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceUri"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.VirtualMachineInstancesDelete(InputObject.ResourceUri ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzStackHCIVmVirtualMachine_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RestartAzStackHCIVmVirtualMachine_Restart.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RestartAzStackHCIVmVirtualMachine_Restart.cs new file mode 100644 index 000000000000..61ee2ca598aa --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RestartAzStackHCIVmVirtualMachine_Restart.cs @@ -0,0 +1,440 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to restart a virtual machine instance. + /// + /// [OpenAPI] Restart=>POST:"/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/restart" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Restart, @"AzStackHCIVmVirtualMachine_Restart", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to restart a virtual machine instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/restart", ApiVersion = "2023-09-01-preview")] + public partial class RestartAzStackHCIVmVirtualMachine_Restart : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceUri; + + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.", + SerializedName = @"resourceUri", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceUri { get => this._resourceUri; set => this._resourceUri = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RestartAzStackHCIVmVirtualMachine_Restart + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.RestartAzStackHCIVmVirtualMachine_Restart Clone() + { + var clone = new RestartAzStackHCIVmVirtualMachine_Restart(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceUri = this.ResourceUri; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualMachineInstancesRestart' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualMachineInstancesRestart(ResourceUri, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RestartAzStackHCIVmVirtualMachine_Restart() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RestartAzStackHCIVmVirtualMachine_RestartViaIdentity.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RestartAzStackHCIVmVirtualMachine_RestartViaIdentity.cs new file mode 100644 index 000000000000..a451ef9bc18c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/RestartAzStackHCIVmVirtualMachine_RestartViaIdentity.cs @@ -0,0 +1,443 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to restart a virtual machine instance. + /// + /// [OpenAPI] Restart=>POST:"/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/restart" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Restart, @"AzStackHCIVmVirtualMachine_RestartViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to restart a virtual machine instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/restart", ApiVersion = "2023-09-01-preview")] + public partial class RestartAzStackHCIVmVirtualMachine_RestartViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RestartAzStackHCIVmVirtualMachine_RestartViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.RestartAzStackHCIVmVirtualMachine_RestartViaIdentity Clone() + { + var clone = new RestartAzStackHCIVmVirtualMachine_RestartViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualMachineInstancesRestart' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.VirtualMachineInstancesRestartViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceUri) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceUri"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.VirtualMachineInstancesRestart(InputObject.ResourceUri ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RestartAzStackHCIVmVirtualMachine_RestartViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmGalleryImage_UpdateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmGalleryImage_UpdateExpanded.cs new file mode 100644 index 000000000000..6d968dc8c39e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmGalleryImage_UpdateExpanded.cs @@ -0,0 +1,629 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// The operation to create or update a gallery image. Please note some properties can be set only during gallery image creation. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzStackHCIVmGalleryImage_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to create or update a gallery image. Please note some properties can be set only during gallery image creation.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}", ApiVersion = "2023-09-01-preview")] + public partial class SetAzStackHCIVmGalleryImage_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The gallery images resource definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages _galleryImagesBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImages(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure]")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure]", + SerializedName = @"cloudInitDataSource", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource CloudInitDataSource { get => _galleryImagesBody.CloudInitDataSource ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource)""); set => _galleryImagesBody.CloudInitDataSource = value; } + + /// Storage ContainerID of the storage container to be used for gallery image + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Storage ContainerID of the storage container to be used for gallery image")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Storage ContainerID of the storage container to be used for gallery image", + SerializedName = @"containerId", + PossibleTypes = new [] { typeof(string) })] + public string ContainerId { get => _galleryImagesBody.ContainerId ?? null; set => _galleryImagesBody.ContainerId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The name of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string ExtendedLocationName { get => _galleryImagesBody.ExtendedLocationName ?? null; set => _galleryImagesBody.ExtendedLocationName = value; } + + /// The type of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the extended location.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes ExtendedLocationType { get => _galleryImagesBody.ExtendedLocationType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes)""); set => _galleryImagesBody.ExtendedLocationType = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// The hypervisor generation of the Virtual Machine [V1, V2] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The hypervisor generation of the Virtual Machine [V1, V2]")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The hypervisor generation of the Virtual Machine [V1, V2]", + SerializedName = @"hyperVGeneration", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration HyperVGeneration { get => _galleryImagesBody.HyperVGeneration ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration)""); set => _galleryImagesBody.HyperVGeneration = value; } + + /// The name of the gallery image definition offer. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the gallery image definition offer.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition offer.", + SerializedName = @"offer", + PossibleTypes = new [] { typeof(string) })] + public string IdentifierOffer { get => _galleryImagesBody.IdentifierOffer ?? null; set => _galleryImagesBody.IdentifierOffer = value; } + + /// The name of the gallery image definition publisher. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the gallery image definition publisher.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition publisher.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + public string IdentifierPublisher { get => _galleryImagesBody.IdentifierPublisher ?? null; set => _galleryImagesBody.IdentifierPublisher = value; } + + /// The name of the gallery image definition SKU. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the gallery image definition SKU.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition SKU.", + SerializedName = @"sku", + PossibleTypes = new [] { typeof(string) })] + public string IdentifierSku { get => _galleryImagesBody.IdentifierSku ?? null; set => _galleryImagesBody.IdentifierSku = value; } + + /// location of the image the gallery image should be created from + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "location of the image the gallery image should be created from")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"location of the image the gallery image should be created from", + SerializedName = @"imagePath", + PossibleTypes = new [] { typeof(string) })] + public string ImagePath { get => _galleryImagesBody.ImagePath ?? null; set => _galleryImagesBody.ImagePath = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _galleryImagesBody.Location ?? null; set => _galleryImagesBody.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the gallery image + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the gallery image")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the gallery image", + SerializedName = @"galleryImageName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("GalleryImageName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// Operating system type that the gallery image uses [Windows, Linux] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Operating system type that the gallery image uses [Windows, Linux]")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Operating system type that the gallery image uses [Windows, Linux]", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes OSType { get => _galleryImagesBody.OSType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes)""); set => _galleryImagesBody.OSType = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => _galleryImagesBody.Tag ?? null /* object */; set => _galleryImagesBody.Tag = value; } + + /// This is the version of the gallery image. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "This is the version of the gallery image.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"This is the version of the gallery image.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string VersionName { get => _galleryImagesBody.VersionName ?? null; set => _galleryImagesBody.VersionName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of SetAzStackHCIVmGalleryImage_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.SetAzStackHCIVmGalleryImage_UpdateExpanded Clone() + { + var clone = new SetAzStackHCIVmGalleryImage_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._galleryImagesBody = this._galleryImagesBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'GalleryImagesCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GalleryImagesCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, _galleryImagesBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_galleryImagesBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public SetAzStackHCIVmGalleryImage_UpdateExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_galleryImagesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_galleryImagesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmLogicalNetwork_UpdateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmLogicalNetwork_UpdateExpanded.cs new file mode 100644 index 000000000000..63c5a958707e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmLogicalNetwork_UpdateExpanded.cs @@ -0,0 +1,561 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// The operation to create or update a logical network. Please note some properties can be set only during logical network + /// creation. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzStackHCIVmLogicalNetwork_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to create or update a logical network. Please note some properties can be set only during logical network creation.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}", ApiVersion = "2023-09-01-preview")] + public partial class SetAzStackHCIVmLogicalNetwork_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The logical network resource definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks _logicalNetworksBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworks(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The list of DNS servers IP addresses. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The list of DNS servers IP addresses.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of DNS servers IP addresses.", + SerializedName = @"dnsServers", + PossibleTypes = new [] { typeof(string) })] + public string[] DhcpOptionDnsServer { get => _logicalNetworksBody.DhcpOptionDnsServer ?? null /* arrayOf */; set => _logicalNetworksBody.DhcpOptionDnsServer = value; } + + /// The name of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string ExtendedLocationName { get => _logicalNetworksBody.ExtendedLocationName ?? null; set => _logicalNetworksBody.ExtendedLocationName = value; } + + /// The type of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the extended location.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes ExtendedLocationType { get => _logicalNetworksBody.ExtendedLocationType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes)""); set => _logicalNetworksBody.ExtendedLocationType = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _logicalNetworksBody.Location ?? null; set => _logicalNetworksBody.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the logical network + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the logical network")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the logical network", + SerializedName = @"logicalNetworkName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("LogicalNetworkName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Subnet - list of subnets under the logical network + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Subnet - list of subnets under the logical network")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Subnet - list of subnets under the logical network", + SerializedName = @"subnets", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet[] Subnet { get => _logicalNetworksBody.Subnet ?? null /* arrayOf */; set => _logicalNetworksBody.Subnet = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => _logicalNetworksBody.Tag ?? null /* object */; set => _logicalNetworksBody.Tag = value; } + + /// name of the network switch to be used for VMs + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "name of the network switch to be used for VMs")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"name of the network switch to be used for VMs", + SerializedName = @"vmSwitchName", + PossibleTypes = new [] { typeof(string) })] + public string VMSwitchName { get => _logicalNetworksBody.VMSwitchName ?? null; set => _logicalNetworksBody.VMSwitchName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of SetAzStackHCIVmLogicalNetwork_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.SetAzStackHCIVmLogicalNetwork_UpdateExpanded Clone() + { + var clone = new SetAzStackHCIVmLogicalNetwork_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._logicalNetworksBody = this._logicalNetworksBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'LogicalNetworksCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.LogicalNetworksCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, _logicalNetworksBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_logicalNetworksBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public SetAzStackHCIVmLogicalNetwork_UpdateExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_logicalNetworksBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_logicalNetworksBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmMachineExtension_UpdateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmMachineExtension_UpdateExpanded.cs new file mode 100644 index 000000000000..cb29202e9268 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmMachineExtension_UpdateExpanded.cs @@ -0,0 +1,702 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to create or update the extension. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzStackHCIVmMachineExtension_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to create or update the extension.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}", ApiVersion = "2023-03-15-preview")] + public partial class SetAzStackHCIVmMachineExtension_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Describes a Machine Extension. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension _extensionParametersBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtension(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// + /// Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, + /// however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true.", + SerializedName = @"autoUpgradeMinorVersion", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter AutoUpgradeMinorVersion { get => _extensionParametersBody.AutoUpgradeMinorVersion ?? default(global::System.Management.Automation.SwitchParameter); set => _extensionParametersBody.AutoUpgradeMinorVersion = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// + /// Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available.", + SerializedName = @"enableAutomaticUpgrade", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter EnableAutomaticUpgrade { get => _extensionParametersBody.EnableAutomaticUpgrade ?? default(global::System.Management.Automation.SwitchParameter); set => _extensionParametersBody.EnableAutomaticUpgrade = value; } + + /// Backing field for property. + private string _extensionName; + + /// The name of the machine extension. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the machine extension.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the machine extension.", + SerializedName = @"extensionName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ExtensionName { get => this._extensionName; set => this._extensionName = value; } + + /// + /// How the extension handler should be forced to update even if the extension configuration has not changed. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "How the extension handler should be forced to update even if the extension configuration has not changed.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"How the extension handler should be forced to update even if the extension configuration has not changed.", + SerializedName = @"forceUpdateTag", + PossibleTypes = new [] { typeof(string) })] + public string ForceUpdateTag { get => _extensionParametersBody.ForceUpdateTag ?? null; set => _extensionParametersBody.ForceUpdateTag = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// The machine extension name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The machine extension name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The machine extension name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string InstanceViewName { get => _extensionParametersBody.InstanceViewName ?? null; set => _extensionParametersBody.InstanceViewName = value; } + + /// Specifies the type of the extension; an example is "CustomScriptExtension". + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the type of the extension; an example is \"CustomScriptExtension\".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the type of the extension; an example is ""CustomScriptExtension"".", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + public string InstanceViewType { get => _extensionParametersBody.InstanceViewType ?? null; set => _extensionParametersBody.InstanceViewType = value; } + + /// Specifies the version of the script handler. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the version of the script handler.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the version of the script handler.", + SerializedName = @"typeHandlerVersion", + PossibleTypes = new [] { typeof(string) })] + public string InstanceViewTypeHandlerVersion { get => _extensionParametersBody.InstanceViewTypeHandlerVersion ?? null; set => _extensionParametersBody.InstanceViewTypeHandlerVersion = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _extensionParametersBody.Location ?? null; set => _extensionParametersBody.Location = value; } + + /// Backing field for property. + private string _machineName; + + /// The name of the machine where the extension should be created or updated. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the machine where the extension should be created or updated.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the machine where the extension should be created or updated.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string MachineName { get => this._machineName; set => this._machineName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// Specifies the type of the extension; an example is "CustomScriptExtension". + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the type of the extension; an example is \"CustomScriptExtension\".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the type of the extension; an example is ""CustomScriptExtension"".", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + public string PropertiesType { get => _extensionParametersBody.PropertiesType ?? null; set => _extensionParametersBody.PropertiesType = value; } + + /// + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.", + SerializedName = @"protectedSettings", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings ProtectedSetting { get => _extensionParametersBody.ProtectedSetting ?? null /* object */; set => _extensionParametersBody.ProtectedSetting = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The name of the extension handler publisher. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the extension handler publisher.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extension handler publisher.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + public string Publisher { get => _extensionParametersBody.Publisher ?? null; set => _extensionParametersBody.Publisher = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Json formatted public settings for the extension. + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Json formatted public settings for the extension.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Json formatted public settings for the extension.", + SerializedName = @"settings", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings Setting { get => _extensionParametersBody.Setting ?? null /* object */; set => _extensionParametersBody.Setting = value; } + + /// The status code. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The status code.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + public string StatusCode { get => _extensionParametersBody.StatusCode ?? null; set => _extensionParametersBody.StatusCode = value; } + + /// The short localizable label for the status. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The short localizable label for the status.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The short localizable label for the status.", + SerializedName = @"displayStatus", + PossibleTypes = new [] { typeof(string) })] + public string StatusDisplayStatus { get => _extensionParametersBody.StatusDisplayStatus ?? null; set => _extensionParametersBody.StatusDisplayStatus = value; } + + /// The level code. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The level code.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The level code.", + SerializedName = @"level", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes StatusLevel { get => _extensionParametersBody.StatusLevel ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes)""); set => _extensionParametersBody.StatusLevel = value; } + + /// The detailed status message, including for alerts and error messages. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The detailed status message, including for alerts and error messages.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The detailed status message, including for alerts and error messages.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + public string StatusMessage { get => _extensionParametersBody.StatusMessage ?? null; set => _extensionParametersBody.StatusMessage = value; } + + /// The time of the status. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The time of the status.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The time of the status.", + SerializedName = @"time", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + public global::System.DateTime StatusTime { get => _extensionParametersBody.StatusTime ?? default(global::System.DateTime); set => _extensionParametersBody.StatusTime = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => _extensionParametersBody.Tag ?? null /* object */; set => _extensionParametersBody.Tag = value; } + + /// Specifies the version of the script handler. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the version of the script handler.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the version of the script handler.", + SerializedName = @"typeHandlerVersion", + PossibleTypes = new [] { typeof(string) })] + public string TypeHandlerVersion { get => _extensionParametersBody.TypeHandlerVersion ?? null; set => _extensionParametersBody.TypeHandlerVersion = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of SetAzStackHCIVmMachineExtension_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.SetAzStackHCIVmMachineExtension_UpdateExpanded Clone() + { + var clone = new SetAzStackHCIVmMachineExtension_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._extensionParametersBody = this._extensionParametersBody; + clone.ResourceGroupName = this.ResourceGroupName; + clone.MachineName = this.MachineName; + clone.ExtensionName = this.ExtensionName; + clone.SubscriptionId = this.SubscriptionId; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'MachineExtensionsCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MachineExtensionsCreateOrUpdate(ResourceGroupName, MachineName, ExtensionName, SubscriptionId, _extensionParametersBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,MachineName=MachineName,ExtensionName=ExtensionName,SubscriptionId=SubscriptionId,body=_extensionParametersBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public SetAzStackHCIVmMachineExtension_UpdateExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, MachineName=MachineName, ExtensionName=ExtensionName, SubscriptionId=SubscriptionId, body=_extensionParametersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, MachineName=MachineName, ExtensionName=ExtensionName, SubscriptionId=SubscriptionId, body=_extensionParametersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmMachine_UpdateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmMachine_UpdateExpanded.cs new file mode 100644 index 000000000000..170984d0a60e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmMachine_UpdateExpanded.cs @@ -0,0 +1,712 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// The operation to create or update a hybrid machine. Please note some properties can be set only during machine creation. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzStackHCIVmMachine_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to create or update a hybrid machine. Please note some properties can be set only during machine creation.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}", ApiVersion = "2023-03-15-preview")] + public partial class SetAzStackHCIVmMachine_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Describes a hybrid machine. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine _parametersBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.Machine(); + + /// The correlation ID passed in from RSM per upgrade. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The correlation ID passed in from RSM per upgrade.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The correlation ID passed in from RSM per upgrade.", + SerializedName = @"correlationId", + PossibleTypes = new [] { typeof(string) })] + public string AgentUpgradeCorrelationId { get => _parametersBody.AgentUpgradeCorrelationId ?? null; set => _parametersBody.AgentUpgradeCorrelationId = value; } + + /// Specifies the version info w.r.t AgentUpgrade for the machine. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the version info w.r.t AgentUpgrade for the machine.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the version info w.r.t AgentUpgrade for the machine.", + SerializedName = @"desiredVersion", + PossibleTypes = new [] { typeof(string) })] + public string AgentUpgradeDesiredVersion { get => _parametersBody.AgentUpgradeDesiredVersion ?? null; set => _parametersBody.AgentUpgradeDesiredVersion = value; } + + /// Specifies if RSM should try to upgrade this machine + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies if RSM should try to upgrade this machine")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies if RSM should try to upgrade this machine", + SerializedName = @"enableAutomaticUpgrade", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter AgentUpgradeEnableAutomaticUpgrade { get => _parametersBody.AgentUpgradeEnableAutomaticUpgrade ?? default(global::System.Management.Automation.SwitchParameter); set => _parametersBody.AgentUpgradeEnableAutomaticUpgrade = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// Public Key that the client provides to be used during initial resource onboarding + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Public Key that the client provides to be used during initial resource onboarding")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Public Key that the client provides to be used during initial resource onboarding", + SerializedName = @"clientPublicKey", + PossibleTypes = new [] { typeof(string) })] + public string ClientPublicKey { get => _parametersBody.ClientPublicKey ?? null; set => _parametersBody.ClientPublicKey = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Machine Extensions information (deprecated field) + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Machine Extensions information (deprecated field)")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Machine Extensions information (deprecated field)", + SerializedName = @"extensions", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView[] Extension { get => _parametersBody.Extension ?? null /* arrayOf */; set => _parametersBody.Extension = value; } + + /// The behavior of the service when the Arc-enabled machine starts up. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The behavior of the service when the Arc-enabled machine starts up.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The behavior of the service when the Arc-enabled machine starts up.", + SerializedName = @"startupType", + PossibleTypes = new [] { typeof(string) })] + public string ExtensionServiceStartupType { get => _parametersBody.ExtensionServiceStartupType ?? null; set => _parametersBody.ExtensionServiceStartupType = value; } + + /// The current status of the service. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The current status of the service.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The current status of the service.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + public string ExtensionServiceStatus { get => _parametersBody.ExtensionServiceStatus ?? null; set => _parametersBody.ExtensionServiceStatus = value; } + + /// The behavior of the service when the Arc-enabled machine starts up. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The behavior of the service when the Arc-enabled machine starts up.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The behavior of the service when the Arc-enabled machine starts up.", + SerializedName = @"startupType", + PossibleTypes = new [] { typeof(string) })] + public string GuestConfigurationServiceStartupType { get => _parametersBody.GuestConfigurationServiceStartupType ?? null; set => _parametersBody.GuestConfigurationServiceStartupType = value; } + + /// The current status of the service. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The current status of the service.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The current status of the service.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + public string GuestConfigurationServiceStatus { get => _parametersBody.GuestConfigurationServiceStatus ?? null; set => _parametersBody.GuestConfigurationServiceStatus = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// The identity type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The identity type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identity type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType IdentityType { get => _parametersBody.IdentityType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType)""); set => _parametersBody.IdentityType = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc.", + SerializedName = @"kind", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind Kind { get => _parametersBody.Kind ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind)""); set => _parametersBody.Kind = value; } + + /// Specifies the assessment mode. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the assessment mode.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the assessment mode.", + SerializedName = @"assessmentMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes LinuxConfigurationPatchSettingsAssessmentMode { get => _parametersBody.LinuxConfigurationPatchSettingsAssessmentMode ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes)""); set => _parametersBody.LinuxConfigurationPatchSettingsAssessmentMode = value; } + + /// Specifies the patch mode. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the patch mode.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the patch mode.", + SerializedName = @"patchMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes LinuxConfigurationPatchSettingsPatchMode { get => _parametersBody.LinuxConfigurationPatchSettingsPatchMode ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes)""); set => _parametersBody.LinuxConfigurationPatchSettingsPatchMode = value; } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _parametersBody.Location ?? null; set => _parametersBody.Location = value; } + + /// The city or locality where the resource is located. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The city or locality where the resource is located.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The city or locality where the resource is located.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + public string LocationDataCity { get => _parametersBody.LocationDataCity ?? null; set => _parametersBody.LocationDataCity = value; } + + /// The country or region where the resource is located + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The country or region where the resource is located")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The country or region where the resource is located", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + public string LocationDataCountryOrRegion { get => _parametersBody.LocationDataCountryOrRegion ?? null; set => _parametersBody.LocationDataCountryOrRegion = value; } + + /// The district, state, or province where the resource is located. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The district, state, or province where the resource is located.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The district, state, or province where the resource is located.", + SerializedName = @"district", + PossibleTypes = new [] { typeof(string) })] + public string LocationDataDistrict { get => _parametersBody.LocationDataDistrict ?? null; set => _parametersBody.LocationDataDistrict = value; } + + /// A canonical name for the geographic or physical location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "A canonical name for the geographic or physical location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A canonical name for the geographic or physical location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string LocationDataName { get => _parametersBody.LocationDataName ?? null; set => _parametersBody.LocationDataName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Specifies whether any MS SQL instance is discovered on the machine. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies whether any MS SQL instance is discovered on the machine.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies whether any MS SQL instance is discovered on the machine.", + SerializedName = @"mssqlDiscovered", + PossibleTypes = new [] { typeof(string) })] + public string MssqlDiscovered { get => _parametersBody.MssqlDiscovered ?? null; set => _parametersBody.MssqlDiscovered = value; } + + /// Backing field for property. + private string _name; + + /// The name of the hybrid machine. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the hybrid machine.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the hybrid machine.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("MachineName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// The type of Operating System (windows/linux). + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of Operating System (windows/linux).")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of Operating System (windows/linux).", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + public string OSType { get => _parametersBody.OSType ?? null; set => _parametersBody.OSType = value; } + + /// + /// The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any.", + SerializedName = @"parentClusterResourceId", + PossibleTypes = new [] { typeof(string) })] + public string ParentClusterResourceId { get => _parametersBody.ParentClusterResourceId ?? null; set => _parametersBody.ParentClusterResourceId = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The resource id of the private link scope this machine is assigned to, if any. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The resource id of the private link scope this machine is assigned to, if any.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource id of the private link scope this machine is assigned to, if any.", + SerializedName = @"privateLinkScopeResourceId", + PossibleTypes = new [] { typeof(string) })] + public string PrivateLinkScopeResourceId { get => _parametersBody.PrivateLinkScopeResourceId ?? null; set => _parametersBody.PrivateLinkScopeResourceId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => _parametersBody.Tag ?? null /* object */; set => _parametersBody.Tag = value; } + + /// Specifies the hybrid machine unique ID. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the hybrid machine unique ID.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the hybrid machine unique ID.", + SerializedName = @"vmId", + PossibleTypes = new [] { typeof(string) })] + public string VMId { get => _parametersBody.VMId ?? null; set => _parametersBody.VMId = value; } + + /// Specifies the assessment mode. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the assessment mode.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the assessment mode.", + SerializedName = @"assessmentMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes WindowsConfigurationPatchSettingsAssessmentMode { get => _parametersBody.WindowsConfigurationPatchSettingsAssessmentMode ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes)""); set => _parametersBody.WindowsConfigurationPatchSettingsAssessmentMode = value; } + + /// Specifies the patch mode. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the patch mode.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the patch mode.", + SerializedName = @"patchMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes WindowsConfigurationPatchSettingsPatchMode { get => _parametersBody.WindowsConfigurationPatchSettingsPatchMode ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes)""); set => _parametersBody.WindowsConfigurationPatchSettingsPatchMode = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'MachinesCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MachinesCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, _parametersBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_parametersBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public SetAzStackHCIVmMachine_UpdateExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_parametersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_parametersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmMarketplaceGalleryImage_UpdateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmMarketplaceGalleryImage_UpdateExpanded.cs new file mode 100644 index 000000000000..d8f4dc1acc27 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmMarketplaceGalleryImage_UpdateExpanded.cs @@ -0,0 +1,621 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// The operation to create or update a marketplace gallery image. Please note some properties can be set only during marketplace + /// gallery image creation. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzStackHCIVmMarketplaceGalleryImage_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to create or update a marketplace gallery image. Please note some properties can be set only during marketplace gallery image creation.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}", ApiVersion = "2023-09-01-preview")] + public partial class SetAzStackHCIVmMarketplaceGalleryImage_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The marketplace gallery image resource definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages _marketplaceGalleryImagesBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImages(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure]")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure]", + SerializedName = @"cloudInitDataSource", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource CloudInitDataSource { get => _marketplaceGalleryImagesBody.CloudInitDataSource ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource)""); set => _marketplaceGalleryImagesBody.CloudInitDataSource = value; } + + /// + /// Storage ContainerID of the storage container to be used for marketplace gallery image + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Storage ContainerID of the storage container to be used for marketplace gallery image")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Storage ContainerID of the storage container to be used for marketplace gallery image", + SerializedName = @"containerId", + PossibleTypes = new [] { typeof(string) })] + public string ContainerId { get => _marketplaceGalleryImagesBody.ContainerId ?? null; set => _marketplaceGalleryImagesBody.ContainerId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The name of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string ExtendedLocationName { get => _marketplaceGalleryImagesBody.ExtendedLocationName ?? null; set => _marketplaceGalleryImagesBody.ExtendedLocationName = value; } + + /// The type of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the extended location.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes ExtendedLocationType { get => _marketplaceGalleryImagesBody.ExtendedLocationType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes)""); set => _marketplaceGalleryImagesBody.ExtendedLocationType = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// The hypervisor generation of the Virtual Machine [V1, V2] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The hypervisor generation of the Virtual Machine [V1, V2]")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The hypervisor generation of the Virtual Machine [V1, V2]", + SerializedName = @"hyperVGeneration", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration HyperVGeneration { get => _marketplaceGalleryImagesBody.HyperVGeneration ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration)""); set => _marketplaceGalleryImagesBody.HyperVGeneration = value; } + + /// The name of the gallery image definition offer. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the gallery image definition offer.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition offer.", + SerializedName = @"offer", + PossibleTypes = new [] { typeof(string) })] + public string IdentifierOffer { get => _marketplaceGalleryImagesBody.IdentifierOffer ?? null; set => _marketplaceGalleryImagesBody.IdentifierOffer = value; } + + /// The name of the gallery image definition publisher. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the gallery image definition publisher.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition publisher.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + public string IdentifierPublisher { get => _marketplaceGalleryImagesBody.IdentifierPublisher ?? null; set => _marketplaceGalleryImagesBody.IdentifierPublisher = value; } + + /// The name of the gallery image definition SKU. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the gallery image definition SKU.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the gallery image definition SKU.", + SerializedName = @"sku", + PossibleTypes = new [] { typeof(string) })] + public string IdentifierSku { get => _marketplaceGalleryImagesBody.IdentifierSku ?? null; set => _marketplaceGalleryImagesBody.IdentifierSku = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _marketplaceGalleryImagesBody.Location ?? null; set => _marketplaceGalleryImagesBody.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the marketplace gallery image + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the marketplace gallery image")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the marketplace gallery image", + SerializedName = @"marketplaceGalleryImageName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("MarketplaceGalleryImageName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// Operating system type that the gallery image uses [Windows, Linux] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Operating system type that the gallery image uses [Windows, Linux]")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Operating system type that the gallery image uses [Windows, Linux]", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes OSType { get => _marketplaceGalleryImagesBody.OSType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes)""); set => _marketplaceGalleryImagesBody.OSType = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => _marketplaceGalleryImagesBody.Tag ?? null /* object */; set => _marketplaceGalleryImagesBody.Tag = value; } + + /// This is the version of the gallery image. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "This is the version of the gallery image.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"This is the version of the gallery image.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string VersionName { get => _marketplaceGalleryImagesBody.VersionName ?? null; set => _marketplaceGalleryImagesBody.VersionName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of SetAzStackHCIVmMarketplaceGalleryImage_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.SetAzStackHCIVmMarketplaceGalleryImage_UpdateExpanded Clone() + { + var clone = new SetAzStackHCIVmMarketplaceGalleryImage_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._marketplaceGalleryImagesBody = this._marketplaceGalleryImagesBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'MarketplaceGalleryImagesCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MarketplaceGalleryImagesCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, _marketplaceGalleryImagesBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_marketplaceGalleryImagesBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public SetAzStackHCIVmMarketplaceGalleryImage_UpdateExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_marketplaceGalleryImagesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_marketplaceGalleryImagesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmNetworkInterface_UpdateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmNetworkInterface_UpdateExpanded.cs new file mode 100644 index 000000000000..1ad942008b86 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmNetworkInterface_UpdateExpanded.cs @@ -0,0 +1,561 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// The operation to create or update a network interface. Please note some properties can be set only during network interface + /// creation. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzStackHCIVmNetworkInterface_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to create or update a network interface. Please note some properties can be set only during network interface creation.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}", ApiVersion = "2023-09-01-preview")] + public partial class SetAzStackHCIVmNetworkInterface_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The network interface resource definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces _networkInterfacesBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfaces(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// List of DNS server IP Addresses for the interface + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of DNS server IP Addresses for the interface")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of DNS server IP Addresses for the interface", + SerializedName = @"dnsServers", + PossibleTypes = new [] { typeof(string) })] + public string[] DnsSettingDnsServer { get => _networkInterfacesBody.DnsSettingDnsServer ?? null /* arrayOf */; set => _networkInterfacesBody.DnsSettingDnsServer = value; } + + /// The name of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string ExtendedLocationName { get => _networkInterfacesBody.ExtendedLocationName ?? null; set => _networkInterfacesBody.ExtendedLocationName = value; } + + /// The type of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the extended location.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes ExtendedLocationType { get => _networkInterfacesBody.ExtendedLocationType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes)""); set => _networkInterfacesBody.ExtendedLocationType = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// IPConfigurations - A list of IPConfigurations of the network interface. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "IPConfigurations - A list of IPConfigurations of the network interface.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"IPConfigurations - A list of IPConfigurations of the network interface.", + SerializedName = @"ipConfigurations", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration[] IPConfiguration { get => _networkInterfacesBody.IPConfiguration ?? null /* arrayOf */; set => _networkInterfacesBody.IPConfiguration = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _networkInterfacesBody.Location ?? null; set => _networkInterfacesBody.Location = value; } + + /// MacAddress - The MAC address of the network interface. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "MacAddress - The MAC address of the network interface.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"MacAddress - The MAC address of the network interface.", + SerializedName = @"macAddress", + PossibleTypes = new [] { typeof(string) })] + public string MacAddress { get => _networkInterfacesBody.MacAddress ?? null; set => _networkInterfacesBody.MacAddress = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the network interface + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the network interface")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the network interface", + SerializedName = @"networkInterfaceName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("NetworkInterfaceName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => _networkInterfacesBody.Tag ?? null /* object */; set => _networkInterfacesBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of SetAzStackHCIVmNetworkInterface_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.SetAzStackHCIVmNetworkInterface_UpdateExpanded Clone() + { + var clone = new SetAzStackHCIVmNetworkInterface_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._networkInterfacesBody = this._networkInterfacesBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'NetworkInterfacesCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.NetworkInterfacesCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, _networkInterfacesBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_networkInterfacesBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public SetAzStackHCIVmNetworkInterface_UpdateExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_networkInterfacesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_networkInterfacesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmStorageContainer_UpdateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmStorageContainer_UpdateExpanded.cs new file mode 100644 index 000000000000..7da0acf40212 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmStorageContainer_UpdateExpanded.cs @@ -0,0 +1,537 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// The operation to create or update a storage container. Please note some properties can be set only during storage container + /// creation. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzStackHCIVmStorageContainer_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to create or update a storage container. Please note some properties can be set only during storage container creation.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}", ApiVersion = "2023-09-01-preview")] + public partial class SetAzStackHCIVmStorageContainer_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The storage container resource definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers _storageContainersBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainers(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The name of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string ExtendedLocationName { get => _storageContainersBody.ExtendedLocationName ?? null; set => _storageContainersBody.ExtendedLocationName = value; } + + /// The type of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the extended location.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes ExtendedLocationType { get => _storageContainersBody.ExtendedLocationType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes)""); set => _storageContainersBody.ExtendedLocationType = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _storageContainersBody.Location ?? null; set => _storageContainersBody.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the storage container + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the storage container")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the storage container", + SerializedName = @"storageContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("StorageContainerName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// Path of the storage container on the disk + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Path of the storage container on the disk")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Path of the storage container on the disk", + SerializedName = @"path", + PossibleTypes = new [] { typeof(string) })] + public string Path { get => _storageContainersBody.Path ?? null; set => _storageContainersBody.Path = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => _storageContainersBody.Tag ?? null /* object */; set => _storageContainersBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of SetAzStackHCIVmStorageContainer_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.SetAzStackHCIVmStorageContainer_UpdateExpanded Clone() + { + var clone = new SetAzStackHCIVmStorageContainer_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._storageContainersBody = this._storageContainersBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'StorageContainersCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.StorageContainersCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, _storageContainersBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_storageContainersBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public SetAzStackHCIVmStorageContainer_UpdateExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_storageContainersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_storageContainersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmVirtualHardDisk_UpdateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmVirtualHardDisk_UpdateExpanded.cs new file mode 100644 index 000000000000..644ad2f1833f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmVirtualHardDisk_UpdateExpanded.cs @@ -0,0 +1,616 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// The operation to create or update a virtual hard disk. Please note some properties can be set only during virtual hard + /// disk creation. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzStackHCIVmVirtualHardDisk_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to create or update a virtual hard disk. Please note some properties can be set only during virtual hard disk creation.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}", ApiVersion = "2023-09-01-preview")] + public partial class SetAzStackHCIVmVirtualHardDisk_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The virtual hard disk resource definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks _virtualHardDisksBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisks(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// . + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @".", + SerializedName = @"blockSizeBytes", + PossibleTypes = new [] { typeof(int) })] + public int BlockSizeByte { get => _virtualHardDisksBody.BlockSizeByte ?? default(int); set => _virtualHardDisksBody.BlockSizeByte = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// Storage ContainerID of the storage container to be used for VHD + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Storage ContainerID of the storage container to be used for VHD")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Storage ContainerID of the storage container to be used for VHD", + SerializedName = @"containerId", + PossibleTypes = new [] { typeof(string) })] + public string ContainerId { get => _virtualHardDisksBody.ContainerId ?? null; set => _virtualHardDisksBody.ContainerId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The format of the actual VHD file [vhd, vhdx] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The format of the actual VHD file [vhd, vhdx]")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The format of the actual VHD file [vhd, vhdx]", + SerializedName = @"diskFileFormat", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat DiskFileFormat { get => _virtualHardDisksBody.DiskFileFormat ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat)""); set => _virtualHardDisksBody.DiskFileFormat = value; } + + /// Size of the disk in GB + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Size of the disk in GB")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Size of the disk in GB", + SerializedName = @"diskSizeGB", + PossibleTypes = new [] { typeof(long) })] + public long DiskSizeGb { get => _virtualHardDisksBody.DiskSizeGb ?? default(long); set => _virtualHardDisksBody.DiskSizeGb = value; } + + /// Boolean for enabling dynamic sizing on the virtual hard disk + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Boolean for enabling dynamic sizing on the virtual hard disk")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Boolean for enabling dynamic sizing on the virtual hard disk", + SerializedName = @"dynamic", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter Dynamic { get => _virtualHardDisksBody.Dynamic ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualHardDisksBody.Dynamic = value; } + + /// The name of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string ExtendedLocationName { get => _virtualHardDisksBody.ExtendedLocationName ?? null; set => _virtualHardDisksBody.ExtendedLocationName = value; } + + /// The type of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the extended location.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes ExtendedLocationType { get => _virtualHardDisksBody.ExtendedLocationType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes)""); set => _virtualHardDisksBody.ExtendedLocationType = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// The hypervisor generation of the Virtual Machine [V1, V2] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The hypervisor generation of the Virtual Machine [V1, V2]")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The hypervisor generation of the Virtual Machine [V1, V2]", + SerializedName = @"hyperVGeneration", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration HyperVGeneration { get => _virtualHardDisksBody.HyperVGeneration ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration)""); set => _virtualHardDisksBody.HyperVGeneration = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The geo-location where the resource lives + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The geo-location where the resource lives", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _virtualHardDisksBody.Location ?? null; set => _virtualHardDisksBody.Location = value; } + + /// . + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @".", + SerializedName = @"logicalSectorBytes", + PossibleTypes = new [] { typeof(int) })] + public int LogicalSectorByte { get => _virtualHardDisksBody.LogicalSectorByte ?? default(int); set => _virtualHardDisksBody.LogicalSectorByte = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the virtual hard disk + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the virtual hard disk")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the virtual hard disk", + SerializedName = @"virtualHardDiskName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("VirtualHardDiskName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// . + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @".", + SerializedName = @"physicalSectorBytes", + PossibleTypes = new [] { typeof(int) })] + public int PhysicalSectorByte { get => _virtualHardDisksBody.PhysicalSectorByte ?? default(int); set => _virtualHardDisksBody.PhysicalSectorByte = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags. + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags Tag { get => _virtualHardDisksBody.Tag ?? null /* object */; set => _virtualHardDisksBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of SetAzStackHCIVmVirtualHardDisk_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.SetAzStackHCIVmVirtualHardDisk_UpdateExpanded Clone() + { + var clone = new SetAzStackHCIVmVirtualHardDisk_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._virtualHardDisksBody = this._virtualHardDisksBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualHardDisksCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualHardDisksCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, _virtualHardDisksBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_virtualHardDisksBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public SetAzStackHCIVmVirtualHardDisk_UpdateExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_virtualHardDisksBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_virtualHardDisksBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmVirtualMachineInstance_UpdateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmVirtualMachineInstance_UpdateExpanded.cs new file mode 100644 index 000000000000..73c3f958991b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/SetAzStackHCIVmVirtualMachineInstance_UpdateExpanded.cs @@ -0,0 +1,868 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// + /// The operation to create or update a virtual machine instance. Please note some properties can be set only during virtual + /// machine instance creation. + /// + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzStackHCIVmVirtualMachineInstance_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to create or update a virtual machine instance. Please note some properties can be set only during virtual machine instance creation.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", ApiVersion = "2023-09-01-preview")] + public partial class SetAzStackHCIVmVirtualMachineInstance_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The virtual machine instance resource definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance _virtualMachineInstanceBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstance(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// + /// Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage + /// of the total memory that the virtual machine instance is thought to need. This only applies to virtual systems with dynamic + /// memory enabled. This property can be in the range of 5 to 2000. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage of the total memory that the virtual machine instance is thought to need. This only applies to virtual systems with dynamic memory enabled. This property can be in the range of 5 to 2000.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage of the total memory that the virtual machine instance is thought to need. This only applies to virtual systems with dynamic memory enabled. This property can be in the range of 5 to 2000.", + SerializedName = @"targetMemoryBuffer", + PossibleTypes = new [] { typeof(int) })] + public int DynamicMemoryConfigTargetMemoryBuffer { get => _virtualMachineInstanceBody.DynamicMemoryConfigTargetMemoryBuffer ?? default(int); set => _virtualMachineInstanceBody.DynamicMemoryConfigTargetMemoryBuffer = value; } + + /// . + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @".", + SerializedName = @"maximumMemoryMB", + PossibleTypes = new [] { typeof(long) })] + public long DynamicMemoryMaximumMemoryInMb { get => _virtualMachineInstanceBody.DynamicMemoryConfigMaximumMemoryMb ?? default(long); set => _virtualMachineInstanceBody.DynamicMemoryConfigMaximumMemoryMb = value; } + + /// . + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @".", + SerializedName = @"minimumMemoryMB", + PossibleTypes = new [] { typeof(long) })] + public long DynamicMemoryMinimumMemoryInMb { get => _virtualMachineInstanceBody.DynamicMemoryConfigMinimumMemoryMb ?? default(long); set => _virtualMachineInstanceBody.DynamicMemoryConfigMinimumMemoryMb = value; } + + /// The name of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string ExtendedLocationName { get => _virtualMachineInstanceBody.ExtendedLocationName ?? null; set => _virtualMachineInstanceBody.ExtendedLocationName = value; } + + /// The type of the extended location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of the extended location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the extended location.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes ExtendedLocationType { get => _virtualMachineInstanceBody.ExtendedLocationType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes)""); set => _virtualMachineInstanceBody.ExtendedLocationType = value; } + + /// RAM in MB for the virtual machine instance + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "RAM in MB for the virtual machine instance")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"RAM in MB for the virtual machine instance", + SerializedName = @"memoryMB", + PossibleTypes = new [] { typeof(long) })] + public long HardwareProfileMemoryMb { get => _virtualMachineInstanceBody.HardwareProfileMemoryMb ?? default(long); set => _virtualMachineInstanceBody.HardwareProfileMemoryMb = value; } + + /// number of processors for the virtual machine instance + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "number of processors for the virtual machine instance")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"number of processors for the virtual machine instance", + SerializedName = @"processors", + PossibleTypes = new [] { typeof(int) })] + public int HardwareProfileProcessor { get => _virtualMachineInstanceBody.HardwareProfileProcessor ?? default(int); set => _virtualMachineInstanceBody.HardwareProfileProcessor = value; } + + /// . + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @".", + SerializedName = @"vmSize", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum HardwareProfileVMSize { get => _virtualMachineInstanceBody.HardwareProfileVMSize ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum)""); set => _virtualMachineInstanceBody.HardwareProfileVMSize = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// The HTTP proxy server endpoint to use. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The HTTP proxy server endpoint to use.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The HTTP proxy server endpoint to use.", + SerializedName = @"httpProxy", + PossibleTypes = new [] { typeof(string) })] + public string HttpProxyConfigHttpProxy { get => _virtualMachineInstanceBody.HttpProxyConfigHttpProxy ?? null; set => _virtualMachineInstanceBody.HttpProxyConfigHttpProxy = value; } + + /// The HTTPS proxy server endpoint to use. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The HTTPS proxy server endpoint to use.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The HTTPS proxy server endpoint to use.", + SerializedName = @"httpsProxy", + PossibleTypes = new [] { typeof(string) })] + public string HttpProxyConfigHttpsProxy { get => _virtualMachineInstanceBody.HttpProxyConfigHttpsProxy ?? null; set => _virtualMachineInstanceBody.HttpProxyConfigHttpsProxy = value; } + + /// The endpoints that should not go through proxy. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The endpoints that should not go through proxy.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The endpoints that should not go through proxy.", + SerializedName = @"noProxy", + PossibleTypes = new [] { typeof(string) })] + public string[] HttpProxyConfigNoProxy { get => _virtualMachineInstanceBody.HttpProxyConfigNoProxy ?? null /* arrayOf */; set => _virtualMachineInstanceBody.HttpProxyConfigNoProxy = value; } + + /// Alternative CA cert to use for connecting to proxy servers. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Alternative CA cert to use for connecting to proxy servers.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Alternative CA cert to use for connecting to proxy servers.", + SerializedName = @"trustedCa", + PossibleTypes = new [] { typeof(string) })] + public string HttpProxyConfigTrustedCa { get => _virtualMachineInstanceBody.HttpProxyConfigTrustedCa ?? null; set => _virtualMachineInstanceBody.HttpProxyConfigTrustedCa = value; } + + /// The identity type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The identity type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identity type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType IdentityType { get => _virtualMachineInstanceBody.IdentityType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType)""); set => _virtualMachineInstanceBody.IdentityType = value; } + + /// Resource ID of the image + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource ID of the image")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource ID of the image", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + public string ImageReferenceId { get => _virtualMachineInstanceBody.ImageReferenceId ?? null; set => _virtualMachineInstanceBody.ImageReferenceId = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// DisablePasswordAuthentication - whether password authentication should be disabled + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "DisablePasswordAuthentication - whether password authentication should be disabled")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"DisablePasswordAuthentication - whether password authentication should be disabled", + SerializedName = @"disablePasswordAuthentication", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter LinuxConfigurationDisablePasswordAuthentication { get => _virtualMachineInstanceBody.LinuxConfigurationDisablePasswordAuthentication ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.LinuxConfigurationDisablePasswordAuthentication = value; } + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter LinuxConfigurationProvisionVMAgent { get => _virtualMachineInstanceBody.LinuxConfigurationProvisionVMAgent ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.LinuxConfigurationProvisionVMAgent = value; } + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter LinuxConfigurationProvisionVMConfigAgent { get => _virtualMachineInstanceBody.LinuxConfigurationProvisionVMConfigAgent ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.LinuxConfigurationProvisionVMConfigAgent = value; } + + /// The list of SSH public keys used to authenticate with linux based VMs. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The list of SSH public keys used to authenticate with linux based VMs.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of SSH public keys used to authenticate with linux based VMs.", + SerializedName = @"publicKeys", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] LinuxConfigurationSshPublicKey { get => _virtualMachineInstanceBody.LinuxConfigurationSshPublicKey ?? null /* arrayOf */; set => _virtualMachineInstanceBody.LinuxConfigurationSshPublicKey = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance", + SerializedName = @"networkInterfaces", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem[] NetworkProfileNetworkInterface { get => _virtualMachineInstanceBody.NetworkProfileNetworkInterface ?? null /* arrayOf */; set => _virtualMachineInstanceBody.NetworkProfileNetworkInterface = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// Resource ID of the OS disk + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource ID of the OS disk")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource ID of the OS disk", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + public string OSDiskId { get => _virtualMachineInstanceBody.OSDiskId ?? null; set => _virtualMachineInstanceBody.OSDiskId = value; } + + /// + /// This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or + /// a specialized VHD. Possible values are: **Windows,** **Linux.** + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. Possible values are: **Windows,** **Linux.**")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. Possible values are: **Windows,** **Linux.**", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes OSDiskOstype { get => _virtualMachineInstanceBody.OSDiskOstype ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes)""); set => _virtualMachineInstanceBody.OSDiskOstype = value; } + + /// AdminPassword - admin password + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "AdminPassword - admin password")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"AdminPassword - admin password", + SerializedName = @"adminPassword", + PossibleTypes = new [] { typeof(string) })] + public string OSProfileAdminPassword { get => _virtualMachineInstanceBody.OSProfileAdminPassword ?? null; set => _virtualMachineInstanceBody.OSProfileAdminPassword = value; } + + /// AdminUsername - admin username + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "AdminUsername - admin username")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"AdminUsername - admin username", + SerializedName = @"adminUsername", + PossibleTypes = new [] { typeof(string) })] + public string OSProfileAdminUsername { get => _virtualMachineInstanceBody.OSProfileAdminUsername ?? null; set => _virtualMachineInstanceBody.OSProfileAdminUsername = value; } + + /// ComputerName - name of the compute + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "ComputerName - name of the compute")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ComputerName - name of the compute", + SerializedName = @"computerName", + PossibleTypes = new [] { typeof(string) })] + public string OSProfileComputerName { get => _virtualMachineInstanceBody.OSProfileComputerName ?? null; set => _virtualMachineInstanceBody.OSProfileComputerName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Unique identifier defined by ARC to identify the guest of the VM. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Unique identifier defined by ARC to identify the guest of the VM.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Unique identifier defined by ARC to identify the guest of the VM.", + SerializedName = @"resourceUid", + PossibleTypes = new [] { typeof(string) })] + public string ResourceUid { get => _virtualMachineInstanceBody.ResourceUid ?? null; set => _virtualMachineInstanceBody.ResourceUid = value; } + + /// Backing field for property. + private string _resourceUri; + + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.", + SerializedName = @"resourceUri", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceUri { get => this._resourceUri; set => this._resourceUri = value; } + + /// . + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @".", + SerializedName = @"enableTPM", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter SecurityProfileEnableTpm { get => _virtualMachineInstanceBody.SecurityProfileEnableTpm ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.SecurityProfileEnableTpm = value; } + + /// + /// Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for SecurityType + /// to function. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for SecurityType to function.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for SecurityType to function.", + SerializedName = @"securityType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes SecurityProfileSecurityType { get => _virtualMachineInstanceBody.SecurityProfileSecurityType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes)""); set => _virtualMachineInstanceBody.SecurityProfileSecurityType = value; } + + /// adds data disks to the virtual machine instance + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "adds data disks to the virtual machine instance")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"adds data disks to the virtual machine instance", + SerializedName = @"dataDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem[] StorageProfileDataDisk { get => _virtualMachineInstanceBody.StorageProfileDataDisk ?? null /* arrayOf */; set => _virtualMachineInstanceBody.StorageProfileDataDisk = value; } + + /// Id of the storage container that hosts the VM configuration file + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Id of the storage container that hosts the VM configuration file")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Id of the storage container that hosts the VM configuration file", + SerializedName = @"vmConfigStoragePathId", + PossibleTypes = new [] { typeof(string) })] + public string StorageProfileVMConfigStoragePathId { get => _virtualMachineInstanceBody.StorageProfileVMConfigStoragePathId ?? null; set => _virtualMachineInstanceBody.StorageProfileVMConfigStoragePathId = value; } + + /// + /// Specifies whether secure boot should be enabled on the virtual machine instance. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies whether secure boot should be enabled on the virtual machine instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies whether secure boot should be enabled on the virtual machine instance.", + SerializedName = @"secureBootEnabled", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter UefiSettingSecureBootEnabled { get => _virtualMachineInstanceBody.UefiSettingSecureBootEnabled ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.UefiSettingSecureBootEnabled = value; } + + /// Whether to EnableAutomaticUpdates on the machine + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Whether to EnableAutomaticUpdates on the machine")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Whether to EnableAutomaticUpdates on the machine", + SerializedName = @"enableAutomaticUpdates", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter WindowConfigurationEnableAutomaticUpdate { get => _virtualMachineInstanceBody.WindowConfigurationEnableAutomaticUpdate ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.WindowConfigurationEnableAutomaticUpdate = value; } + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter WindowConfigurationProvisionVMAgent { get => _virtualMachineInstanceBody.WindowConfigurationProvisionVMAgent ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.WindowConfigurationProvisionVMAgent = value; } + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter WindowConfigurationProvisionVMConfigAgent { get => _virtualMachineInstanceBody.WindowConfigurationProvisionVMConfigAgent ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.WindowConfigurationProvisionVMConfigAgent = value; } + + /// TimeZone for the virtual machine instance + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "TimeZone for the virtual machine instance")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"TimeZone for the virtual machine instance", + SerializedName = @"timeZone", + PossibleTypes = new [] { typeof(string) })] + public string WindowConfigurationTimeZone { get => _virtualMachineInstanceBody.WindowConfigurationTimeZone ?? null; set => _virtualMachineInstanceBody.WindowConfigurationTimeZone = value; } + + /// The list of SSH public keys used to authenticate with linux based VMs. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The list of SSH public keys used to authenticate with linux based VMs.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of SSH public keys used to authenticate with linux based VMs.", + SerializedName = @"publicKeys", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[] WindowsConfigurationSshPublicKey { get => _virtualMachineInstanceBody.WindowsConfigurationSshPublicKey ?? null /* arrayOf */; set => _virtualMachineInstanceBody.WindowsConfigurationSshPublicKey = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of SetAzStackHCIVmVirtualMachineInstance_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.SetAzStackHCIVmVirtualMachineInstance_UpdateExpanded Clone() + { + var clone = new SetAzStackHCIVmVirtualMachineInstance_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._virtualMachineInstanceBody = this._virtualMachineInstanceBody; + clone.ResourceUri = this.ResourceUri; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualMachineInstancesCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualMachineInstancesCreateOrUpdate(ResourceUri, _virtualMachineInstanceBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri,body=_virtualMachineInstanceBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public SetAzStackHCIVmVirtualMachineInstance_UpdateExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri, body=_virtualMachineInstanceBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri, body=_virtualMachineInstanceBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/StartAzStackHCIVmVirtualMachine_Start.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/StartAzStackHCIVmVirtualMachine_Start.cs new file mode 100644 index 000000000000..5889636562f0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/StartAzStackHCIVmVirtualMachine_Start.cs @@ -0,0 +1,440 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to start a virtual machine instance. + /// + /// [OpenAPI] Start=>POST:"/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/start" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Start, @"AzStackHCIVmVirtualMachine_Start", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to start a virtual machine instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/start", ApiVersion = "2023-09-01-preview")] + public partial class StartAzStackHCIVmVirtualMachine_Start : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceUri; + + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.", + SerializedName = @"resourceUri", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceUri { get => this._resourceUri; set => this._resourceUri = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of StartAzStackHCIVmVirtualMachine_Start + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.StartAzStackHCIVmVirtualMachine_Start Clone() + { + var clone = new StartAzStackHCIVmVirtualMachine_Start(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceUri = this.ResourceUri; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualMachineInstancesStart' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualMachineInstancesStart(ResourceUri, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public StartAzStackHCIVmVirtualMachine_Start() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/StartAzStackHCIVmVirtualMachine_StartViaIdentity.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/StartAzStackHCIVmVirtualMachine_StartViaIdentity.cs new file mode 100644 index 000000000000..1b7c3ede842f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/StartAzStackHCIVmVirtualMachine_StartViaIdentity.cs @@ -0,0 +1,443 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to start a virtual machine instance. + /// + /// [OpenAPI] Start=>POST:"/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/start" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Start, @"AzStackHCIVmVirtualMachine_StartViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to start a virtual machine instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/start", ApiVersion = "2023-09-01-preview")] + public partial class StartAzStackHCIVmVirtualMachine_StartViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of StartAzStackHCIVmVirtualMachine_StartViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.StartAzStackHCIVmVirtualMachine_StartViaIdentity Clone() + { + var clone = new StartAzStackHCIVmVirtualMachine_StartViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualMachineInstancesStart' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.VirtualMachineInstancesStartViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceUri) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceUri"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.VirtualMachineInstancesStart(InputObject.ResourceUri ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public StartAzStackHCIVmVirtualMachine_StartViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/StopAzStackHCIVmVirtualMachine_Stop.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/StopAzStackHCIVmVirtualMachine_Stop.cs new file mode 100644 index 000000000000..6c0098db6d7b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/StopAzStackHCIVmVirtualMachine_Stop.cs @@ -0,0 +1,440 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to stop a virtual machine instance. + /// + /// [OpenAPI] Stop=>POST:"/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/stop" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Stop, @"AzStackHCIVmVirtualMachine_Stop", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to stop a virtual machine instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/stop", ApiVersion = "2023-09-01-preview")] + public partial class StopAzStackHCIVmVirtualMachine_Stop : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceUri; + + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.", + SerializedName = @"resourceUri", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceUri { get => this._resourceUri; set => this._resourceUri = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of StopAzStackHCIVmVirtualMachine_Stop + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.StopAzStackHCIVmVirtualMachine_Stop Clone() + { + var clone = new StopAzStackHCIVmVirtualMachine_Stop(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceUri = this.ResourceUri; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualMachineInstancesStop' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualMachineInstancesStop(ResourceUri, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public StopAzStackHCIVmVirtualMachine_Stop() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/StopAzStackHCIVmVirtualMachine_StopViaIdentity.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/StopAzStackHCIVmVirtualMachine_StopViaIdentity.cs new file mode 100644 index 000000000000..6de09b7d17e8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/StopAzStackHCIVmVirtualMachine_StopViaIdentity.cs @@ -0,0 +1,443 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to stop a virtual machine instance. + /// + /// [OpenAPI] Stop=>POST:"/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/stop" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Stop, @"AzStackHCIVmVirtualMachine_StopViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to stop a virtual machine instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/stop", ApiVersion = "2023-09-01-preview")] + public partial class StopAzStackHCIVmVirtualMachine_StopViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of StopAzStackHCIVmVirtualMachine_StopViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.StopAzStackHCIVmVirtualMachine_StopViaIdentity Clone() + { + var clone = new StopAzStackHCIVmVirtualMachine_StopViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualMachineInstancesStop' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.VirtualMachineInstancesStopViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceUri) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceUri"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.VirtualMachineInstancesStop(InputObject.ResourceUri ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public StopAzStackHCIVmVirtualMachine_StopViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmExtension_Upgrade.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmExtension_Upgrade.cs new file mode 100644 index 000000000000..f6687a1cae7f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmExtension_Upgrade.cs @@ -0,0 +1,491 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to Upgrade Machine Extensions. + /// + /// [OpenAPI] UpgradeExtensions=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/upgradeExtensions" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStackHCIVmExtension_Upgrade", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to Upgrade Machine Extensions.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/upgradeExtensions", ApiVersion = "2023-03-15-preview")] + public partial class UpdateAzStackHCIVmExtension_Upgrade : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade _extensionUpgradeParameter; + + /// Describes the Machine Extension Upgrade Properties. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Describes the Machine Extension Upgrade Properties.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Describes the Machine Extension Upgrade Properties.", + SerializedName = @"extensionUpgradeParameters", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade ExtensionUpgradeParameter { get => this._extensionUpgradeParameter; set => this._extensionUpgradeParameter = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _machineName; + + /// The name of the hybrid machine. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the hybrid machine.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the hybrid machine.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string MachineName { get => this._machineName; set => this._machineName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzStackHCIVmExtension_Upgrade + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.UpdateAzStackHCIVmExtension_Upgrade Clone() + { + var clone = new UpdateAzStackHCIVmExtension_Upgrade(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.MachineName = this.MachineName; + clone.ExtensionUpgradeParameter = this.ExtensionUpgradeParameter; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'UpgradeExtensions' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.UpgradeExtensions(SubscriptionId, ResourceGroupName, MachineName, ExtensionUpgradeParameter, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,MachineName=MachineName,body=ExtensionUpgradeParameter}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzStackHCIVmExtension_Upgrade() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, MachineName=MachineName, body=ExtensionUpgradeParameter }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, MachineName=MachineName, body=ExtensionUpgradeParameter }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmExtension_UpgradeExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmExtension_UpgradeExpanded.cs new file mode 100644 index 000000000000..84339472cdd6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmExtension_UpgradeExpanded.cs @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to Upgrade Machine Extensions. + /// + /// [OpenAPI] UpgradeExtensions=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/upgradeExtensions" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStackHCIVmExtension_UpgradeExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to Upgrade Machine Extensions.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/upgradeExtensions", ApiVersion = "2023-03-15-preview")] + public partial class UpdateAzStackHCIVmExtension_UpgradeExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Describes the Machine Extension Upgrade Properties. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade _extensionUpgradeParametersBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpgrade(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Describes the Extension Target Properties. + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Describes the Extension Target Properties.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Describes the Extension Target Properties.", + SerializedName = @"extensionTargets", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTarget) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTarget ExtensionTarget { get => _extensionUpgradeParametersBody.ExtensionTarget ?? null /* object */; set => _extensionUpgradeParametersBody.ExtensionTarget = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _machineName; + + /// The name of the hybrid machine. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the hybrid machine.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the hybrid machine.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string MachineName { get => this._machineName; set => this._machineName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzStackHCIVmExtension_UpgradeExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.UpdateAzStackHCIVmExtension_UpgradeExpanded Clone() + { + var clone = new UpdateAzStackHCIVmExtension_UpgradeExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._extensionUpgradeParametersBody = this._extensionUpgradeParametersBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.MachineName = this.MachineName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'UpgradeExtensions' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.UpgradeExtensions(SubscriptionId, ResourceGroupName, MachineName, _extensionUpgradeParametersBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,MachineName=MachineName,body=_extensionUpgradeParametersBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzStackHCIVmExtension_UpgradeExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, MachineName=MachineName, body=_extensionUpgradeParametersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, MachineName=MachineName, body=_extensionUpgradeParametersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmExtension_UpgradeViaIdentity.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmExtension_UpgradeViaIdentity.cs new file mode 100644 index 000000000000..9da10b83b6cb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmExtension_UpgradeViaIdentity.cs @@ -0,0 +1,470 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to Upgrade Machine Extensions. + /// + /// [OpenAPI] UpgradeExtensions=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/upgradeExtensions" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStackHCIVmExtension_UpgradeViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to Upgrade Machine Extensions.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/upgradeExtensions", ApiVersion = "2023-03-15-preview")] + public partial class UpdateAzStackHCIVmExtension_UpgradeViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade _extensionUpgradeParameter; + + /// Describes the Machine Extension Upgrade Properties. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Describes the Machine Extension Upgrade Properties.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Describes the Machine Extension Upgrade Properties.", + SerializedName = @"extensionUpgradeParameters", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade ExtensionUpgradeParameter { get => this._extensionUpgradeParameter; set => this._extensionUpgradeParameter = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzStackHCIVmExtension_UpgradeViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.UpdateAzStackHCIVmExtension_UpgradeViaIdentity Clone() + { + var clone = new UpdateAzStackHCIVmExtension_UpgradeViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ExtensionUpgradeParameter = this.ExtensionUpgradeParameter; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'UpgradeExtensions' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.UpgradeExtensionsViaIdentity(InputObject.Id, ExtensionUpgradeParameter, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MachineName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MachineName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.UpgradeExtensions(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.MachineName ?? null, ExtensionUpgradeParameter, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=ExtensionUpgradeParameter}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzStackHCIVmExtension_UpgradeViaIdentity() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=ExtensionUpgradeParameter }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=ExtensionUpgradeParameter }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmExtension_UpgradeViaIdentityExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmExtension_UpgradeViaIdentityExpanded.cs new file mode 100644 index 000000000000..7f7be74f8a0c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmExtension_UpgradeViaIdentityExpanded.cs @@ -0,0 +1,472 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to Upgrade Machine Extensions. + /// + /// [OpenAPI] UpgradeExtensions=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/upgradeExtensions" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStackHCIVmExtension_UpgradeViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to Upgrade Machine Extensions.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/upgradeExtensions", ApiVersion = "2023-03-15-preview")] + public partial class UpdateAzStackHCIVmExtension_UpgradeViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Describes the Machine Extension Upgrade Properties. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade _extensionUpgradeParametersBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpgrade(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Describes the Extension Target Properties. + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Describes the Extension Target Properties.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Describes the Extension Target Properties.", + SerializedName = @"extensionTargets", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTarget) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTarget ExtensionTarget { get => _extensionUpgradeParametersBody.ExtensionTarget ?? null /* object */; set => _extensionUpgradeParametersBody.ExtensionTarget = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzStackHCIVmExtension_UpgradeViaIdentityExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.UpdateAzStackHCIVmExtension_UpgradeViaIdentityExpanded Clone() + { + var clone = new UpdateAzStackHCIVmExtension_UpgradeViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._extensionUpgradeParametersBody = this._extensionUpgradeParametersBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'UpgradeExtensions' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.UpgradeExtensionsViaIdentity(InputObject.Id, _extensionUpgradeParametersBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MachineName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MachineName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.UpgradeExtensions(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.MachineName ?? null, _extensionUpgradeParametersBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_extensionUpgradeParametersBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzStackHCIVmExtension_UpgradeViaIdentityExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_extensionUpgradeParametersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_extensionUpgradeParametersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmGalleryImage_UpdateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmGalleryImage_UpdateExpanded.cs new file mode 100644 index 000000000000..bc084e0eca05 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmGalleryImage_UpdateExpanded.cs @@ -0,0 +1,489 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to update a gallery image. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStackHCIVmGalleryImage_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to update a gallery image.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}", ApiVersion = "2023-09-01-preview")] + public partial class UpdateAzStackHCIVmGalleryImage_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The gallery images resource patch definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequest _galleryImagesBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImagesUpdateRequest(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the gallery image + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the gallery image")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the gallery image", + SerializedName = @"galleryImageName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("GalleryImageName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags Tag { get => _galleryImagesBody.Tag ?? null /* object */; set => _galleryImagesBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzStackHCIVmGalleryImage_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.UpdateAzStackHCIVmGalleryImage_UpdateExpanded Clone() + { + var clone = new UpdateAzStackHCIVmGalleryImage_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._galleryImagesBody = this._galleryImagesBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'GalleryImagesUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.GalleryImagesUpdate(SubscriptionId, ResourceGroupName, Name, _galleryImagesBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_galleryImagesBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzStackHCIVmGalleryImage_UpdateExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_galleryImagesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_galleryImagesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmGalleryImage_UpdateViaIdentityExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmGalleryImage_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..cc848e6612f0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmGalleryImage_UpdateViaIdentityExpanded.cs @@ -0,0 +1,469 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to update a gallery image. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStackHCIVmGalleryImage_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to update a gallery image.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}", ApiVersion = "2023-09-01-preview")] + public partial class UpdateAzStackHCIVmGalleryImage_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The gallery images resource patch definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequest _galleryImagesBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.GalleryImagesUpdateRequest(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Resource tags + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags Tag { get => _galleryImagesBody.Tag ?? null /* object */; set => _galleryImagesBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzStackHCIVmGalleryImage_UpdateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.UpdateAzStackHCIVmGalleryImage_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzStackHCIVmGalleryImage_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._galleryImagesBody = this._galleryImagesBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'GalleryImagesUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.GalleryImagesUpdateViaIdentity(InputObject.Id, _galleryImagesBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.GalleryImageName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.GalleryImageName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.GalleryImagesUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.GalleryImageName ?? null, _galleryImagesBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_galleryImagesBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzStackHCIVmGalleryImage_UpdateViaIdentityExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_galleryImagesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_galleryImagesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmLogicalNetwork_UpdateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmLogicalNetwork_UpdateExpanded.cs new file mode 100644 index 000000000000..c9d07679a1a3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmLogicalNetwork_UpdateExpanded.cs @@ -0,0 +1,488 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to update a logical network. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStackHCIVmLogicalNetwork_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to update a logical network.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}", ApiVersion = "2023-09-01-preview")] + public partial class UpdateAzStackHCIVmLogicalNetwork_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The logical network resource patch definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequest _logicalNetworksBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworksUpdateRequest(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the logical network + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the logical network")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the logical network", + SerializedName = @"logicalNetworkName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("LogicalNetworkName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags Tag { get => _logicalNetworksBody.Tag ?? null /* object */; set => _logicalNetworksBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzStackHCIVmLogicalNetwork_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.UpdateAzStackHCIVmLogicalNetwork_UpdateExpanded Clone() + { + var clone = new UpdateAzStackHCIVmLogicalNetwork_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._logicalNetworksBody = this._logicalNetworksBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'LogicalNetworksUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.LogicalNetworksUpdate(SubscriptionId, ResourceGroupName, Name, _logicalNetworksBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_logicalNetworksBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzStackHCIVmLogicalNetwork_UpdateExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_logicalNetworksBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_logicalNetworksBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmLogicalNetwork_UpdateViaIdentityExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmLogicalNetwork_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..a698bf09b3f1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmLogicalNetwork_UpdateViaIdentityExpanded.cs @@ -0,0 +1,468 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to update a logical network. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStackHCIVmLogicalNetwork_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to update a logical network.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}", ApiVersion = "2023-09-01-preview")] + public partial class UpdateAzStackHCIVmLogicalNetwork_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The logical network resource patch definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequest _logicalNetworksBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.LogicalNetworksUpdateRequest(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Resource tags + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworksUpdateRequestTags Tag { get => _logicalNetworksBody.Tag ?? null /* object */; set => _logicalNetworksBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzStackHCIVmLogicalNetwork_UpdateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.UpdateAzStackHCIVmLogicalNetwork_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzStackHCIVmLogicalNetwork_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._logicalNetworksBody = this._logicalNetworksBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'LogicalNetworksUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.LogicalNetworksUpdateViaIdentity(InputObject.Id, _logicalNetworksBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.LogicalNetworkName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.LogicalNetworkName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.LogicalNetworksUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.LogicalNetworkName ?? null, _logicalNetworksBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_logicalNetworksBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzStackHCIVmLogicalNetwork_UpdateViaIdentityExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_logicalNetworksBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_logicalNetworksBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmMachineExtension_UpdateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmMachineExtension_UpdateExpanded.cs new file mode 100644 index 000000000000..70940539992a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmMachineExtension_UpdateExpanded.cs @@ -0,0 +1,602 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to create or update the extension. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStackHCIVmMachineExtension_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to create or update the extension.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}", ApiVersion = "2023-03-15-preview")] + public partial class UpdateAzStackHCIVmMachineExtension_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Describes a Machine Extension Update. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdate _extensionParametersBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdate(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// + /// Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, + /// however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true.", + SerializedName = @"autoUpgradeMinorVersion", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter AutoUpgradeMinorVersion { get => _extensionParametersBody.AutoUpgradeMinorVersion ?? default(global::System.Management.Automation.SwitchParameter); set => _extensionParametersBody.AutoUpgradeMinorVersion = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// + /// Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available.", + SerializedName = @"enableAutomaticUpgrade", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter EnableAutomaticUpgrade { get => _extensionParametersBody.EnableAutomaticUpgrade ?? default(global::System.Management.Automation.SwitchParameter); set => _extensionParametersBody.EnableAutomaticUpgrade = value; } + + /// Backing field for property. + private string _extensionName; + + /// The name of the machine extension. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the machine extension.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the machine extension.", + SerializedName = @"extensionName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ExtensionName { get => this._extensionName; set => this._extensionName = value; } + + /// + /// How the extension handler should be forced to update even if the extension configuration has not changed. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "How the extension handler should be forced to update even if the extension configuration has not changed.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"How the extension handler should be forced to update even if the extension configuration has not changed.", + SerializedName = @"forceUpdateTag", + PossibleTypes = new [] { typeof(string) })] + public string ForceUpdateTag { get => _extensionParametersBody.ForceUpdateTag ?? null; set => _extensionParametersBody.ForceUpdateTag = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _machineName; + + /// The name of the machine where the extension should be created or updated. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the machine where the extension should be created or updated.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the machine where the extension should be created or updated.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string MachineName { get => this._machineName; set => this._machineName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.", + SerializedName = @"protectedSettings", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings ProtectedSetting { get => _extensionParametersBody.ProtectedSetting ?? null /* object */; set => _extensionParametersBody.ProtectedSetting = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The name of the extension handler publisher. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the extension handler publisher.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extension handler publisher.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + public string Publisher { get => _extensionParametersBody.Publisher ?? null; set => _extensionParametersBody.Publisher = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Json formatted public settings for the extension. + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Json formatted public settings for the extension.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Json formatted public settings for the extension.", + SerializedName = @"settings", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings Setting { get => _extensionParametersBody.Setting ?? null /* object */; set => _extensionParametersBody.Setting = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags Tag { get => _extensionParametersBody.Tag ?? null /* object */; set => _extensionParametersBody.Tag = value; } + + /// Specifies the type of the extension; an example is "CustomScriptExtension". + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the type of the extension; an example is \"CustomScriptExtension\".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the type of the extension; an example is ""CustomScriptExtension"".", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + public string Type { get => _extensionParametersBody.Type ?? null; set => _extensionParametersBody.Type = value; } + + /// Specifies the version of the script handler. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the version of the script handler.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the version of the script handler.", + SerializedName = @"typeHandlerVersion", + PossibleTypes = new [] { typeof(string) })] + public string TypeHandlerVersion { get => _extensionParametersBody.TypeHandlerVersion ?? null; set => _extensionParametersBody.TypeHandlerVersion = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzStackHCIVmMachineExtension_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.UpdateAzStackHCIVmMachineExtension_UpdateExpanded Clone() + { + var clone = new UpdateAzStackHCIVmMachineExtension_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._extensionParametersBody = this._extensionParametersBody; + clone.ResourceGroupName = this.ResourceGroupName; + clone.MachineName = this.MachineName; + clone.ExtensionName = this.ExtensionName; + clone.SubscriptionId = this.SubscriptionId; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'MachineExtensionsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MachineExtensionsUpdate(ResourceGroupName, MachineName, ExtensionName, SubscriptionId, _extensionParametersBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,MachineName=MachineName,ExtensionName=ExtensionName,SubscriptionId=SubscriptionId,body=_extensionParametersBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzStackHCIVmMachineExtension_UpdateExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, MachineName=MachineName, ExtensionName=ExtensionName, SubscriptionId=SubscriptionId, body=_extensionParametersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, MachineName=MachineName, ExtensionName=ExtensionName, SubscriptionId=SubscriptionId, body=_extensionParametersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmMachineExtension_UpdateViaIdentityExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmMachineExtension_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..465d91397b3e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmMachineExtension_UpdateViaIdentityExpanded.cs @@ -0,0 +1,572 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to create or update the extension. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStackHCIVmMachineExtension_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to create or update the extension.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}", ApiVersion = "2023-03-15-preview")] + public partial class UpdateAzStackHCIVmMachineExtension_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Describes a Machine Extension Update. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdate _extensionParametersBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineExtensionUpdate(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// + /// Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, + /// however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true.", + SerializedName = @"autoUpgradeMinorVersion", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter AutoUpgradeMinorVersion { get => _extensionParametersBody.AutoUpgradeMinorVersion ?? default(global::System.Management.Automation.SwitchParameter); set => _extensionParametersBody.AutoUpgradeMinorVersion = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// + /// Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available.", + SerializedName = @"enableAutomaticUpgrade", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter EnableAutomaticUpgrade { get => _extensionParametersBody.EnableAutomaticUpgrade ?? default(global::System.Management.Automation.SwitchParameter); set => _extensionParametersBody.EnableAutomaticUpgrade = value; } + + /// + /// How the extension handler should be forced to update even if the extension configuration has not changed. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "How the extension handler should be forced to update even if the extension configuration has not changed.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"How the extension handler should be forced to update even if the extension configuration has not changed.", + SerializedName = @"forceUpdateTag", + PossibleTypes = new [] { typeof(string) })] + public string ForceUpdateTag { get => _extensionParametersBody.ForceUpdateTag ?? null; set => _extensionParametersBody.ForceUpdateTag = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.", + SerializedName = @"protectedSettings", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings ProtectedSetting { get => _extensionParametersBody.ProtectedSetting ?? null /* object */; set => _extensionParametersBody.ProtectedSetting = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The name of the extension handler publisher. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the extension handler publisher.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extension handler publisher.", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + public string Publisher { get => _extensionParametersBody.Publisher ?? null; set => _extensionParametersBody.Publisher = value; } + + /// Json formatted public settings for the extension. + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Json formatted public settings for the extension.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Json formatted public settings for the extension.", + SerializedName = @"settings", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings Setting { get => _extensionParametersBody.Setting ?? null /* object */; set => _extensionParametersBody.Setting = value; } + + /// Resource tags + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags Tag { get => _extensionParametersBody.Tag ?? null /* object */; set => _extensionParametersBody.Tag = value; } + + /// Specifies the type of the extension; an example is "CustomScriptExtension". + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the type of the extension; an example is \"CustomScriptExtension\".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the type of the extension; an example is ""CustomScriptExtension"".", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + public string Type { get => _extensionParametersBody.Type ?? null; set => _extensionParametersBody.Type = value; } + + /// Specifies the version of the script handler. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the version of the script handler.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the version of the script handler.", + SerializedName = @"typeHandlerVersion", + PossibleTypes = new [] { typeof(string) })] + public string TypeHandlerVersion { get => _extensionParametersBody.TypeHandlerVersion ?? null; set => _extensionParametersBody.TypeHandlerVersion = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzStackHCIVmMachineExtension_UpdateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.UpdateAzStackHCIVmMachineExtension_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzStackHCIVmMachineExtension_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._extensionParametersBody = this._extensionParametersBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'MachineExtensionsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.MachineExtensionsUpdateViaIdentity(InputObject.Id, _extensionParametersBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MachineName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MachineName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ExtensionName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ExtensionName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.MachineExtensionsUpdate(InputObject.ResourceGroupName ?? null, InputObject.MachineName ?? null, InputObject.ExtensionName ?? null, InputObject.SubscriptionId ?? null, _extensionParametersBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_extensionParametersBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzStackHCIVmMachineExtension_UpdateViaIdentityExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_extensionParametersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_extensionParametersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmMachine_UpdateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmMachine_UpdateExpanded.cs new file mode 100644 index 000000000000..ba39406cbbb7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmMachine_UpdateExpanded.cs @@ -0,0 +1,597 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to update a hybrid machine. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStackHCIVmMachine_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to update a hybrid machine.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}", ApiVersion = "2023-03-15-preview")] + public partial class UpdateAzStackHCIVmMachine_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Describes a hybrid machine Update. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdate _parametersBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineUpdate(); + + /// The correlation ID passed in from RSM per upgrade. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The correlation ID passed in from RSM per upgrade.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The correlation ID passed in from RSM per upgrade.", + SerializedName = @"correlationId", + PossibleTypes = new [] { typeof(string) })] + public string AgentUpgradeCorrelationId { get => _parametersBody.AgentUpgradeCorrelationId ?? null; set => _parametersBody.AgentUpgradeCorrelationId = value; } + + /// Specifies the version info w.r.t AgentUpgrade for the machine. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the version info w.r.t AgentUpgrade for the machine.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the version info w.r.t AgentUpgrade for the machine.", + SerializedName = @"desiredVersion", + PossibleTypes = new [] { typeof(string) })] + public string AgentUpgradeDesiredVersion { get => _parametersBody.AgentUpgradeDesiredVersion ?? null; set => _parametersBody.AgentUpgradeDesiredVersion = value; } + + /// Specifies if RSM should try to upgrade this machine + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies if RSM should try to upgrade this machine")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies if RSM should try to upgrade this machine", + SerializedName = @"enableAutomaticUpgrade", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter AgentUpgradeEnableAutomaticUpgrade { get => _parametersBody.AgentUpgradeEnableAutomaticUpgrade ?? default(global::System.Management.Automation.SwitchParameter); set => _parametersBody.AgentUpgradeEnableAutomaticUpgrade = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// The identity type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The identity type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identity type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType IdentityType { get => _parametersBody.IdentityType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType)""); set => _parametersBody.IdentityType = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc.", + SerializedName = @"kind", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind Kind { get => _parametersBody.Kind ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind)""); set => _parametersBody.Kind = value; } + + /// Specifies the assessment mode. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the assessment mode.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the assessment mode.", + SerializedName = @"assessmentMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes LinuxConfigurationPatchSettingsAssessmentMode { get => _parametersBody.LinuxConfigurationPatchSettingsAssessmentMode ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes)""); set => _parametersBody.LinuxConfigurationPatchSettingsAssessmentMode = value; } + + /// Specifies the patch mode. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the patch mode.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the patch mode.", + SerializedName = @"patchMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes LinuxConfigurationPatchSettingsPatchMode { get => _parametersBody.LinuxConfigurationPatchSettingsPatchMode ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes)""); set => _parametersBody.LinuxConfigurationPatchSettingsPatchMode = value; } + + /// The city or locality where the resource is located. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The city or locality where the resource is located.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The city or locality where the resource is located.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + public string LocationDataCity { get => _parametersBody.LocationDataCity ?? null; set => _parametersBody.LocationDataCity = value; } + + /// The country or region where the resource is located + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The country or region where the resource is located")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The country or region where the resource is located", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + public string LocationDataCountryOrRegion { get => _parametersBody.LocationDataCountryOrRegion ?? null; set => _parametersBody.LocationDataCountryOrRegion = value; } + + /// The district, state, or province where the resource is located. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The district, state, or province where the resource is located.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The district, state, or province where the resource is located.", + SerializedName = @"district", + PossibleTypes = new [] { typeof(string) })] + public string LocationDataDistrict { get => _parametersBody.LocationDataDistrict ?? null; set => _parametersBody.LocationDataDistrict = value; } + + /// A canonical name for the geographic or physical location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "A canonical name for the geographic or physical location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A canonical name for the geographic or physical location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string LocationDataName { get => _parametersBody.LocationDataName ?? null; set => _parametersBody.LocationDataName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the hybrid machine. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the hybrid machine.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the hybrid machine.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("MachineName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any.", + SerializedName = @"parentClusterResourceId", + PossibleTypes = new [] { typeof(string) })] + public string ParentClusterResourceId { get => _parametersBody.ParentClusterResourceId ?? null; set => _parametersBody.ParentClusterResourceId = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The resource id of the private link scope this machine is assigned to, if any. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The resource id of the private link scope this machine is assigned to, if any.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource id of the private link scope this machine is assigned to, if any.", + SerializedName = @"privateLinkScopeResourceId", + PossibleTypes = new [] { typeof(string) })] + public string PrivateLinkScopeResourceId { get => _parametersBody.PrivateLinkScopeResourceId ?? null; set => _parametersBody.PrivateLinkScopeResourceId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags Tag { get => _parametersBody.Tag ?? null /* object */; set => _parametersBody.Tag = value; } + + /// Specifies the assessment mode. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the assessment mode.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the assessment mode.", + SerializedName = @"assessmentMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes WindowsConfigurationPatchSettingsAssessmentMode { get => _parametersBody.WindowsConfigurationPatchSettingsAssessmentMode ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes)""); set => _parametersBody.WindowsConfigurationPatchSettingsAssessmentMode = value; } + + /// Specifies the patch mode. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the patch mode.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the patch mode.", + SerializedName = @"patchMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes WindowsConfigurationPatchSettingsPatchMode { get => _parametersBody.WindowsConfigurationPatchSettingsPatchMode ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes)""); set => _parametersBody.WindowsConfigurationPatchSettingsPatchMode = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'MachinesUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MachinesUpdate(SubscriptionId, ResourceGroupName, Name, _parametersBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_parametersBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzStackHCIVmMachine_UpdateExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_parametersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_parametersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmMachine_UpdateViaIdentityExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmMachine_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..1660e8498909 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmMachine_UpdateViaIdentityExpanded.cs @@ -0,0 +1,578 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to update a hybrid machine. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStackHCIVmMachine_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to update a hybrid machine.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}", ApiVersion = "2023-03-15-preview")] + public partial class UpdateAzStackHCIVmMachine_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Describes a hybrid machine Update. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineUpdate _parametersBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.MachineUpdate(); + + /// The correlation ID passed in from RSM per upgrade. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The correlation ID passed in from RSM per upgrade.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The correlation ID passed in from RSM per upgrade.", + SerializedName = @"correlationId", + PossibleTypes = new [] { typeof(string) })] + public string AgentUpgradeCorrelationId { get => _parametersBody.AgentUpgradeCorrelationId ?? null; set => _parametersBody.AgentUpgradeCorrelationId = value; } + + /// Specifies the version info w.r.t AgentUpgrade for the machine. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the version info w.r.t AgentUpgrade for the machine.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the version info w.r.t AgentUpgrade for the machine.", + SerializedName = @"desiredVersion", + PossibleTypes = new [] { typeof(string) })] + public string AgentUpgradeDesiredVersion { get => _parametersBody.AgentUpgradeDesiredVersion ?? null; set => _parametersBody.AgentUpgradeDesiredVersion = value; } + + /// Specifies if RSM should try to upgrade this machine + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies if RSM should try to upgrade this machine")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies if RSM should try to upgrade this machine", + SerializedName = @"enableAutomaticUpgrade", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter AgentUpgradeEnableAutomaticUpgrade { get => _parametersBody.AgentUpgradeEnableAutomaticUpgrade ?? default(global::System.Management.Automation.SwitchParameter); set => _parametersBody.AgentUpgradeEnableAutomaticUpgrade = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// The identity type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The identity type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identity type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType IdentityType { get => _parametersBody.IdentityType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType)""); set => _parametersBody.IdentityType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc.", + SerializedName = @"kind", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind Kind { get => _parametersBody.Kind ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind)""); set => _parametersBody.Kind = value; } + + /// Specifies the assessment mode. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the assessment mode.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the assessment mode.", + SerializedName = @"assessmentMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes LinuxConfigurationPatchSettingsAssessmentMode { get => _parametersBody.LinuxConfigurationPatchSettingsAssessmentMode ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes)""); set => _parametersBody.LinuxConfigurationPatchSettingsAssessmentMode = value; } + + /// Specifies the patch mode. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the patch mode.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the patch mode.", + SerializedName = @"patchMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes LinuxConfigurationPatchSettingsPatchMode { get => _parametersBody.LinuxConfigurationPatchSettingsPatchMode ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes)""); set => _parametersBody.LinuxConfigurationPatchSettingsPatchMode = value; } + + /// The city or locality where the resource is located. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The city or locality where the resource is located.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The city or locality where the resource is located.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + public string LocationDataCity { get => _parametersBody.LocationDataCity ?? null; set => _parametersBody.LocationDataCity = value; } + + /// The country or region where the resource is located + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The country or region where the resource is located")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The country or region where the resource is located", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + public string LocationDataCountryOrRegion { get => _parametersBody.LocationDataCountryOrRegion ?? null; set => _parametersBody.LocationDataCountryOrRegion = value; } + + /// The district, state, or province where the resource is located. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The district, state, or province where the resource is located.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The district, state, or province where the resource is located.", + SerializedName = @"district", + PossibleTypes = new [] { typeof(string) })] + public string LocationDataDistrict { get => _parametersBody.LocationDataDistrict ?? null; set => _parametersBody.LocationDataDistrict = value; } + + /// A canonical name for the geographic or physical location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "A canonical name for the geographic or physical location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A canonical name for the geographic or physical location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string LocationDataName { get => _parametersBody.LocationDataName ?? null; set => _parametersBody.LocationDataName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any.", + SerializedName = @"parentClusterResourceId", + PossibleTypes = new [] { typeof(string) })] + public string ParentClusterResourceId { get => _parametersBody.ParentClusterResourceId ?? null; set => _parametersBody.ParentClusterResourceId = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The resource id of the private link scope this machine is assigned to, if any. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The resource id of the private link scope this machine is assigned to, if any.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource id of the private link scope this machine is assigned to, if any.", + SerializedName = @"privateLinkScopeResourceId", + PossibleTypes = new [] { typeof(string) })] + public string PrivateLinkScopeResourceId { get => _parametersBody.PrivateLinkScopeResourceId ?? null; set => _parametersBody.PrivateLinkScopeResourceId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Resource tags + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags Tag { get => _parametersBody.Tag ?? null /* object */; set => _parametersBody.Tag = value; } + + /// Specifies the assessment mode. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the assessment mode.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the assessment mode.", + SerializedName = @"assessmentMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes WindowsConfigurationPatchSettingsAssessmentMode { get => _parametersBody.WindowsConfigurationPatchSettingsAssessmentMode ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes)""); set => _parametersBody.WindowsConfigurationPatchSettingsAssessmentMode = value; } + + /// Specifies the patch mode. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the patch mode.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the patch mode.", + SerializedName = @"patchMode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes WindowsConfigurationPatchSettingsPatchMode { get => _parametersBody.WindowsConfigurationPatchSettingsPatchMode ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes)""); set => _parametersBody.WindowsConfigurationPatchSettingsPatchMode = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'MachinesUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.MachinesUpdateViaIdentity(InputObject.Id, _parametersBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MachineName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MachineName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.MachinesUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.MachineName ?? null, _parametersBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_parametersBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzStackHCIVmMachine_UpdateViaIdentityExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_parametersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_parametersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmMarketplaceGalleryImage_UpdateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmMarketplaceGalleryImage_UpdateExpanded.cs new file mode 100644 index 000000000000..44422fa734ac --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmMarketplaceGalleryImage_UpdateExpanded.cs @@ -0,0 +1,491 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to update a marketplace gallery image. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStackHCIVmMarketplaceGalleryImage_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to update a marketplace gallery image.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}", ApiVersion = "2023-09-01-preview")] + public partial class UpdateAzStackHCIVmMarketplaceGalleryImage_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The marketplace gallery image resource patch definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequest _marketplaceGalleryImagesBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImagesUpdateRequest(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the marketplace gallery image + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the marketplace gallery image")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the marketplace gallery image", + SerializedName = @"marketplaceGalleryImageName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("MarketplaceGalleryImageName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTags Tag { get => _marketplaceGalleryImagesBody.Tag ?? null /* object */; set => _marketplaceGalleryImagesBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzStackHCIVmMarketplaceGalleryImage_UpdateExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.UpdateAzStackHCIVmMarketplaceGalleryImage_UpdateExpanded Clone() + { + var clone = new UpdateAzStackHCIVmMarketplaceGalleryImage_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._marketplaceGalleryImagesBody = this._marketplaceGalleryImagesBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'MarketplaceGalleryImagesUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MarketplaceGalleryImagesUpdate(SubscriptionId, ResourceGroupName, Name, _marketplaceGalleryImagesBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_marketplaceGalleryImagesBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzStackHCIVmMarketplaceGalleryImage_UpdateExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_marketplaceGalleryImagesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_marketplaceGalleryImagesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmMarketplaceGalleryImage_UpdateViaIdentityExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmMarketplaceGalleryImage_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..7a879e36f851 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmMarketplaceGalleryImage_UpdateViaIdentityExpanded.cs @@ -0,0 +1,470 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to update a marketplace gallery image. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStackHCIVmMarketplaceGalleryImage_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to update a marketplace gallery image.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}", ApiVersion = "2023-09-01-preview")] + public partial class UpdateAzStackHCIVmMarketplaceGalleryImage_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The marketplace gallery image resource patch definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequest _marketplaceGalleryImagesBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.MarketplaceGalleryImagesUpdateRequest(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Resource tags + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTags Tag { get => _marketplaceGalleryImagesBody.Tag ?? null /* object */; set => _marketplaceGalleryImagesBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzStackHCIVmMarketplaceGalleryImage_UpdateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.UpdateAzStackHCIVmMarketplaceGalleryImage_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzStackHCIVmMarketplaceGalleryImage_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._marketplaceGalleryImagesBody = this._marketplaceGalleryImagesBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'MarketplaceGalleryImagesUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.MarketplaceGalleryImagesUpdateViaIdentity(InputObject.Id, _marketplaceGalleryImagesBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MarketplaceGalleryImageName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MarketplaceGalleryImageName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.MarketplaceGalleryImagesUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.MarketplaceGalleryImageName ?? null, _marketplaceGalleryImagesBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_marketplaceGalleryImagesBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public UpdateAzStackHCIVmMarketplaceGalleryImage_UpdateViaIdentityExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_marketplaceGalleryImagesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_marketplaceGalleryImagesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmNetworkInterface_UpdateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmNetworkInterface_UpdateExpanded.cs new file mode 100644 index 000000000000..eaae69ecbd98 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmNetworkInterface_UpdateExpanded.cs @@ -0,0 +1,488 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to update a network interface. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStackHCIVmNetworkInterface_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to update a network interface.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}", ApiVersion = "2023-09-01-preview")] + public partial class UpdateAzStackHCIVmNetworkInterface_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The network interface resource patch definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequest _networkInterfacesBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfacesUpdateRequest(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the network interface + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the network interface")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the network interface", + SerializedName = @"networkInterfaceName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("NetworkInterfaceName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags Tag { get => _networkInterfacesBody.Tag ?? null /* object */; set => _networkInterfacesBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzStackHCIVmNetworkInterface_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.UpdateAzStackHCIVmNetworkInterface_UpdateExpanded Clone() + { + var clone = new UpdateAzStackHCIVmNetworkInterface_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._networkInterfacesBody = this._networkInterfacesBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'NetworkInterfacesUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.NetworkInterfacesUpdate(SubscriptionId, ResourceGroupName, Name, _networkInterfacesBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_networkInterfacesBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzStackHCIVmNetworkInterface_UpdateExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_networkInterfacesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_networkInterfacesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmNetworkInterface_UpdateViaIdentityExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmNetworkInterface_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..38f899327a37 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmNetworkInterface_UpdateViaIdentityExpanded.cs @@ -0,0 +1,468 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to update a network interface. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStackHCIVmNetworkInterface_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to update a network interface.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}", ApiVersion = "2023-09-01-preview")] + public partial class UpdateAzStackHCIVmNetworkInterface_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The network interface resource patch definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequest _networkInterfacesBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.NetworkInterfacesUpdateRequest(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Resource tags + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfacesUpdateRequestTags Tag { get => _networkInterfacesBody.Tag ?? null /* object */; set => _networkInterfacesBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzStackHCIVmNetworkInterface_UpdateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.UpdateAzStackHCIVmNetworkInterface_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzStackHCIVmNetworkInterface_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._networkInterfacesBody = this._networkInterfacesBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'NetworkInterfacesUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.NetworkInterfacesUpdateViaIdentity(InputObject.Id, _networkInterfacesBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.NetworkInterfaceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.NetworkInterfaceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.NetworkInterfacesUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.NetworkInterfaceName ?? null, _networkInterfacesBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_networkInterfacesBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzStackHCIVmNetworkInterface_UpdateViaIdentityExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_networkInterfacesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_networkInterfacesBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmStoragePath_UpdateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmStoragePath_UpdateExpanded.cs new file mode 100644 index 000000000000..897756401416 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmStoragePath_UpdateExpanded.cs @@ -0,0 +1,488 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to update a storage container. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStackHCIVmStoragePath_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to update a storage container.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}", ApiVersion = "2023-09-01-preview")] + public partial class UpdateAzStackHCIVmStoragePath_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The storage container resource patch definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequest _storageContainersBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainersUpdateRequest(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the storage container + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the storage container")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the storage container", + SerializedName = @"storageContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("StorageContainerName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags Tag { get => _storageContainersBody.Tag ?? null /* object */; set => _storageContainersBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzStackHCIVmStoragePath_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.UpdateAzStackHCIVmStoragePath_UpdateExpanded Clone() + { + var clone = new UpdateAzStackHCIVmStoragePath_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._storageContainersBody = this._storageContainersBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'StorageContainersUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.StorageContainersUpdate(SubscriptionId, ResourceGroupName, Name, _storageContainersBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_storageContainersBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzStackHCIVmStoragePath_UpdateExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_storageContainersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_storageContainersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmStoragePath_UpdateViaIdentityExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmStoragePath_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..9a7e4e436f91 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmStoragePath_UpdateViaIdentityExpanded.cs @@ -0,0 +1,466 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to update a storage container. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStackHCIVmStoragePath_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to update a storage container.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}", ApiVersion = "2023-09-01-preview")] + public partial class UpdateAzStackHCIVmStoragePath_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The storage container resource patch definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequest _storageContainersBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.StorageContainersUpdateRequest(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Resource tags + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainersUpdateRequestTags Tag { get => _storageContainersBody.Tag ?? null /* object */; set => _storageContainersBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzStackHCIVmStoragePath_UpdateViaIdentityExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.UpdateAzStackHCIVmStoragePath_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzStackHCIVmStoragePath_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._storageContainersBody = this._storageContainersBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'StorageContainersUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.StorageContainersUpdateViaIdentity(InputObject.Id, _storageContainersBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.StorageContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.StorageContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.StorageContainersUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.StorageContainerName ?? null, _storageContainersBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_storageContainersBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzStackHCIVmStoragePath_UpdateViaIdentityExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_storageContainersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_storageContainersBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmVirtualHardDisk_UpdateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmVirtualHardDisk_UpdateExpanded.cs new file mode 100644 index 000000000000..d608af44734b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmVirtualHardDisk_UpdateExpanded.cs @@ -0,0 +1,488 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to update a virtual hard disk. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStackHCIVmVirtualHardDisk_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to update a virtual hard disk.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}", ApiVersion = "2023-09-01-preview")] + public partial class UpdateAzStackHCIVmVirtualHardDisk_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The virtual hard disk resource patch definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequest _virtualHardDisksBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisksUpdateRequest(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Name of the virtual hard disk + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the virtual hard disk")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the virtual hard disk", + SerializedName = @"virtualHardDiskName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("VirtualHardDiskName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Resource tags + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags Tag { get => _virtualHardDisksBody.Tag ?? null /* object */; set => _virtualHardDisksBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzStackHCIVmVirtualHardDisk_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.UpdateAzStackHCIVmVirtualHardDisk_UpdateExpanded Clone() + { + var clone = new UpdateAzStackHCIVmVirtualHardDisk_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._virtualHardDisksBody = this._virtualHardDisksBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualHardDisksUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualHardDisksUpdate(SubscriptionId, ResourceGroupName, Name, _virtualHardDisksBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name,body=_virtualHardDisksBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzStackHCIVmVirtualHardDisk_UpdateExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_virtualHardDisksBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_virtualHardDisksBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmVirtualHardDisk_UpdateViaIdentityExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmVirtualHardDisk_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..34eb93a0a37b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmVirtualHardDisk_UpdateViaIdentityExpanded.cs @@ -0,0 +1,468 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to update a virtual hard disk. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStackHCIVmVirtualHardDisk_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to update a virtual hard disk.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}", ApiVersion = "2023-09-01-preview")] + public partial class UpdateAzStackHCIVmVirtualHardDisk_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The virtual hard disk resource patch definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequest _virtualHardDisksBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualHardDisksUpdateRequest(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Resource tags + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisksUpdateRequestTags Tag { get => _virtualHardDisksBody.Tag ?? null /* object */; set => _virtualHardDisksBody.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzStackHCIVmVirtualHardDisk_UpdateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.UpdateAzStackHCIVmVirtualHardDisk_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzStackHCIVmVirtualHardDisk_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._virtualHardDisksBody = this._virtualHardDisksBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualHardDisksUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.VirtualHardDisksUpdateViaIdentity(InputObject.Id, _virtualHardDisksBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.VirtualHardDiskName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VirtualHardDiskName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.VirtualHardDisksUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.VirtualHardDiskName ?? null, _virtualHardDisksBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_virtualHardDisksBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzStackHCIVmVirtualHardDisk_UpdateViaIdentityExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_virtualHardDisksBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_virtualHardDisksBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmVirtualMachine_UpdateExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmVirtualMachine_UpdateExpanded.cs new file mode 100644 index 000000000000..20329efc4410 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmVirtualMachine_UpdateExpanded.cs @@ -0,0 +1,581 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to update a virtual machine instance. + /// + /// [OpenAPI] Update=>PATCH:"/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStackHCIVmVirtualMachine_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to update a virtual machine instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", ApiVersion = "2023-09-01-preview")] + public partial class UpdateAzStackHCIVmVirtualMachine_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The virtual machine instance resource patch definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequest _virtualMachineInstanceBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceUpdateRequest(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// RAM in MB for the virtual machine instance + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "RAM in MB for the virtual machine instance")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"RAM in MB for the virtual machine instance", + SerializedName = @"memoryMB", + PossibleTypes = new [] { typeof(long) })] + public long HardwareProfileMemoryMb { get => _virtualMachineInstanceBody.HardwareProfileMemoryMb ?? default(long); set => _virtualMachineInstanceBody.HardwareProfileMemoryMb = value; } + + /// number of processors for the virtual machine instance + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "number of processors for the virtual machine instance")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"number of processors for the virtual machine instance", + SerializedName = @"processors", + PossibleTypes = new [] { typeof(int) })] + public int HardwareProfileProcessor { get => _virtualMachineInstanceBody.HardwareProfileProcessor ?? default(int); set => _virtualMachineInstanceBody.HardwareProfileProcessor = value; } + + /// . + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @".", + SerializedName = @"vmSize", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum HardwareProfileVMSize { get => _virtualMachineInstanceBody.HardwareProfileVMSize ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum)""); set => _virtualMachineInstanceBody.HardwareProfileVMSize = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// The identity type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The identity type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identity type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType IdentityType { get => _virtualMachineInstanceBody.IdentityType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType)""); set => _virtualMachineInstanceBody.IdentityType = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter LinuxConfigurationProvisionVMAgent { get => _virtualMachineInstanceBody.LinuxConfigurationProvisionVMAgent ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.LinuxConfigurationProvisionVMAgent = value; } + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter LinuxConfigurationProvisionVMConfigAgent { get => _virtualMachineInstanceBody.LinuxConfigurationProvisionVMConfigAgent ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.LinuxConfigurationProvisionVMConfigAgent = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance", + SerializedName = @"networkInterfaces", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem[] NetworkProfileNetworkInterface { get => _virtualMachineInstanceBody.NetworkProfileNetworkInterface ?? null /* arrayOf */; set => _virtualMachineInstanceBody.NetworkProfileNetworkInterface = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// ComputerName - name of the computer + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "ComputerName - name of the computer")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ComputerName - name of the computer", + SerializedName = @"computerName", + PossibleTypes = new [] { typeof(string) })] + public string OSProfileComputerName { get => _virtualMachineInstanceBody.OSProfileComputerName ?? null; set => _virtualMachineInstanceBody.OSProfileComputerName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceUri; + + /// + /// The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.")] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended.", + SerializedName = @"resourceUri", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public string ResourceUri { get => this._resourceUri; set => this._resourceUri = value; } + + /// adds data disks to the virtual machine instance for the update call + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "adds data disks to the virtual machine instance for the update call")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"adds data disks to the virtual machine instance for the update call", + SerializedName = @"dataDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem[] StorageProfileDataDisk { get => _virtualMachineInstanceBody.StorageProfileDataDisk ?? null /* arrayOf */; set => _virtualMachineInstanceBody.StorageProfileDataDisk = value; } + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter WindowConfigurationProvisionVMAgent { get => _virtualMachineInstanceBody.WindowConfigurationProvisionVMAgent ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.WindowConfigurationProvisionVMAgent = value; } + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter WindowConfigurationProvisionVMConfigAgent { get => _virtualMachineInstanceBody.WindowConfigurationProvisionVMConfigAgent ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.WindowConfigurationProvisionVMConfigAgent = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzStackHCIVmVirtualMachine_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.UpdateAzStackHCIVmVirtualMachine_UpdateExpanded Clone() + { + var clone = new UpdateAzStackHCIVmVirtualMachine_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._virtualMachineInstanceBody = this._virtualMachineInstanceBody; + clone.ResourceUri = this.ResourceUri; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualMachineInstancesUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualMachineInstancesUpdate(ResourceUri, _virtualMachineInstanceBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri,body=_virtualMachineInstanceBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzStackHCIVmVirtualMachine_UpdateExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri, body=_virtualMachineInstanceBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceUri=ResourceUri, body=_virtualMachineInstanceBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmVirtualMachine_UpdateViaIdentityExpanded.cs b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmVirtualMachine_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..957f74e18b82 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/cmdlets/UpdateAzStackHCIVmVirtualMachine_UpdateViaIdentityExpanded.cs @@ -0,0 +1,586 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + using System; + + /// The operation to update a virtual machine instance. + /// + /// [OpenAPI] Update=>PATCH:"/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzStackHCIVmVirtualMachine_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance))] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Description(@"The operation to update a virtual machine instance.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.HttpPath(Path = "/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", ApiVersion = "2023-09-01-preview")] + public partial class UpdateAzStackHCIVmVirtualMachine_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// The virtual machine instance resource patch definition. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstanceUpdateRequest _virtualMachineInstanceBody = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.VirtualMachineInstanceUpdateRequest(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.StackHciVM Client => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// RAM in MB for the virtual machine instance + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "RAM in MB for the virtual machine instance")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"RAM in MB for the virtual machine instance", + SerializedName = @"memoryMB", + PossibleTypes = new [] { typeof(long) })] + public long HardwareProfileMemoryMb { get => _virtualMachineInstanceBody.HardwareProfileMemoryMb ?? default(long); set => _virtualMachineInstanceBody.HardwareProfileMemoryMb = value; } + + /// number of processors for the virtual machine instance + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "number of processors for the virtual machine instance")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"number of processors for the virtual machine instance", + SerializedName = @"processors", + PossibleTypes = new [] { typeof(int) })] + public int HardwareProfileProcessor { get => _virtualMachineInstanceBody.HardwareProfileProcessor ?? default(int); set => _virtualMachineInstanceBody.HardwareProfileProcessor = value; } + + /// . + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @".", + SerializedName = @"vmSize", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum HardwareProfileVMSize { get => _virtualMachineInstanceBody.HardwareProfileVMSize ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum)""); set => _virtualMachineInstanceBody.HardwareProfileVMSize = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// The identity type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The identity type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The identity type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType))] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType IdentityType { get => _virtualMachineInstanceBody.IdentityType ?? ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType)""); set => _virtualMachineInstanceBody.IdentityType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter LinuxConfigurationProvisionVMAgent { get => _virtualMachineInstanceBody.LinuxConfigurationProvisionVMAgent ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.LinuxConfigurationProvisionVMAgent = value; } + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter LinuxConfigurationProvisionVMConfigAgent { get => _virtualMachineInstanceBody.LinuxConfigurationProvisionVMConfigAgent ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.LinuxConfigurationProvisionVMConfigAgent = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance", + SerializedName = @"networkInterfaces", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem[] NetworkProfileNetworkInterface { get => _virtualMachineInstanceBody.NetworkProfileNetworkInterface ?? null /* arrayOf */; set => _virtualMachineInstanceBody.NetworkProfileNetworkInterface = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// ComputerName - name of the computer + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "ComputerName - name of the computer")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ComputerName - name of the computer", + SerializedName = @"computerName", + PossibleTypes = new [] { typeof(string) })] + public string OSProfileComputerName { get => _virtualMachineInstanceBody.OSProfileComputerName ?? null; set => _virtualMachineInstanceBody.OSProfileComputerName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// adds data disks to the virtual machine instance for the update call + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "adds data disks to the virtual machine instance for the update call")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"adds data disks to the virtual machine instance for the update call", + SerializedName = @"dataDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem) })] + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem[] StorageProfileDataDisk { get => _virtualMachineInstanceBody.StorageProfileDataDisk ?? null /* arrayOf */; set => _virtualMachineInstanceBody.StorageProfileDataDisk = value; } + + /// + /// Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + /// process. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process.", + SerializedName = @"provisionVMAgent", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter WindowConfigurationProvisionVMAgent { get => _virtualMachineInstanceBody.WindowConfigurationProvisionVMAgent ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.WindowConfigurationProvisionVMAgent = value; } + + /// + /// Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category(global::Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process.", + SerializedName = @"provisionVMConfigAgent", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter WindowConfigurationProvisionVMConfigAgent { get => _virtualMachineInstanceBody.WindowConfigurationProvisionVMConfigAgent ?? default(global::System.Management.Automation.SwitchParameter); set => _virtualMachineInstanceBody.WindowConfigurationProvisionVMConfigAgent = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzStackHCIVmVirtualMachine_UpdateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Cmdlets.UpdateAzStackHCIVmVirtualMachine_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzStackHCIVmVirtualMachine_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._virtualMachineInstanceBody = this._virtualMachineInstanceBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualMachineInstancesUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.VirtualMachineInstancesUpdateViaIdentity(InputObject.Id, _virtualMachineInstanceBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceUri) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceUri"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.VirtualMachineInstancesUpdate(InputObject.ResourceUri ?? null, _virtualMachineInstanceBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_virtualMachineInstanceBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzStackHCIVmVirtualMachine_UpdateViaIdentityExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_virtualMachineInstanceBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_virtualMachineInstanceBody }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/AsyncCommandRuntime.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/AsyncCommandRuntime.cs new file mode 100644 index 000000000000..5188b52a6f0f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/AsyncCommandRuntime.cs @@ -0,0 +1,832 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + using System.Management.Automation; + using System.Management.Automation.Host; + using System.Threading; + using System.Linq; + + internal interface IAsyncCommandRuntimeExtensions + { + Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep Wrap(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep func); + System.Collections.Generic.IEnumerable Wrap(System.Collections.Generic.IEnumerable funcs); + + T ExecuteSync(System.Func step); + } + + public class AsyncCommandRuntime : System.Management.Automation.ICommandRuntime2, IAsyncCommandRuntimeExtensions, System.IDisposable + { + private ICommandRuntime2 originalCommandRuntime; + private System.Threading.Thread originalThread; + public bool AllowInteractive { get; set; } = false; + + public CancellationToken cancellationToken; + SemaphoreSlim semaphore = new SemaphoreSlim(1, 1); + ManualResetEventSlim readyToRun = new ManualResetEventSlim(false); + ManualResetEventSlim completed = new ManualResetEventSlim(false); + + System.Action runOnMainThread; + + private System.Management.Automation.PSCmdlet cmdlet; + + internal AsyncCommandRuntime(System.Management.Automation.PSCmdlet cmdlet, CancellationToken cancellationToken) + { + this.originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2; + this.originalThread = System.Threading.Thread.CurrentThread; + this.cancellationToken = cancellationToken; + this.cmdlet = cmdlet; + if (cmdlet.PagingParameters != null) + { + WriteDebug("Client side pagination is enabled for this cmdlet"); + } + cmdlet.CommandRuntime = this; + } + + public PSHost Host => this.originalCommandRuntime.Host; + + public PSTransactionContext CurrentPSTransaction => this.originalCommandRuntime.CurrentPSTransaction; + + private void CheckForInteractive() + { + // This is an interactive call -- if we are not on the original thread, this will only work if this was done at ACR creation time; + if (!AllowInteractive) + { + throw new System.Exception("AsyncCommandRuntime is not configured for interactive calls"); + } + } + private void WaitOurTurn() + { + // wait for our turn to play + semaphore?.Wait(cancellationToken); + + // ensure that completed is not set + completed.Reset(); + } + + private void WaitForCompletion() + { + // wait for the result (or cancellation!) + WaitHandle.WaitAny(new[] { cancellationToken.WaitHandle, completed?.WaitHandle }); + + // let go of the semaphore + semaphore?.Release(); + + } + + public bool ShouldContinue(string query, string caption, bool hasSecurityImpact, ref bool yesToAll, ref bool noToAll) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption, hasSecurityImpact, ref yesToAll, ref noToAll); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool yta = yesToAll; + bool nta = noToAll; + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption, hasSecurityImpact, ref yta, ref nta); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + yesToAll = yta; + noToAll = nta; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldContinue(string query, string caption) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldContinue(string query, string caption, ref bool yesToAll, ref bool noToAll) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption, ref yesToAll, ref noToAll); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool yta = yesToAll; + bool nta = noToAll; + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption, ref yta, ref nta); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + yesToAll = yta; + noToAll = nta; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string target) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(target); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(target); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string target, string action) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(target, action); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(target, action); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption, out ShouldProcessReason shouldProcessReason) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption, out shouldProcessReason); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + ShouldProcessReason reason = ShouldProcessReason.None; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption, out reason); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + shouldProcessReason = reason; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void ThrowTerminatingError(ErrorRecord errorRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.ThrowTerminatingError(errorRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.ThrowTerminatingError(errorRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool TransactionAvailable() + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.TransactionAvailable(); + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.TransactionAvailable(); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteCommandDetail(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteCommandDetail(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteCommandDetail(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteDebug(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteDebug(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteDebug(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteError(ErrorRecord errorRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteError(errorRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteError(errorRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteInformation(InformationRecord informationRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteInformation(informationRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteInformation(informationRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteObject(object sendToPipeline) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteObject(sendToPipeline); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteObject(sendToPipeline); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteObject(object sendToPipeline, bool enumerateCollection) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteObject(sendToPipeline, enumerateCollection); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteObject(sendToPipeline, enumerateCollection); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteProgress(ProgressRecord progressRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteProgress(progressRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteProgress(progressRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteProgress(long sourceId, ProgressRecord progressRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteProgress(sourceId, progressRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteProgress(sourceId, progressRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteVerbose(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteVerbose(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteVerbose(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteWarning(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteWarning(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteWarning(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void Wait(System.Threading.Tasks.Task ProcessRecordAsyncTask, System.Threading.CancellationToken cancellationToken) + { + do + { + WaitHandle.WaitAny(new[] { readyToRun.WaitHandle, ((System.IAsyncResult)ProcessRecordAsyncTask).AsyncWaitHandle }); + if (readyToRun.IsSet) + { + // reset the request for the next time + readyToRun.Reset(); + + // run the delegate on this thread + runOnMainThread(); + + // tell the originator everything is complete + completed.Set(); + } + } + while (!ProcessRecordAsyncTask.IsCompleted); + if (ProcessRecordAsyncTask.IsFaulted) + { + // don't unwrap a Aggregate Exception -- we'll lose the stack trace of the actual exception. + // if( ProcessRecordAsyncTask.Exception is System.AggregateException aggregate ) { + // throw aggregate.InnerException; + // } + throw ProcessRecordAsyncTask.Exception; + } + } + public Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep Wrap(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep func) => func.Target.GetType().Name != "Closure" ? func : (p1, p2, p3) => ExecuteSync>(() => func(p1, p2, p3)); + public System.Collections.Generic.IEnumerable Wrap(System.Collections.Generic.IEnumerable funcs) => funcs?.Select(Wrap); + + public T ExecuteSync(System.Func step) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return step(); + } + + T result = default(T); + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + // set the function to run + runOnMainThread = () => { result = step(); }; + // tell the main thread to go ahead + readyToRun.Set(); + // wait for the result (or cancellation!) + WaitForCompletion(); + // return + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void Dispose() + { + if (cmdlet != null) + { + cmdlet.CommandRuntime = this.originalCommandRuntime; + cmdlet = null; + } + + semaphore?.Dispose(); + semaphore = null; + readyToRun?.Dispose(); + readyToRun = null; + completed?.Dispose(); + completed = null; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/AsyncJob.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/AsyncJob.cs new file mode 100644 index 000000000000..87c1fd09f457 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/AsyncJob.cs @@ -0,0 +1,270 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + using System.Management.Automation; + using System.Management.Automation.Host; + using System.Threading; + + using System.Threading.Tasks; + + public class LongRunningJobCancelledException : System.Exception + { + public LongRunningJobCancelledException(string message) : base(message) + { + + } + } + + public class AsyncJob : Job, System.Management.Automation.ICommandRuntime2 + { + const int MaxRecords = 1000; + + private string _statusMessage = string.Empty; + + public override string StatusMessage => _statusMessage; + + public override bool HasMoreData => Output.Count > 0 || Progress.Count > 0 || Error.Count > 0 || Warning.Count > 0 || Verbose.Count > 0 || Debug.Count > 0; + + public override string Location => "localhost"; + + public PSHost Host => originalCommandRuntime.Host; + + public PSTransactionContext CurrentPSTransaction => originalCommandRuntime.CurrentPSTransaction; + + public override void StopJob() + { + Cancel(); + } + + private readonly PSCmdlet cmdlet; + private readonly ICommandRuntime2 originalCommandRuntime; + private readonly System.Threading.Thread originalThread; + + private void CheckForInteractive() + { + // This is an interactive call -- We should never allow interactivity in AsnycJob cmdlets. + throw new System.Exception("Cmdlets in AsyncJob; interactive calls are not permitted."); + } + private bool IsJobDone => CancellationToken.IsCancellationRequested || this.JobStateInfo.State == JobState.Failed || this.JobStateInfo.State == JobState.Stopped || this.JobStateInfo.State == JobState.Stopping || this.JobStateInfo.State == JobState.Completed; + + private readonly System.Action Cancel; + private readonly CancellationToken CancellationToken; + + internal AsyncJob(PSCmdlet cmdlet, string line, string name, CancellationToken cancellationToken, System.Action cancelMethod) : base(line, name) + { + SetJobState(JobState.NotStarted); + // know how to cancel/check for cancelation + this.CancellationToken = cancellationToken; + this.Cancel = cancelMethod; + + // we might need these. + this.originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2; + this.originalThread = System.Threading.Thread.CurrentThread; + + // the instance of the cmdlet we're going to run + this.cmdlet = cmdlet; + + // set the command runtime to the AsyncJob + cmdlet.CommandRuntime = this; + } + + /// + /// Monitors the task (which should be ProcessRecordAsync) to control + /// the lifetime of the job itself + /// + /// + public void Monitor(Task task) + { + SetJobState(JobState.Running); + task.ContinueWith(antecedent => + { + if (antecedent.IsCanceled) + { + // if the task was canceled, we're just going to call it completed. + SetJobState(JobState.Completed); + } + else if (antecedent.IsFaulted) + { + foreach (var innerException in antecedent.Exception.Flatten().InnerExceptions) + { + WriteError(new System.Management.Automation.ErrorRecord(innerException, string.Empty, System.Management.Automation.ErrorCategory.NotSpecified, null)); + } + + // a fault indicates an actual failure + SetJobState(JobState.Failed); + } + else + { + // otherwiser it's a completed state. + SetJobState(JobState.Completed); + } + }, CancellationToken); + } + + private void CheckForCancellation() + { + if (IsJobDone) + { + throw new LongRunningJobCancelledException("Long running job is canceled or stopping, continuation of the cmdlet is not permitted."); + } + } + + public void WriteInformation(InformationRecord informationRecord) + { + CheckForCancellation(); + + this.Information.Add(informationRecord); + } + + public bool ShouldContinue(string query, string caption, bool hasSecurityImpact, ref bool yesToAll, ref bool noToAll) + { + CheckForInteractive(); + return false; + } + + public void WriteDebug(string text) + { + _statusMessage = text; + CheckForCancellation(); + + if (Debug.IsOpen && Debug.Count < MaxRecords) + { + Debug.Add(new DebugRecord(text)); + } + } + + public void WriteError(ErrorRecord errorRecord) + { + if (Error.IsOpen) + { + Error.Add(errorRecord); + } + } + + public void WriteObject(object sendToPipeline) + { + CheckForCancellation(); + + if (Output.IsOpen) + { + Output.Add(new PSObject(sendToPipeline)); + } + } + + public void WriteObject(object sendToPipeline, bool enumerateCollection) + { + CheckForCancellation(); + + if (enumerateCollection && sendToPipeline is System.Collections.IEnumerable enumerable) + { + foreach (var item in enumerable) + { + WriteObject(item); + } + } + else + { + WriteObject(sendToPipeline); + } + } + + public void WriteProgress(ProgressRecord progressRecord) + { + CheckForCancellation(); + + if (Progress.IsOpen && Progress.Count < MaxRecords) + { + Progress.Add(progressRecord); + } + } + + public void WriteProgress(long sourceId, ProgressRecord progressRecord) + { + CheckForCancellation(); + + if (Progress.IsOpen && Progress.Count < MaxRecords) + { + Progress.Add(progressRecord); + } + } + + public void WriteVerbose(string text) + { + CheckForCancellation(); + + if (Verbose.IsOpen && Verbose.Count < MaxRecords) + { + Verbose.Add(new VerboseRecord(text)); + } + } + + public void WriteWarning(string text) + { + CheckForCancellation(); + + if (Warning.IsOpen && Warning.Count < MaxRecords) + { + Warning.Add(new WarningRecord(text)); + } + } + + public void WriteCommandDetail(string text) + { + WriteVerbose(text); + } + + public bool ShouldProcess(string target) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string target, string action) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption, out ShouldProcessReason shouldProcessReason) + { + CheckForInteractive(); + shouldProcessReason = ShouldProcessReason.None; + return false; + } + + public bool ShouldContinue(string query, string caption) + { + CheckForInteractive(); + return false; + } + + public bool ShouldContinue(string query, string caption, ref bool yesToAll, ref bool noToAll) + { + CheckForInteractive(); + return false; + } + + public bool TransactionAvailable() + { + // interactivity required? + return false; + } + + public void ThrowTerminatingError(ErrorRecord errorRecord) + { + if (Error.IsOpen) + { + Error.Add(errorRecord); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/AsyncOperationResponse.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/AsyncOperationResponse.cs new file mode 100644 index 000000000000..ad3c00d8b0dd --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/AsyncOperationResponse.cs @@ -0,0 +1,176 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + [System.ComponentModel.TypeConverter(typeof(AsyncOperationResponseTypeConverter))] + public class AsyncOperationResponse + { + private string _target; + public string Target { get => _target; set => _target = value; } + public AsyncOperationResponse() + { + } + internal AsyncOperationResponse(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json) + { + // pull target + { Target = If(json?.PropertyT("target"), out var _v) ? (string)_v : (string)Target; } + } + public string ToJsonString() + { + return $"{{ \"target\" : \"{this.Target}\" }}"; + } + + public static AsyncOperationResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject json ? new AsyncOperationResponse(json) : null; + } + + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static AsyncOperationResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(jsonText)); + + } + + public partial class AsyncOperationResponseTypeConverter : System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to a type + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static object ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(AsyncOperationResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AsyncOperationResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString()); ; + } + catch + { + // Unable to use JSON pattern + } + + if (typeof(System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return new AsyncOperationResponse { Target = (sourceValue as System.Management.Automation.PSObject).GetValueForProperty("target", "", global::System.Convert.ToString) }; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return new AsyncOperationResponse { Target = (sourceValue as global::System.Collections.IDictionary).GetValueForProperty("target", "", global::System.Convert.ToString) }; + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs new file mode 100644 index 000000000000..76cd8be2cb56 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs @@ -0,0 +1,113 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "CmdletSurface")] + [DoNotExport] + public class ExportCmdletSurface : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string CmdletFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public bool IncludeGeneralParameters { get; set; } + + [Parameter] + public bool UseExpandedFormat { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = GetScriptCmdlets(this, CmdletFolder) + .SelectMany(fi => fi.ToVariants()) + .Where(v => !v.IsDoNotExport) + .ToArray(); + var allProfiles = variants.SelectMany(v => v.Profiles).Distinct().ToArray(); + var profileGroups = allProfiles.Any() + ? variants + .SelectMany(v => (v.Profiles.Any() ? v.Profiles : allProfiles).Select(p => (profile: p, variant: v))) + .GroupBy(pv => pv.profile) + .Select(pvg => new ProfileGroup(pvg.Select(pv => pv.variant).ToArray(), pvg.Key)) + : new[] { new ProfileGroup(variants) }; + foreach (var profileGroup in profileGroups) + { + var variantGroups = profileGroup.Variants + .GroupBy(v => new { v.CmdletName }) + .Select(vg => new VariantGroup(ModuleName, vg.Key.CmdletName, vg.Select(v => v).ToArray(), String.Empty, profileGroup.ProfileName)); + var sb = UseExpandedFormat ? ExpandedFormat(variantGroups) : CondensedFormat(variantGroups); + Directory.CreateDirectory(OutputFolder); + File.WriteAllText(Path.Combine(OutputFolder, $"CmdletSurface-{profileGroup.ProfileName}.md"), sb.ToString()); + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private StringBuilder ExpandedFormat(IEnumerable variantGroups) + { + var sb = new StringBuilder(); + foreach (var variantGroup in variantGroups.OrderBy(vg => vg.CmdletName)) + { + sb.Append($"### {variantGroup.CmdletName}{Environment.NewLine}"); + var parameterGroups = variantGroup.ParameterGroups + .Where(pg => !pg.DontShow && (IncludeGeneralParameters || (pg.OrderCategory != ParameterCategory.Azure && pg.OrderCategory != ParameterCategory.Runtime))); + foreach (var parameterGroup in parameterGroups) + { + sb.Append($" - {parameterGroup.ParameterName} `{parameterGroup.ParameterType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + private StringBuilder CondensedFormat(IEnumerable variantGroups) + { + var sb = new StringBuilder(); + var condensedGroups = variantGroups + .GroupBy(vg => vg.CmdletNoun) + .Select(vgg => ( + CmdletNoun: vgg.Key, + CmdletVerbs: vgg.Select(vg => vg.CmdletVerb).OrderBy(cv => cv).ToArray(), + ParameterGroups: vgg.SelectMany(vg => vg.ParameterGroups).DistinctBy(p => p.ParameterName).ToArray(), + OutputTypes: vgg.SelectMany(vg => vg.OutputTypes).Select(ot => ot.Type).DistinctBy(t => t.Name).Select(t => t.ToSyntaxTypeName()).ToArray())) + .OrderBy(vg => vg.CmdletNoun); + foreach (var condensedGroup in condensedGroups) + { + sb.Append($"### {condensedGroup.CmdletNoun} [{String.Join(", ", condensedGroup.CmdletVerbs)}] `{String.Join(", ", condensedGroup.OutputTypes)}`{Environment.NewLine}"); + var parameterGroups = condensedGroup.ParameterGroups + .Where(pg => !pg.DontShow && (IncludeGeneralParameters || (pg.OrderCategory != ParameterCategory.Azure && pg.OrderCategory != ParameterCategory.Runtime))); + foreach (var parameterGroup in parameterGroups) + { + sb.Append($" - {parameterGroup.ParameterName} `{parameterGroup.ParameterType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs new file mode 100644 index 000000000000..e485022a788d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs @@ -0,0 +1,74 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ExampleStub")] + [DoNotExport] + public class ExportExampleStub : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + var exportDirectories = Directory.GetDirectories(ExportsFolder); + if (!exportDirectories.Any()) + { + exportDirectories = new[] { ExportsFolder }; + } + + var exampleText = String.Join(String.Empty, DefaultExampleHelpInfos.Select(ehi => ehi.ToHelpExampleOutput())); + foreach (var exportDirectory in exportDirectories) + { + var outputFolder = OutputFolder; + if (exportDirectory != ExportsFolder) + { + outputFolder = Path.Combine(OutputFolder, Path.GetFileName(exportDirectory)); + Directory.CreateDirectory(outputFolder); + } + + var cmdletFilePaths = GetScriptCmdlets(exportDirectory).Select(fi => Path.Combine(outputFolder, $"{fi.Name}.md")).ToArray(); + var currentExamplesFilePaths = Directory.GetFiles(outputFolder).ToArray(); + // Remove examples of non-existing cmdlets + var removedCmdletFilePaths = currentExamplesFilePaths.Except(cmdletFilePaths); + foreach (var removedCmdletFilePath in removedCmdletFilePaths) + { + File.Delete(removedCmdletFilePath); + } + + // Only create example stubs if they don't exist + foreach (var cmdletFilePath in cmdletFilePaths.Except(currentExamplesFilePaths)) + { + File.WriteAllText(cmdletFilePath, exampleText); + } + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs new file mode 100644 index 000000000000..3e836614dcd6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs @@ -0,0 +1,101 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "FormatPs1xml")] + [DoNotExport] + public class ExportFormatPs1xml : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string FilePath { get; set; } + + private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models"; + private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support"; + private const string PropertiesExcludedForTableview = @"Id,Type"; + + private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + + protected override void ProcessRecord() + { + try + { + var viewModels = GetFilteredViewParameters().Select(CreateViewModel).ToList(); + var ps1xml = new Configuration + { + ViewDefinitions = new ViewDefinitions + { + Views = viewModels + } + }; + File.WriteAllText(FilePath, ps1xml.ToXmlString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private static IEnumerable GetFilteredViewParameters() + { + //https://stackoverflow.com/a/79738/294804 + //https://stackoverflow.com/a/949285/294804 + var types = Assembly.GetExecutingAssembly().GetExportedTypes() + .Where(t => t.IsClass + && (t.Namespace.StartsWith(ModelNamespace) || t.Namespace.StartsWith(SupportNamespace)) + && !t.GetCustomAttributes().Any()); + return types.Select(t => new ViewParameters(t, t.GetProperties() + .Select(p => new PropertyFormat(p)) + .Where(pf => !pf.Property.GetCustomAttributes().Any() + && (!PropertiesExcludedForTableview.Split(',').Contains(pf.Property.Name)) + && (pf.FormatTable != null || (pf.Origin != PropertyOrigin.Inlined && pf.Property.PropertyType.IsPsSimple()))) + .OrderByDescending(pf => pf.Index.HasValue) + .ThenBy(pf => pf.Index) + .ThenByDescending(pf => pf.Origin.HasValue) + .ThenBy(pf => pf.Origin))).Where(vp => vp.Properties.Any()); + } + + private static View CreateViewModel(ViewParameters viewParameters) + { + var entries = viewParameters.Properties.Select(pf => + (TableColumnHeader: new TableColumnHeader { Label = pf.Label, Width = pf.Width }, + TableColumnItem: new TableColumnItem { PropertyName = pf.Property.Name })).ToArray(); + + return new View + { + Name = viewParameters.Type.FullName, + ViewSelectedBy = new ViewSelectedBy + { + TypeName = viewParameters.Type.FullName + }, + TableControl = new TableControl + { + TableHeaders = new TableHeaders + { + TableColumnHeaders = entries.Select(e => e.TableColumnHeader).ToList() + }, + TableRowEntries = new TableRowEntries + { + TableRowEntry = new TableRowEntry + { + TableColumnItems = new TableColumnItems + { + TableItems = entries.Select(e => e.TableColumnItem).ToList() + } + } + } + } + }; + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs new file mode 100644 index 000000000000..c63776f89cfa --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs @@ -0,0 +1,56 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.MarkdownRenderer; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "HelpMarkdown")] + [DoNotExport] + public class ExportHelpMarkdown : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSModuleInfo ModuleInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSObject[] FunctionInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSObject[] HelpInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string DocsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExamplesFolder { get; set; } + + [Parameter()] + public SwitchParameter AddComplexInterfaceInfo { get; set; } + + protected override void ProcessRecord() + { + try + { + var helpInfos = HelpInfo.Select(hi => hi.ToPsHelpInfo()); + var variantGroups = FunctionInfo.Select(fi => fi.BaseObject).Cast() + .Join(helpInfos, fi => fi.Name, phi => phi.CmdletName, (fi, phi) => fi.ToVariants(phi)) + .Select(va => new VariantGroup(ModuleInfo.Name, va.First().CmdletName, va, String.Empty)); + WriteMarkdowns(variantGroups, ModuleInfo.ToModuleInfo(), DocsFolder, ExamplesFolder, AddComplexInterfaceInfo.IsPresent); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs new file mode 100644 index 000000000000..bd836bca480a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs @@ -0,0 +1,117 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ModelSurface")] + [DoNotExport] + public class ExportModelSurface : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public bool UseExpandedFormat { get; set; } + + private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models"; + private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support"; + + protected override void ProcessRecord() + { + try + { + var types = Assembly.GetExecutingAssembly().GetExportedTypes() + .Where(t => t.IsClass && (t.Namespace.StartsWith(ModelNamespace) || t.Namespace.StartsWith(SupportNamespace))); + var typeInfos = types.Select(t => new ModelTypeInfo + { + Type = t, + TypeName = t.Name, + Properties = t.GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(p => !p.GetIndexParameters().Any()).OrderBy(p => p.Name).ToArray(), + NamespaceGroup = t.Namespace.Split('.').LastOrDefault().EmptyIfNull() + }).Where(mti => mti.Properties.Any()); + var sb = UseExpandedFormat ? ExpandedFormat(typeInfos) : CondensedFormat(typeInfos); + Directory.CreateDirectory(OutputFolder); + File.WriteAllText(Path.Combine(OutputFolder, "ModelSurface.md"), sb.ToString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private static StringBuilder ExpandedFormat(IEnumerable typeInfos) + { + var sb = new StringBuilder(); + foreach (var typeInfo in typeInfos.OrderBy(mti => mti.TypeName).ThenBy(mti => mti.NamespaceGroup)) + { + sb.Append($"### {typeInfo.TypeName} [{typeInfo.NamespaceGroup}]{Environment.NewLine}"); + foreach (var property in typeInfo.Properties) + { + sb.Append($" - {property.Name} `{property.PropertyType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + private static StringBuilder CondensedFormat(IEnumerable typeInfos) + { + var sb = new StringBuilder(); + var typeGroups = typeInfos + .GroupBy(mti => mti.TypeName) + .Select(tig => ( + Types: tig.Select(mti => mti.Type).ToArray(), + TypeName: tig.Key, + Properties: tig.SelectMany(mti => mti.Properties).DistinctBy(p => p.Name).OrderBy(p => p.Name).ToArray(), + NamespaceGroups: tig.Select(mti => mti.NamespaceGroup).OrderBy(ng => ng).ToArray() + )) + .OrderBy(tg => tg.TypeName); + foreach (var typeGroup in typeGroups) + { + var aType = typeGroup.Types.Select(GetAssociativeType).FirstOrDefault(t => t != null); + var aText = aType != null ? $@" \<{aType.ToSyntaxTypeName()}\>" : String.Empty; + sb.Append($"### {typeGroup.TypeName}{aText} [{String.Join(", ", typeGroup.NamespaceGroups)}]{Environment.NewLine}"); + foreach (var property in typeGroup.Properties) + { + var propertyAType = GetAssociativeType(property.PropertyType); + var propertyAText = propertyAType != null ? $" <{propertyAType.ToSyntaxTypeName()}>" : String.Empty; + var enumNames = GetEnumFieldNames(property.PropertyType.Unwrap()); + var enumNamesText = enumNames.Any() ? $" **{{{String.Join(", ", enumNames)}}}**" : String.Empty; + sb.Append($" - {property.Name} `{property.PropertyType.ToSyntaxTypeName()}{propertyAText}`{enumNamesText}{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + //https://stackoverflow.com/a/4963190/294804 + private static Type GetAssociativeType(Type type) => + type.GetInterfaces().FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IAssociativeArray<>))?.GetGenericArguments().First(); + + private static string[] GetEnumFieldNames(Type type) => + type.IsValueType && !type.IsPrimitive && type != typeof(decimal) && type != typeof(DateTime) + ? type.GetFields(BindingFlags.Public | BindingFlags.Static).Where(f => f.FieldType == type).Select(p => p.Name).ToArray() + : new string[] { }; + + private class ModelTypeInfo + { + public Type Type { get; set; } + public string TypeName { get; set; } + public PropertyInfo[] Properties { get; set; } + public string NamespaceGroup { get; set; } + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs new file mode 100644 index 000000000000..043727e0c288 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs @@ -0,0 +1,180 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.PsHelpers; +using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.MarkdownRenderer; +using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.PsProxyTypeExtensions; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ProxyCmdlet", DefaultParameterSetName = "Docs")] + [DoNotExport] + public class ExportProxyCmdlet : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string[] ModulePath { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string InternalFolder { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + [AllowEmptyString] + public string ModuleDescription { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + [ValidateNotNullOrEmpty] + public string DocsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExamplesFolder { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + public Guid ModuleGuid { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "NoDocs")] + public SwitchParameter ExcludeDocs { get; set; } + + [Parameter(ParameterSetName = "Docs")] + public SwitchParameter AddComplexInterfaceInfo { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = GetModuleCmdletsAndHelpInfo(this, ModulePath).SelectMany(ci => ci.ToVariants()).Where(v => !v.IsDoNotExport).ToArray(); + var allProfiles = variants.SelectMany(v => v.Profiles).Distinct().ToArray(); + var profileGroups = allProfiles.Any() + ? variants + .SelectMany(v => (v.Profiles.Any() ? v.Profiles : allProfiles).Select(p => (profile: p, variant: v))) + .GroupBy(pv => pv.profile) + .Select(pvg => new ProfileGroup(pvg.Select(pv => pv.variant).ToArray(), pvg.Key)) + : new[] { new ProfileGroup(variants) }; + var variantGroups = profileGroups.SelectMany(pg => pg.Variants + .GroupBy(v => new { v.CmdletName, v.IsInternal }) + .Select(vg => new VariantGroup(ModuleName, vg.Key.CmdletName, vg.Select(v => v).ToArray(), + Path.Combine(vg.Key.IsInternal ? InternalFolder : ExportsFolder, pg.ProfileFolder), pg.ProfileName, isInternal: vg.Key.IsInternal))) + .ToArray(); + + var license = new StringBuilder(); + license.Append(@" +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- +"); + HashSet LicenseSet = new HashSet(); + foreach (var variantGroup in variantGroups) + { + var parameterGroups = variantGroup.ParameterGroups.ToList(); + var isValidProfile = !String.IsNullOrEmpty(variantGroup.ProfileName) && variantGroup.ProfileName != NoProfiles; + var examplesFolder = isValidProfile ? Path.Combine(ExamplesFolder, variantGroup.ProfileName) : ExamplesFolder; + var markdownInfo = new MarkdownHelpInfo(variantGroup, examplesFolder); + List examples = new List(); + foreach (var it in markdownInfo.Examples) + { + examples.Add(it); + } + variantGroup.HelpInfo.Examples = examples.ToArray(); + var sb = new StringBuilder(); + sb.Append($"{Environment.NewLine}"); + sb.Append(variantGroup.ToHelpCommentOutput()); + sb.Append($"function {variantGroup.CmdletName} {{{Environment.NewLine}"); + sb.Append(variantGroup.Aliases.ToAliasOutput()); + sb.Append(variantGroup.OutputTypes.ToOutputTypeOutput()); + sb.Append(variantGroup.ToCmdletBindingOutput()); + sb.Append(variantGroup.ProfileName.ToProfileOutput()); + + sb.Append("param("); + sb.Append($"{(parameterGroups.Any() ? Environment.NewLine : String.Empty)}"); + foreach (var parameterGroup in parameterGroups) + { + var parameters = parameterGroup.HasAllVariants ? parameterGroup.Parameters.Take(1) : parameterGroup.Parameters; + parameters = parameters.Where(p => !p.IsHidden()); + if (!parameters.Any()) + { + continue; + } + foreach (var parameter in parameters) + { + sb.Append(parameter.ToParameterOutput(variantGroup.HasMultipleVariants, parameterGroup.HasAllVariants)); + } + sb.Append(parameterGroup.Aliases.ToAliasOutput(true)); + sb.Append(parameterGroup.HasValidateNotNull.ToValidateNotNullOutput()); + sb.Append(parameterGroup.HasAllowEmptyArray.ToAllowEmptyArray()); + sb.Append(parameterGroup.CompleterInfo.ToArgumentCompleterOutput()); + sb.Append(parameterGroup.OrderCategory.ToParameterCategoryOutput()); + sb.Append(parameterGroup.InfoAttribute.ToInfoOutput(parameterGroup.ParameterType)); + sb.Append(parameterGroup.ToDefaultInfoOutput()); + sb.Append(parameterGroup.ParameterType.ToParameterTypeOutput()); + sb.Append(parameterGroup.Description.ToParameterDescriptionOutput()); + sb.Append(parameterGroup.ParameterName.ToParameterNameOutput(parameterGroups.IndexOf(parameterGroup) == parameterGroups.Count - 1)); + } + sb.Append($"){Environment.NewLine}{Environment.NewLine}"); + + sb.Append(variantGroup.ToBeginOutput()); + sb.Append(variantGroup.ToProcessOutput()); + sb.Append(variantGroup.ToEndOutput()); + + sb.Append($"}}{Environment.NewLine}"); + + Directory.CreateDirectory(variantGroup.OutputFolder); + File.WriteAllText(variantGroup.FilePath, license.ToString()); + File.AppendAllText(variantGroup.FilePath, sb.ToString()); + if (!LicenseSet.Contains(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1"))) + { + // only add license in the header + File.AppendAllText(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1"), license.ToString()); + LicenseSet.Add(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1")); + } + File.AppendAllText(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1"), sb.ToString()); + } + + if (!ExcludeDocs) + { + var moduleInfo = new PsModuleHelpInfo(ModuleName, ModuleGuid, ModuleDescription); + foreach (var variantGroupsByProfile in variantGroups.GroupBy(vg => vg.ProfileName)) + { + var profileName = variantGroupsByProfile.Key; + var isValidProfile = !String.IsNullOrEmpty(profileName) && profileName != NoProfiles; + var docsFolder = isValidProfile ? Path.Combine(DocsFolder, profileName) : DocsFolder; + var examplesFolder = isValidProfile ? Path.Combine(ExamplesFolder, profileName) : ExamplesFolder; + WriteMarkdowns(variantGroupsByProfile, moduleInfo, docsFolder, examplesFolder, AddComplexInterfaceInfo.IsPresent); + } + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs new file mode 100644 index 000000000000..3053b24f5286 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs @@ -0,0 +1,191 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Text.RegularExpressions; +using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "Psd1")] + [DoNotExport] + public class ExportPsd1 : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string CustomFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string Psd1Path { get; set; } + + [Parameter(Mandatory = true)] + public Guid ModuleGuid { get; set; } + + private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + private const string CustomFolderRelative = "./custom"; + private const string Indent = Psd1Indent; + private const string Undefined = "undefined"; + private bool IsUndefined(string value) => string.Equals(Undefined, value, StringComparison.OrdinalIgnoreCase); + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + if (!Directory.Exists(CustomFolder)) + { + throw new ArgumentException($"Custom folder '{CustomFolder}' does not exist"); + } + + string version = Convert.ToString(@"1.1.0"); + // Validate the module version should be semantic version + // Following regex is official from https://semver.org/ + Regex rx = new Regex(@"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", RegexOptions.Compiled); + if (rx.Matches(version).Count != 1) + { + throw new ArgumentException("Module-version is not a valid Semantic Version"); + } + + string previewVersion = null; + if (version.Contains('-')) + { + string[] versions = version.Split("-".ToCharArray(), 2); + version = versions[0]; + previewVersion = versions[1]; + } + + var sb = new StringBuilder(); + sb.AppendLine("@{"); + sb.AppendLine($@"{GuidStart} = '{ModuleGuid}'"); + sb.AppendLine($@"{Indent}RootModule = '{"./Az.StackHCIVm.psm1"}'"); + sb.AppendLine($@"{Indent}ModuleVersion = '{version}'"); + sb.AppendLine($@"{Indent}CompatiblePSEditions = 'Core', 'Desktop'"); + sb.AppendLine($@"{Indent}Author = '{"Microsoft Corporation"}'"); + sb.AppendLine($@"{Indent}CompanyName = '{"Microsoft Corporation"}'"); + sb.AppendLine($@"{Indent}Copyright = '{"Microsoft Corporation. All rights reserved."}'"); + sb.AppendLine($@"{Indent}Description = '{"Microsoft Azure PowerShell: StackHciVM cmdlets"}'"); + sb.AppendLine($@"{Indent}PowerShellVersion = '5.1'"); + sb.AppendLine($@"{Indent}DotNetFrameworkVersion = '4.7.2'"); + + // RequiredModules + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}RequiredModules = @({"undefined"})"); + } + + // RequiredAssemblies + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}RequiredAssemblies = @({"undefined"})"); + } + else + { + sb.AppendLine($@"{Indent}RequiredAssemblies = '{"./bin/Az.StackHCIVm.private.dll"}'"); + } + + // NestedModules + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}NestedModules = @({"undefined"})"); + } + + // FormatsToProcess + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}FormatsToProcess = @({"undefined"})"); + } + else + { + var customFormatPs1xmlFiles = Directory.GetFiles(CustomFolder) + .Where(f => f.EndsWith(".format.ps1xml")) + .Select(f => $"{CustomFolderRelative}/{Path.GetFileName(f)}"); + var formatList = customFormatPs1xmlFiles.Prepend("./Az.StackHCIVm.format.ps1xml").ToPsList(); + sb.AppendLine($@"{Indent}FormatsToProcess = {formatList}"); + } + + // TypesToProcess + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}TypesToProcess = @({"undefined"})"); + } + + // ScriptsToProcess + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}ScriptsToProcess = @({"undefined"})"); + } + + var functionInfos = GetScriptCmdlets(ExportsFolder).ToArray(); + // FunctionsToExport + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}FunctionsToExport = @({"undefined"})"); + } + else + { + var cmdletsList = functionInfos.Select(fi => fi.Name).Distinct().Append("*").ToPsList(); + sb.AppendLine($@"{Indent}FunctionsToExport = {cmdletsList}"); + } + + // AliasesToExport + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}AliasesToExport = @({"undefined"})"); + } + else + { + var aliasesList = functionInfos.SelectMany(fi => fi.ScriptBlock.Attributes).ToAliasNames().Append("*").ToPsList(); + sb.AppendLine($@"{Indent}AliasesToExport = {aliasesList}"); + } + + // CmdletsToExport + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}CmdletsToExport = @({"undefined"})"); + } + + sb.AppendLine($@"{Indent}PrivateData = @{{"); + sb.AppendLine($@"{Indent}{Indent}PSData = @{{"); + + if (previewVersion != null) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}Prerelease = '{previewVersion}'"); + } + sb.AppendLine($@"{Indent}{Indent}{Indent}Tags = {"Azure ResourceManager ARM PSModule StackHciVM".Split(' ').ToPsList().NullIfEmpty() ?? "''"}"); + sb.AppendLine($@"{Indent}{Indent}{Indent}LicenseUri = '{"https://aka.ms/azps-license"}'"); + sb.AppendLine($@"{Indent}{Indent}{Indent}ProjectUri = '{"https://github.com/Azure/azure-powershell"}'"); + sb.AppendLine($@"{Indent}{Indent}{Indent}ReleaseNotes = ''"); + var profilesList = ""; + if (IsAzure && !String.IsNullOrEmpty(profilesList)) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}Profiles = {profilesList}"); + } + + sb.AppendLine($@"{Indent}{Indent}}}"); + sb.AppendLine($@"{Indent}}}"); + sb.AppendLine(@"}"); + + File.WriteAllText(Psd1Path, sb.ToString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs new file mode 100644 index 000000000000..83137e7a0863 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs @@ -0,0 +1,148 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "TestStub")] + [DoNotExport] + public class ExportTestStub : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public SwitchParameter IncludeGenerated { get; set; } + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + var exportDirectories = Directory.GetDirectories(ExportsFolder); + if (!exportDirectories.Any()) + { + exportDirectories = new[] { ExportsFolder }; + } + var utilFile = Path.Combine(OutputFolder, "utils.ps1"); + if (!File.Exists(utilFile)) + { + var sc = new StringBuilder(); + sc.AppendLine(@"function RandomString([bool]$allChars, [int32]$len) { + if ($allChars) { + return -join ((33..126) | Get-Random -Count $len | % {[char]$_}) + } else { + return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) + } +} +$env = @{} +if ($UsePreviousConfigForRecord) { + $previousEnv = Get-Content (Join-Path $PSScriptRoot 'env.json') | ConvertFrom-Json + $previousEnv.psobject.properties | Foreach-Object { $env[$_.Name] = $_.Value } +} +# Add script method called AddWithCache to $env, when useCache is set true, it will try to get the value from the $env first. +# example: $val = $env.AddWithCache('key', $val, $true) +$env | Add-Member -Type ScriptMethod -Value { param( [string]$key, [object]$val, [bool]$useCache) if ($this.Contains($key) -and $useCache) { return $this[$key] } else { $this[$key] = $val; return $val } } -Name 'AddWithCache' +function setupEnv() { + # Preload subscriptionId and tenant from context, which will be used in test + # as default. You could change them if needed. + $env.SubscriptionId = (Get-AzContext).Subscription.Id + $env.Tenant = (Get-AzContext).Tenant.Id + # For any resources you created for test, you should add it to $env here. + $envFile = 'env.json' + if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' + } + set-content -Path (Join-Path $PSScriptRoot $envFile) -Value (ConvertTo-Json $env) +} +function cleanupEnv() { + # Clean resources you create for testing +} +"); + File.WriteAllText(utilFile, sc.ToString()); + } + foreach (var exportDirectory in exportDirectories) + { + var outputFolder = OutputFolder; + if (exportDirectory != ExportsFolder) + { + outputFolder = Path.Combine(OutputFolder, Path.GetFileName(exportDirectory)); + Directory.CreateDirectory(outputFolder); + } + + var variantGroups = GetScriptCmdlets(exportDirectory) + .SelectMany(fi => fi.ToVariants()) + .Where(v => !v.IsDoNotExport) + .GroupBy(v => v.CmdletName) + .Select(vg => new VariantGroup(ModuleName, vg.Key, vg.Select(v => v).ToArray(), outputFolder, isTest: true)) + .Where(vtg => !File.Exists(vtg.FilePath) && (IncludeGenerated || !vtg.IsGenerated)); + + foreach (var variantGroup in variantGroups) + { + var sb = new StringBuilder(); + sb.AppendLine($"if(($null -eq $TestName) -or ($TestName -contains '{variantGroup.CmdletName}'))"); + sb.AppendLine(@"{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath)" +); + sb.AppendLine($@" $TestRecordingFile = Join-Path $PSScriptRoot '{variantGroup.CmdletName}.Recording.json'"); + sb.AppendLine(@" $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} +"); + + + sb.AppendLine($"Describe '{variantGroup.CmdletName}' {{"); + var variants = variantGroup.Variants + .Where(v => IncludeGenerated || !v.Attributes.OfType().Any()) + .ToList(); + + foreach (var variant in variants) + { + sb.AppendLine($"{Indent}It '{variant.VariantName}' -skip {{"); + sb.AppendLine($"{Indent}{Indent}{{ throw [System.NotImplementedException] }} | Should -Not -Throw"); + var variantSeparator = variants.IndexOf(variant) == variants.Count - 1 ? String.Empty : Environment.NewLine; + sb.AppendLine($"{Indent}}}{variantSeparator}"); + } + sb.AppendLine("}"); + + File.WriteAllText(variantGroup.FilePath, sb.ToString()); + } + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs new file mode 100644 index 000000000000..1444c8d0f783 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs @@ -0,0 +1,52 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "CommonParameter")] + [OutputType(typeof(Dictionary))] + [DoNotExport] + public class GetCommonParameter : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSCmdlet PSCmdlet { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public Dictionary PSBoundParameter { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = PSCmdlet.MyInvocation.MyCommand.ToVariants(); + var commonParameterNames = variants.ToParameterGroups() + .Where(pg => pg.OrderCategory == ParameterCategory.Azure || pg.OrderCategory == ParameterCategory.Runtime) + .Select(pg => pg.ParameterName); + if (variants.Any(v => v.SupportsShouldProcess)) + { + commonParameterNames = commonParameterNames.Append("Confirm").Append("WhatIf"); + } + if (variants.Any(v => v.SupportsPaging)) + { + commonParameterNames = commonParameterNames.Append("First").Append("Skip").Append("IncludeTotalCount"); + } + + var names = commonParameterNames.ToArray(); + var keys = PSBoundParameter.Keys.Where(k => names.Contains(k)); + WriteObject(keys.ToDictionary(key => key, key => PSBoundParameter[key]), true); + } + catch (System.Exception ee) + { + System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs new file mode 100644 index 000000000000..69594bcb4d57 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "ModuleGuid")] + [DoNotExport] + public class GetModuleGuid : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string Psd1Path { get; set; } + + protected override void ProcessRecord() + { + try + { + WriteObject(ReadGuidFromPsd1(Psd1Path)); + } + catch (System.Exception ee) + { + System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs new file mode 100644 index 000000000000..aa42d18ef98c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs @@ -0,0 +1,54 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "ScriptCmdlet")] + [OutputType(typeof(string[]))] + [DoNotExport] + public class GetScriptCmdlet : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ScriptFolder { get; set; } + + [Parameter] + public SwitchParameter IncludeDoNotExport { get; set; } + + [Parameter] + public SwitchParameter AsAlias { get; set; } + + [Parameter] + public SwitchParameter AsFunctionInfo { get; set; } + + protected override void ProcessRecord() + { + try + { + var functionInfos = GetScriptCmdlets(this, ScriptFolder) + .Where(fi => IncludeDoNotExport || !fi.ScriptBlock.Attributes.OfType().Any()) + .ToArray(); + if (AsFunctionInfo) + { + WriteObject(functionInfos, true); + return; + } + var aliases = functionInfos.SelectMany(i => i.ScriptBlock.Attributes).ToAliasNames(); + var names = functionInfos.Select(fi => fi.Name).Distinct(); + var output = (AsAlias ? aliases : names).DefaultIfEmpty("''").ToArray(); + WriteObject(output, true); + } + catch (System.Exception ee) + { + System.Console.Error.WriteLine($"{ee.GetType().Name}: {ee.Message}"); + System.Console.Error.WriteLine(ee.StackTrace); + throw ee; + } + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/CollectionExtensions.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/CollectionExtensions.cs new file mode 100644 index 000000000000..9debd2ae1404 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/CollectionExtensions.cs @@ -0,0 +1,20 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + internal static class CollectionExtensions + { + public static T[] NullIfEmpty(this T[] collection) => (collection?.Any() ?? false) ? collection : null; + public static IEnumerable EmptyIfNull(this IEnumerable collection) => collection ?? Enumerable.Empty(); + + // https://stackoverflow.com/a/4158364/294804 + public static IEnumerable DistinctBy(this IEnumerable collection, Func selector) => + collection.GroupBy(selector).Select(group => group.First()); + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs new file mode 100644 index 000000000000..a3903e87c64a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs @@ -0,0 +1,122 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.PsProxyOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + internal static class MarkdownRenderer + { + public static void WriteMarkdowns(IEnumerable variantGroups, PsModuleHelpInfo moduleHelpInfo, string docsFolder, string examplesFolder, bool AddComplexInterfaceInfo = true) + { + Directory.CreateDirectory(docsFolder); + var markdownInfos = variantGroups.Where(vg => !vg.IsInternal).Select(vg => new MarkdownHelpInfo(vg, examplesFolder)).OrderBy(mhi => mhi.CmdletName).ToArray(); + + foreach (var markdownInfo in markdownInfos) + { + var sb = new StringBuilder(); + sb.Append(markdownInfo.ToHelpMetadataOutput()); + sb.Append($"# {markdownInfo.CmdletName}{Environment.NewLine}{Environment.NewLine}"); + sb.Append($"## SYNOPSIS{Environment.NewLine}{markdownInfo.Synopsis.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## SYNTAX{Environment.NewLine}{Environment.NewLine}"); + var hasMultipleParameterSets = markdownInfo.SyntaxInfos.Length > 1; + foreach (var syntaxInfo in markdownInfo.SyntaxInfos) + { + sb.Append(syntaxInfo.ToHelpSyntaxOutput(hasMultipleParameterSets)); + } + + sb.Append($"## DESCRIPTION{Environment.NewLine}{markdownInfo.Description.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## EXAMPLES{Environment.NewLine}{Environment.NewLine}"); + foreach (var exampleInfo in markdownInfo.Examples) + { + sb.Append(exampleInfo.ToHelpExampleOutput()); + } + + sb.Append($"## PARAMETERS{Environment.NewLine}{Environment.NewLine}"); + foreach (var parameter in markdownInfo.Parameters) + { + sb.Append(parameter.ToHelpParameterOutput()); + } + if (markdownInfo.SupportsShouldProcess) + { + foreach (var parameter in SupportsShouldProcessParameters) + { + sb.Append(parameter.ToHelpParameterOutput()); + } + } + + sb.Append($"### CommonParameters{Environment.NewLine}This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## INPUTS{Environment.NewLine}{Environment.NewLine}"); + foreach (var input in markdownInfo.Inputs) + { + sb.Append($"### {input}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## OUTPUTS{Environment.NewLine}{Environment.NewLine}"); + foreach (var output in markdownInfo.Outputs) + { + sb.Append($"### {output}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## NOTES{Environment.NewLine}{Environment.NewLine}"); + if (markdownInfo.Aliases.Any()) + { + sb.Append($"ALIASES{Environment.NewLine}{Environment.NewLine}"); + } + foreach (var alias in markdownInfo.Aliases) + { + sb.Append($"{alias}{Environment.NewLine}{Environment.NewLine}"); + } + + if (AddComplexInterfaceInfo) + { + if (markdownInfo.ComplexInterfaceInfos.Any()) + { + sb.Append($"{ComplexParameterHeader}{Environment.NewLine}"); + } + foreach (var complexInterfaceInfo in markdownInfo.ComplexInterfaceInfos) + { + sb.Append($"{complexInterfaceInfo.ToNoteOutput(includeDashes: true, includeBackticks: true)}{Environment.NewLine}{Environment.NewLine}"); + } + + } + + sb.Append($"## RELATED LINKS{Environment.NewLine}{Environment.NewLine}"); + foreach (var relatedLink in markdownInfo.RelatedLinks) + { + sb.Append($"{relatedLink}{Environment.NewLine}{Environment.NewLine}"); + } + + File.WriteAllText(Path.Combine(docsFolder, $"{markdownInfo.CmdletName}.md"), sb.ToString()); + } + + WriteModulePage(moduleHelpInfo, markdownInfos, docsFolder); + } + + private static void WriteModulePage(PsModuleHelpInfo moduleInfo, MarkdownHelpInfo[] markdownInfos, string docsFolder) + { + var sb = new StringBuilder(); + sb.Append(moduleInfo.ToModulePageMetadataOutput()); + sb.Append($"# {moduleInfo.Name} Module{Environment.NewLine}"); + sb.Append($"## Description{Environment.NewLine}{moduleInfo.Description.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## {moduleInfo.Name} Cmdlets{Environment.NewLine}"); + foreach (var markdownInfo in markdownInfos) + { + sb.Append(markdownInfo.ToModulePageCmdletOutput()); + } + + File.WriteAllText(Path.Combine(docsFolder, $"{moduleInfo.Name}.md"), sb.ToString()); + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Models/PsFormatTypes.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Models/PsFormatTypes.cs new file mode 100644 index 000000000000..d9c7ed94ee40 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Models/PsFormatTypes.cs @@ -0,0 +1,138 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + internal class ViewParameters + { + public Type Type { get; } + public IEnumerable Properties { get; } + + public ViewParameters(Type type, IEnumerable properties) + { + Type = type; + Properties = properties; + } + } + + internal class PropertyFormat + { + public PropertyInfo Property { get; } + public FormatTableAttribute FormatTable { get; } + + public int? Index { get; } + public string Label { get; } + public int? Width { get; } + public PropertyOrigin? Origin { get; } + + public PropertyFormat(PropertyInfo propertyInfo) + { + Property = propertyInfo; + FormatTable = Property.GetCustomAttributes().FirstOrDefault(); + var origin = Property.GetCustomAttributes().FirstOrDefault(); + + Index = FormatTable?.HasIndex ?? false ? (int?)FormatTable.Index : null; + Label = FormatTable?.Label ?? propertyInfo.Name; + Width = FormatTable?.HasWidth ?? false ? (int?)FormatTable.Width : null; + // If we have an index, we don't want to use Origin. + Origin = FormatTable?.HasIndex ?? false ? null : origin?.Origin; + } + } + + [Serializable] + [XmlRoot(nameof(Configuration))] + public class Configuration + { + [XmlElement("ViewDefinitions")] + public ViewDefinitions ViewDefinitions { get; set; } + } + + [Serializable] + public class ViewDefinitions + { + //https://stackoverflow.com/a/10518657/294804 + [XmlElement("View")] + public List Views { get; set; } + } + + [Serializable] + public class View + { + [XmlElement(nameof(Name))] + public string Name { get; set; } + [XmlElement(nameof(ViewSelectedBy))] + public ViewSelectedBy ViewSelectedBy { get; set; } + [XmlElement(nameof(TableControl))] + public TableControl TableControl { get; set; } + } + + [Serializable] + public class ViewSelectedBy + { + [XmlElement(nameof(TypeName))] + public string TypeName { get; set; } + } + + [Serializable] + public class TableControl + { + [XmlElement(nameof(TableHeaders))] + public TableHeaders TableHeaders { get; set; } + [XmlElement(nameof(TableRowEntries))] + public TableRowEntries TableRowEntries { get; set; } + } + + [Serializable] + public class TableHeaders + { + [XmlElement("TableColumnHeader")] + public List TableColumnHeaders { get; set; } + } + + [Serializable] + public class TableColumnHeader + { + [XmlElement(nameof(Label))] + public string Label { get; set; } + [XmlElement(nameof(Width))] + public int? Width { get; set; } + + //https://stackoverflow.com/a/4095225/294804 + public bool ShouldSerializeWidth() => Width.HasValue; + } + + [Serializable] + public class TableRowEntries + { + [XmlElement(nameof(TableRowEntry))] + public TableRowEntry TableRowEntry { get; set; } + } + + [Serializable] + public class TableRowEntry + { + [XmlElement(nameof(TableColumnItems))] + public TableColumnItems TableColumnItems { get; set; } + } + + [Serializable] + public class TableColumnItems + { + [XmlElement("TableColumnItem")] + public List TableItems { get; set; } + } + + [Serializable] + public class TableColumnItem + { + [XmlElement(nameof(PropertyName))] + public string PropertyName { get; set; } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs new file mode 100644 index 000000000000..911999f80510 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs @@ -0,0 +1,199 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.PsHelpOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + internal class HelpMetadataOutput + { + public MarkdownHelpInfo HelpInfo { get; } + + public HelpMetadataOutput(MarkdownHelpInfo helpInfo) + { + HelpInfo = helpInfo; + } + + public override string ToString() => $@"--- +external help file:{(!String.IsNullOrEmpty(HelpInfo.ExternalHelpFilename) ? $" {HelpInfo.ExternalHelpFilename}" : String.Empty)} +Module Name: {HelpInfo.ModuleName} +online version: {HelpInfo.OnlineVersion} +schema: {HelpInfo.Schema.ToString(3)} +--- + +"; + } + + internal class HelpSyntaxOutput + { + public MarkdownSyntaxHelpInfo SyntaxInfo { get; } + public bool HasMultipleParameterSets { get; } + + public HelpSyntaxOutput(MarkdownSyntaxHelpInfo syntaxInfo, bool hasMultipleParameterSets) + { + SyntaxInfo = syntaxInfo; + HasMultipleParameterSets = hasMultipleParameterSets; + } + + public override string ToString() + { + var psnText = HasMultipleParameterSets ? $"### {SyntaxInfo.ParameterSetName}{(SyntaxInfo.IsDefault ? " (Default)" : String.Empty)}{Environment.NewLine}" : String.Empty; + return $@"{psnText}``` +{SyntaxInfo.SyntaxText} +``` + +"; + } + } + + internal class HelpExampleOutput + { + private string ExampleTemplate = + "{0}{1}" + Environment.NewLine + + "{2}" + Environment.NewLine + "{3}" + Environment.NewLine + "{4}" + Environment.NewLine + Environment.NewLine + + "{5}" + Environment.NewLine + Environment.NewLine; + + private string ExampleTemplateWithOutput = + "{0}{1}" + Environment.NewLine + + "{2}" + Environment.NewLine + "{3}" + Environment.NewLine + "{4}" + Environment.NewLine + Environment.NewLine + + "{5}" + Environment.NewLine + "{6}" + Environment.NewLine + "{7}" + Environment.NewLine + Environment.NewLine + + "{8}" + Environment.NewLine + Environment.NewLine; + + public MarkdownExampleHelpInfo ExampleInfo { get; } + + public HelpExampleOutput(MarkdownExampleHelpInfo exampleInfo) + { + ExampleInfo = exampleInfo; + } + + public override string ToString() + { + if (string.IsNullOrEmpty(ExampleInfo.Output)) + { + return string.Format(ExampleTemplate, + ExampleNameHeader, ExampleInfo.Name, + ExampleCodeHeader, ExampleInfo.Code, ExampleCodeFooter, + ExampleInfo.Description.ToDescriptionFormat()); + } + else + { + return string.Format(ExampleTemplateWithOutput, + ExampleNameHeader, ExampleInfo.Name, + ExampleCodeHeader, ExampleInfo.Code, ExampleCodeFooter, + ExampleOutputHeader, ExampleInfo.Output, ExampleOutputFooter, + ExampleInfo.Description.ToDescriptionFormat()); ; + } + } + } + + internal class HelpParameterOutput + { + public MarkdownParameterHelpInfo ParameterInfo { get; } + + public HelpParameterOutput(MarkdownParameterHelpInfo parameterInfo) + { + ParameterInfo = parameterInfo; + } + + public override string ToString() + { + var pipelineInputTypes = new[] + { + ParameterInfo.AcceptsPipelineByValue ? "ByValue" : String.Empty, + ParameterInfo.AcceptsPipelineByPropertyName ? "ByPropertyName" : String.Empty + }.JoinIgnoreEmpty(", "); + var pipelineInput = ParameterInfo.AcceptsPipelineByValue || ParameterInfo.AcceptsPipelineByPropertyName + ? $@"{true} ({pipelineInputTypes})" + : false.ToString(); + + return $@"### -{ParameterInfo.Name} +{ParameterInfo.Description.ToDescriptionFormat()} + +```yaml +Type: {ParameterInfo.Type.FullName} +Parameter Sets: {(ParameterInfo.HasAllParameterSets ? "(All)" : ParameterInfo.ParameterSetNames.JoinIgnoreEmpty(", "))} +Aliases:{(ParameterInfo.Aliases.Any() ? $" {ParameterInfo.Aliases.JoinIgnoreEmpty(", ")}" : String.Empty)} + +Required: {ParameterInfo.IsRequired} +Position: {ParameterInfo.Position} +Default value: {ParameterInfo.DefaultValue} +Accept pipeline input: {pipelineInput} +Accept wildcard characters: {ParameterInfo.AcceptsWildcardCharacters} +``` + +"; + } + } + + internal class ModulePageMetadataOutput + { + public PsModuleHelpInfo ModuleInfo { get; } + + private static string HelpLinkPrefix { get; } = @"https://learn.microsoft.com/powershell/module/"; + + public ModulePageMetadataOutput(PsModuleHelpInfo moduleInfo) + { + ModuleInfo = moduleInfo; + } + + public override string ToString() => $@"--- +Module Name: {ModuleInfo.Name} +Module Guid: {ModuleInfo.Guid} +Download Help Link: {HelpLinkPrefix}{ModuleInfo.Name.ToLowerInvariant()} +Help Version: 1.0.0.0 +Locale: en-US +--- + +"; + } + + internal class ModulePageCmdletOutput + { + public MarkdownHelpInfo HelpInfo { get; } + + public ModulePageCmdletOutput(MarkdownHelpInfo helpInfo) + { + HelpInfo = helpInfo; + } + + public override string ToString() => $@"### [{HelpInfo.CmdletName}]({HelpInfo.CmdletName}.md) +{HelpInfo.Synopsis.ToDescriptionFormat()} + +"; + } + + internal static class PsHelpOutputExtensions + { + public static string EscapeAngleBrackets(this string text) => text?.Replace("<", @"\<").Replace(">", @"\>"); + public static string ReplaceSentenceEndWithNewline(this string text) => text?.Replace(". ", $".{Environment.NewLine}").Replace(". ", $".{Environment.NewLine}"); + public static string ReplaceBrWithNewline(this string text) => text?.Replace("
", $"{Environment.NewLine}"); + public static string ToDescriptionFormat(this string text, bool escapeAngleBrackets = true) + { + var description = text?.ReplaceBrWithNewline(); + description = escapeAngleBrackets ? description?.EscapeAngleBrackets() : description; + return description?.ReplaceSentenceEndWithNewline().Trim(); + } + + public const string ExampleNameHeader = "### "; + public const string ExampleCodeHeader = "```powershell"; + public const string ExampleCodeFooter = "```"; + public const string ExampleOutputHeader = "```output"; + public const string ExampleOutputFooter = "```"; + + public static HelpMetadataOutput ToHelpMetadataOutput(this MarkdownHelpInfo helpInfo) => new HelpMetadataOutput(helpInfo); + + public static HelpSyntaxOutput ToHelpSyntaxOutput(this MarkdownSyntaxHelpInfo syntaxInfo, bool hasMultipleParameterSets) => new HelpSyntaxOutput(syntaxInfo, hasMultipleParameterSets); + + public static HelpExampleOutput ToHelpExampleOutput(this MarkdownExampleHelpInfo exampleInfo) => new HelpExampleOutput(exampleInfo); + + public static HelpParameterOutput ToHelpParameterOutput(this MarkdownParameterHelpInfo parameterInfo) => new HelpParameterOutput(parameterInfo); + + public static ModulePageMetadataOutput ToModulePageMetadataOutput(this PsModuleHelpInfo moduleInfo) => new ModulePageMetadataOutput(moduleInfo); + + public static ModulePageCmdletOutput ToModulePageCmdletOutput(this MarkdownHelpInfo helpInfo) => new ModulePageCmdletOutput(helpInfo); + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Models/PsHelpTypes.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Models/PsHelpTypes.cs new file mode 100644 index 000000000000..91936d128490 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Models/PsHelpTypes.cs @@ -0,0 +1,202 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + internal class PsHelpInfo + { + public string CmdletName { get; } + public string ModuleName { get; } + public string Synopsis { get; } + public string Description { get; } + public string AlertText { get; } + public string Category { get; } + public PsHelpLinkInfo OnlineVersion { get; } + public PsHelpLinkInfo[] RelatedLinks { get; } + public bool? HasCommonParameters { get; } + public bool? HasWorkflowCommonParameters { get; } + + public PsHelpTypeInfo[] InputTypes { get; } + public PsHelpTypeInfo[] OutputTypes { get; } + public PsHelpExampleInfo[] Examples { get; set; } + public string[] Aliases { get; } + + public PsParameterHelpInfo[] Parameters { get; } + public PsHelpSyntaxInfo[] Syntax { get; } + + public object Component { get; } + public object Functionality { get; } + public object PsSnapIn { get; } + public object Role { get; } + public string NonTerminatingErrors { get; } + + public PsHelpInfo(PSObject helpObject = null) + { + helpObject = helpObject ?? new PSObject(); + CmdletName = helpObject.GetProperty("Name").NullIfEmpty() ?? helpObject.GetNestedProperty("details", "name"); + ModuleName = helpObject.GetProperty("ModuleName"); + Synopsis = helpObject.GetProperty("Synopsis"); + Description = helpObject.GetProperty("description").EmptyIfNull().ToDescriptionText().NullIfEmpty() ?? + helpObject.GetNestedProperty("details", "description").EmptyIfNull().ToDescriptionText(); + AlertText = helpObject.GetNestedProperty("alertSet", "alert").EmptyIfNull().ToDescriptionText(); + Category = helpObject.GetProperty("Category"); + HasCommonParameters = helpObject.GetProperty("CommonParameters").ToNullableBool(); + HasWorkflowCommonParameters = helpObject.GetProperty("WorkflowCommonParameters").ToNullableBool(); + + var links = helpObject.GetNestedProperty("relatedLinks", "navigationLink").EmptyIfNull().Select(nl => nl.ToLinkInfo()).ToArray(); + OnlineVersion = links.FirstOrDefault(l => l.Text?.ToLowerInvariant().StartsWith("online version:") ?? links.Length == 1); + RelatedLinks = links.Where(l => !l.Text?.ToLowerInvariant().StartsWith("online version:") ?? links.Length != 1).ToArray(); + + InputTypes = helpObject.GetNestedProperty("inputTypes", "inputType").EmptyIfNull().Select(it => it.ToTypeInfo()).ToArray(); + OutputTypes = helpObject.GetNestedProperty("returnValues", "returnValue").EmptyIfNull().Select(rv => rv.ToTypeInfo()).ToArray(); + Examples = helpObject.GetNestedProperty("examples", "example").EmptyIfNull().Select(e => e.ToExampleInfo()).ToArray(); + Aliases = helpObject.GetProperty("aliases").EmptyIfNull().Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); + + Parameters = helpObject.GetNestedProperty("parameters", "parameter").EmptyIfNull().Select(p => p.ToPsParameterHelpInfo()).ToArray(); + Syntax = helpObject.GetNestedProperty("syntax", "syntaxItem").EmptyIfNull().Select(si => si.ToSyntaxInfo()).ToArray(); + + Component = helpObject.GetProperty("Component"); + Functionality = helpObject.GetProperty("Functionality"); + PsSnapIn = helpObject.GetProperty("PSSnapIn"); + Role = helpObject.GetProperty("Role"); + NonTerminatingErrors = helpObject.GetProperty("nonTerminatingErrors"); + } + } + + internal class PsHelpTypeInfo + { + public string Name { get; } + public string Description { get; } + + public PsHelpTypeInfo(PSObject typeObject) + { + Name = typeObject.GetNestedProperty("type", "name").EmptyIfNull().Trim(); + Description = typeObject.GetProperty("description").EmptyIfNull().ToDescriptionText(); + } + } + + internal class PsHelpLinkInfo + { + public string Uri { get; } + public string Text { get; } + + public PsHelpLinkInfo(PSObject linkObject) + { + Uri = linkObject.GetProperty("uri"); + Text = linkObject.GetProperty("linkText"); + } + } + + internal class PsHelpSyntaxInfo + { + public string CmdletName { get; } + public PsParameterHelpInfo[] Parameters { get; } + + public PsHelpSyntaxInfo(PSObject syntaxObject) + { + CmdletName = syntaxObject.GetProperty("name"); + Parameters = syntaxObject.GetProperty("parameter").EmptyIfNull().Select(p => p.ToPsParameterHelpInfo()).ToArray(); + } + } + + internal class PsHelpExampleInfo + { + public string Title { get; } + public string Code { get; } + public string Output { get; } + public string Remarks { get; } + + public PsHelpExampleInfo(PSObject exampleObject) + { + Title = exampleObject.GetProperty("title"); + Code = exampleObject.GetProperty("code"); + Output = exampleObject.GetProperty("output"); + Remarks = exampleObject.GetProperty("remarks").EmptyIfNull().ToDescriptionText(); + } + public PsHelpExampleInfo(MarkdownExampleHelpInfo markdownExample) + { + Title = markdownExample.Name; + Code = markdownExample.Code; + Output = markdownExample.Output; + Remarks = markdownExample.Description; + } + + public static implicit operator PsHelpExampleInfo(MarkdownExampleHelpInfo markdownExample) => new PsHelpExampleInfo(markdownExample); + } + + internal class PsParameterHelpInfo + { + public string DefaultValueAsString { get; } + + public string Name { get; } + public string TypeName { get; } + public string Description { get; } + public string SupportsPipelineInput { get; } + public string PositionText { get; } + public string[] ParameterSetNames { get; } + public string[] Aliases { get; } + + public bool? SupportsGlobbing { get; } + public bool? IsRequired { get; } + public bool? IsVariableLength { get; } + public bool? IsDynamic { get; } + + public PsParameterHelpInfo(PSObject parameterHelpObject = null) + { + parameterHelpObject = parameterHelpObject ?? new PSObject(); + DefaultValueAsString = parameterHelpObject.GetProperty("defaultValue"); + Name = parameterHelpObject.GetProperty("name"); + TypeName = parameterHelpObject.GetProperty("parameterValue").NullIfEmpty() ?? parameterHelpObject.GetNestedProperty("type", "name"); + Description = parameterHelpObject.GetProperty("Description").EmptyIfNull().ToDescriptionText(); + SupportsPipelineInput = parameterHelpObject.GetProperty("pipelineInput"); + PositionText = parameterHelpObject.GetProperty("position"); + ParameterSetNames = parameterHelpObject.GetProperty("parameterSetName").EmptyIfNull().Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries); + Aliases = parameterHelpObject.GetProperty("aliases").EmptyIfNull().Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries); + + SupportsGlobbing = parameterHelpObject.GetProperty("globbing").ToNullableBool(); + IsRequired = parameterHelpObject.GetProperty("required").ToNullableBool(); + IsVariableLength = parameterHelpObject.GetProperty("variableLength").ToNullableBool(); + IsDynamic = parameterHelpObject.GetProperty("isDynamic").ToNullableBool(); + } + } + + internal class PsModuleHelpInfo + { + public string Name { get; } + public Guid Guid { get; } + public string Description { get; } + + public PsModuleHelpInfo(PSModuleInfo moduleInfo) + : this(moduleInfo?.Name ?? String.Empty, moduleInfo?.Guid ?? Guid.NewGuid(), moduleInfo?.Description ?? String.Empty) + { + } + + public PsModuleHelpInfo(string name, Guid guid, string description) + { + Name = name; + Guid = guid; + Description = description; + } + } + + internal static class HelpTypesExtensions + { + public static PsHelpInfo ToPsHelpInfo(this PSObject helpObject) => new PsHelpInfo(helpObject); + public static PsParameterHelpInfo ToPsParameterHelpInfo(this PSObject parameterHelpObject) => new PsParameterHelpInfo(parameterHelpObject); + + public static string ToDescriptionText(this IEnumerable descriptionObject) => descriptionObject != null + ? String.Join(Environment.NewLine, descriptionObject.Select(dl => dl.GetProperty("Text").EmptyIfNull())).NullIfWhiteSpace() + : null; + public static PsHelpTypeInfo ToTypeInfo(this PSObject typeObject) => new PsHelpTypeInfo(typeObject); + public static PsHelpExampleInfo ToExampleInfo(this PSObject exampleObject) => new PsHelpExampleInfo(exampleObject); + public static PsHelpLinkInfo ToLinkInfo(this PSObject linkObject) => new PsHelpLinkInfo(linkObject); + public static PsHelpSyntaxInfo ToSyntaxInfo(this PSObject syntaxObject) => new PsHelpSyntaxInfo(syntaxObject); + public static PsModuleHelpInfo ToModuleInfo(this PSModuleInfo moduleInfo) => new PsModuleHelpInfo(moduleInfo); + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs new file mode 100644 index 000000000000..7ab1f35fda91 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs @@ -0,0 +1,294 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.PsHelpOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + internal class MarkdownHelpInfo + { + public string ExternalHelpFilename { get; } + public string ModuleName { get; } + public string OnlineVersion { get; } + public Version Schema { get; } + + public string CmdletName { get; } + public string[] Aliases { get; } + public string Synopsis { get; } + public string Description { get; } + + public MarkdownSyntaxHelpInfo[] SyntaxInfos { get; } + public MarkdownExampleHelpInfo[] Examples { get; } + public MarkdownParameterHelpInfo[] Parameters { get; } + + public string[] Inputs { get; } + public string[] Outputs { get; } + public ComplexInterfaceInfo[] ComplexInterfaceInfos { get; } + public string[] RelatedLinks { get; } + + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + + public MarkdownHelpInfo(VariantGroup variantGroup, string examplesFolder, string externalHelpFilename = "") + { + ExternalHelpFilename = externalHelpFilename; + ModuleName = variantGroup.RootModuleName != "" ? variantGroup.RootModuleName : variantGroup.ModuleName; + var helpInfo = variantGroup.HelpInfo; + var commentInfo = variantGroup.CommentInfo; + Schema = Version.Parse("2.0.0"); + + CmdletName = variantGroup.CmdletName; + Aliases = (variantGroup.Aliases.NullIfEmpty() ?? helpInfo.Aliases).Where(a => a != "None").ToArray(); + Synopsis = commentInfo.Synopsis; + Description = commentInfo.Description; + + SyntaxInfos = variantGroup.Variants + .Select(v => new MarkdownSyntaxHelpInfo(v, variantGroup.ParameterGroups, v.VariantName == variantGroup.DefaultParameterSetName)) + .OrderByDescending(v => v.IsDefault).ThenBy(v => v.ParameterSetName).ToArray(); + Examples = GetExamplesFromMarkdown(examplesFolder).NullIfEmpty() + ?? helpInfo.Examples.Select(e => e.ToExampleHelpInfo()).ToArray().NullIfEmpty() + ?? DefaultExampleHelpInfos; + + Parameters = variantGroup.ParameterGroups + .Where(pg => !pg.DontShow && !pg.Parameters.All(p => p.IsHidden())) + .Select(pg => new MarkdownParameterHelpInfo( + variantGroup.Variants.SelectMany(v => v.HelpInfo.Parameters).Where(phi => phi.Name == pg.ParameterName).ToArray(), pg)) + .OrderBy(phi => phi.Name).ToArray(); + + Inputs = commentInfo.Inputs; + Outputs = commentInfo.Outputs; + + ComplexInterfaceInfos = variantGroup.ComplexInterfaceInfos; + OnlineVersion = commentInfo.OnlineVersion; + RelatedLinks = commentInfo.RelatedLinks; + + SupportsShouldProcess = variantGroup.SupportsShouldProcess; + SupportsPaging = variantGroup.SupportsPaging; + } + + private MarkdownExampleHelpInfo[] GetExamplesFromMarkdown(string examplesFolder) + { + var filePath = Path.Combine(examplesFolder, $"{CmdletName}.md"); + if (!Directory.Exists(examplesFolder) || !File.Exists(filePath)) return null; + + var lines = File.ReadAllLines(filePath); + var nameIndices = lines.Select((l, i) => l.StartsWith(ExampleNameHeader) ? i : -1).Where(i => i != -1).ToArray(); + //https://codereview.stackexchange.com/a/187148/68772 + var indexCountGroups = nameIndices.Skip(1).Append(lines.Length).Zip(nameIndices, (next, current) => (NameIndex: current, LineCount: next - current)); + var exampleGroups = indexCountGroups.Select(icg => lines.Skip(icg.NameIndex).Take(icg.LineCount).ToArray()); + return exampleGroups.Select(eg => + { + var name = eg.First().Replace(ExampleNameHeader, String.Empty); + var codeStartIndex = eg.Select((l, i) => l.StartsWith(ExampleCodeHeader) ? (int?)i : null).FirstOrDefault(i => i.HasValue); + var codeEndIndex = eg.Select((l, i) => l.StartsWith(ExampleCodeFooter) ? (int?)i : null).FirstOrDefault(i => i.HasValue && i != codeStartIndex); + var code = codeStartIndex.HasValue && codeEndIndex.HasValue + ? String.Join(Environment.NewLine, eg.Skip(codeStartIndex.Value + 1).Take(codeEndIndex.Value - (codeStartIndex.Value + 1))) + : String.Empty; + var outputStartIndex = eg.Select((l, i) => l.StartsWith(ExampleOutputHeader) ? (int?)i : null).FirstOrDefault(i => i.HasValue); + var outputEndIndex = eg.Select((l, i) => l.StartsWith(ExampleOutputFooter) ? (int?)i : null).FirstOrDefault(i => i.HasValue && i > outputStartIndex); + var output = outputStartIndex.HasValue && outputEndIndex.HasValue + ? String.Join(Environment.NewLine, eg.Skip(outputStartIndex.Value + 1).Take(outputEndIndex.Value - (outputStartIndex.Value + 1))) + : String.Empty; + var descriptionStartIndex = (outputEndIndex ?? (codeEndIndex ?? 0)) + 1; + descriptionStartIndex = String.IsNullOrWhiteSpace(eg[descriptionStartIndex]) ? descriptionStartIndex + 1 : descriptionStartIndex; + var descriptionEndIndex = eg.Length - 1; + descriptionEndIndex = String.IsNullOrWhiteSpace(eg[descriptionEndIndex]) ? descriptionEndIndex - 1 : descriptionEndIndex; + var description = String.Join(Environment.NewLine, eg.Skip(descriptionStartIndex).Take((descriptionEndIndex + 1) - descriptionStartIndex)); + return new MarkdownExampleHelpInfo(name, code, output, description); + }).ToArray(); + } + } + + internal class MarkdownSyntaxHelpInfo + { + public Variant Variant { get; } + public bool IsDefault { get; } + public string ParameterSetName { get; } + public Parameter[] Parameters { get; } + public string SyntaxText { get; } + + public MarkdownSyntaxHelpInfo(Variant variant, ParameterGroup[] parameterGroups, bool isDefault) + { + Variant = variant; + IsDefault = isDefault; + ParameterSetName = Variant.VariantName; + Parameters = Variant.Parameters + .Where(p => !p.DontShow && !p.IsHidden()).OrderByDescending(p => p.IsMandatory) + //https://stackoverflow.com/a/6461526/294804 + .ThenByDescending(p => p.Position.HasValue).ThenBy(p => p.Position) + // Use the OrderCategory of the parameter group because the final order category is the highest of the group, and not the order category of the individual parameters from the variants. + .ThenBy(p => parameterGroups.First(pg => pg.ParameterName == p.ParameterName).OrderCategory).ThenBy(p => p.ParameterName).ToArray(); + SyntaxText = CreateSyntaxFormat(); + } + + //https://github.com/PowerShell/platyPS/blob/a607a926bfffe1e1a1e53c19e0057eddd0c07611/src/Markdown.MAML/Renderer/Markdownv2Renderer.cs#L29-L32 + private const int SyntaxLineWidth = 110; + private string CreateSyntaxFormat() + { + var parameterStrings = Parameters.Select(p => p.ToPropertySyntaxOutput().ToString()); + if (Variant.SupportsShouldProcess) + { + parameterStrings = parameterStrings.Append(" [-Confirm]").Append(" [-WhatIf]"); + } + parameterStrings = parameterStrings.Append(" []"); + + var lines = new List(20); + return parameterStrings.Aggregate(Variant.CmdletName, (current, ps) => + { + var combined = current + ps; + if (combined.Length <= SyntaxLineWidth) return combined; + + lines.Add(current); + return ps; + }, last => + { + lines.Add(last); + return String.Join(Environment.NewLine, lines); + }); + } + } + + internal class MarkdownExampleHelpInfo + { + public string Name { get; } + public string Code { get; } + public string Output { get; } + public string Description { get; } + + public MarkdownExampleHelpInfo(string name, string code, string output, string description) + { + Name = name; + Code = code; + Output = output; + Description = description; + } + } + + internal class MarkdownParameterHelpInfo + { + public string Name { get; set; } + public string Description { get; set; } + public Type Type { get; set; } + public string Position { get; set; } + public string DefaultValue { get; set; } + + public bool HasAllParameterSets { get; set; } + public string[] ParameterSetNames { get; set; } + public string[] Aliases { get; set; } + + public bool IsRequired { get; set; } + public bool IsDynamic { get; set; } + public bool AcceptsPipelineByValue { get; set; } + public bool AcceptsPipelineByPropertyName { get; set; } + public bool AcceptsWildcardCharacters { get; set; } + + // For use by common parameters that have no backing data in the objects themselves. + public MarkdownParameterHelpInfo() { } + + public MarkdownParameterHelpInfo(PsParameterHelpInfo[] parameterHelpInfos, ParameterGroup parameterGroup) + { + Name = parameterGroup.ParameterName; + Description = parameterGroup.Description.NullIfEmpty() + ?? parameterHelpInfos.Select(phi => phi.Description).FirstOrDefault(d => !String.IsNullOrEmpty(d)).EmptyIfNull(); + Type = parameterGroup.ParameterType; + Position = parameterGroup.FirstPosition?.ToString() + ?? parameterHelpInfos.Select(phi => phi.PositionText).FirstOrDefault(d => !String.IsNullOrEmpty(d)).ToUpperFirstCharacter().NullIfEmpty() + ?? "Named"; + // This no longer uses firstHelpInfo.DefaultValueAsString since it seems to be broken. For example, it has a value of 0 for Int32, but no default value was declared. + DefaultValue = parameterGroup.DefaultInfo?.Script ?? "None"; + + HasAllParameterSets = parameterGroup.HasAllVariants; + ParameterSetNames = (parameterGroup.Parameters.Select(p => p.VariantName).ToArray().NullIfEmpty() + ?? parameterHelpInfos.SelectMany(phi => phi.ParameterSetNames).Distinct()) + .OrderBy(psn => psn).ToArray(); + Aliases = parameterGroup.Aliases.NullIfEmpty() ?? parameterHelpInfos.SelectMany(phi => phi.Aliases).ToArray(); + + IsRequired = parameterHelpInfos.Select(phi => phi.IsRequired).FirstOrDefault(r => r == true) ?? parameterGroup.Parameters.Any(p => p.IsMandatory); + IsDynamic = parameterHelpInfos.Select(phi => phi.IsDynamic).FirstOrDefault(d => d == true) ?? false; + AcceptsPipelineByValue = parameterHelpInfos.Select(phi => phi.SupportsPipelineInput?.Contains("ByValue")).FirstOrDefault(bv => bv == true) ?? parameterGroup.ValueFromPipeline; + AcceptsPipelineByPropertyName = parameterHelpInfos.Select(phi => phi.SupportsPipelineInput?.Contains("ByPropertyName")).FirstOrDefault(bv => bv == true) ?? parameterGroup.ValueFromPipelineByPropertyName; + AcceptsWildcardCharacters = parameterGroup.SupportsWildcards; + } + } + + internal static class MarkdownTypesExtensions + { + public static MarkdownExampleHelpInfo ToExampleHelpInfo(this PsHelpExampleInfo exampleInfo) => new MarkdownExampleHelpInfo(exampleInfo.Title, exampleInfo.Code, exampleInfo.Output, exampleInfo.Remarks); + + public static MarkdownExampleHelpInfo[] DefaultExampleHelpInfos = + { + new MarkdownExampleHelpInfo("Example 1: {{ Add title here }}", $@"{{{{ Add code here }}}}", $@"{{{{ Add output here }}}}", @"{{ Add description here }}"), + new MarkdownExampleHelpInfo("Example 2: {{ Add title here }}", $@"{{{{ Add code here }}}}", $@"{{{{ Add output here }}}}", @"{{ Add description here }}"), + }; + + public static MarkdownParameterHelpInfo[] SupportsShouldProcessParameters = + { + new MarkdownParameterHelpInfo + { + Name = "Confirm", + Description ="Prompts you for confirmation before running the cmdlet.", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new [] { "cf" } + }, + new MarkdownParameterHelpInfo + { + Name = "WhatIf", + Description ="Shows what would happen if the cmdlet runs. The cmdlet is not run.", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new [] { "wi" } + } + }; + + public static MarkdownParameterHelpInfo[] SupportsPagingParameters = + { + new MarkdownParameterHelpInfo + { + Name = "First", + Description ="Gets only the first 'n' objects.", + Type = typeof(ulong), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + }, + new MarkdownParameterHelpInfo + { + Name = "IncludeTotalCount", + Description ="Reports the number of objects in the data set (an integer) followed by the objects. If the cmdlet cannot determine the total count, it returns \"Unknown total count\".", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + }, + new MarkdownParameterHelpInfo + { + Name = "Skip", + Description ="Ignores the first 'n' objects and then gets the remaining objects.", + Type = typeof(ulong), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + } + }; + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs new file mode 100644 index 000000000000..9a92082416b1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs @@ -0,0 +1,618 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Text.RegularExpressions; +using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.PsProxyTypeExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + internal class OutputTypeOutput + { + public PSTypeName[] OutputTypes { get; } + + public OutputTypeOutput(IEnumerable outputTypes) + { + OutputTypes = outputTypes.ToArray(); + } + + public override string ToString() => OutputTypes != null && OutputTypes.Any() ? $"[OutputType({OutputTypes.Select(ot => $"[{ot}]").JoinIgnoreEmpty(ItemSeparator)})]{Environment.NewLine}" : String.Empty; + } + + internal class CmdletBindingOutput + { + public VariantGroup VariantGroup { get; } + + public CmdletBindingOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + } + + public override string ToString() + { + var dpsText = VariantGroup.DefaultParameterSetName.IsValidDefaultParameterSetName() ? $"DefaultParameterSetName='{VariantGroup.DefaultParameterSetName}'" : String.Empty; + var sspText = VariantGroup.SupportsShouldProcess ? $"SupportsShouldProcess{ItemSeparator}ConfirmImpact='Medium'" : String.Empty; + var pbText = $"PositionalBinding={false.ToPsBool()}"; + var propertyText = new[] { dpsText, pbText, sspText }.JoinIgnoreEmpty(ItemSeparator); + return $"[CmdletBinding({propertyText})]{Environment.NewLine}"; + } + } + + internal class ParameterOutput + { + public Parameter Parameter { get; } + public bool HasMultipleVariantsInVariantGroup { get; } + public bool HasAllVariantsInParameterGroup { get; } + + public ParameterOutput(Parameter parameter, bool hasMultipleVariantsInVariantGroup, bool hasAllVariantsInParameterGroup) + { + Parameter = parameter; + HasMultipleVariantsInVariantGroup = hasMultipleVariantsInVariantGroup; + HasAllVariantsInParameterGroup = hasAllVariantsInParameterGroup; + } + + public override string ToString() + { + var psnText = HasMultipleVariantsInVariantGroup && !HasAllVariantsInParameterGroup ? $"ParameterSetName='{Parameter.VariantName}'" : String.Empty; + var positionText = Parameter.Position != null ? $"Position={Parameter.Position}" : String.Empty; + var mandatoryText = Parameter.IsMandatory ? "Mandatory" : String.Empty; + var dontShowText = Parameter.DontShow ? "DontShow" : String.Empty; + var vfpText = Parameter.ValueFromPipeline ? "ValueFromPipeline" : String.Empty; + var vfpbpnText = Parameter.ValueFromPipelineByPropertyName ? "ValueFromPipelineByPropertyName" : String.Empty; + var propertyText = new[] { psnText, positionText, mandatoryText, dontShowText, vfpText, vfpbpnText }.JoinIgnoreEmpty(ItemSeparator); + return $"{Indent}[Parameter({propertyText})]{Environment.NewLine}"; + } + } + + internal class AliasOutput + { + public string[] Aliases { get; } + public bool IncludeIndent { get; } + + public AliasOutput(string[] aliases, bool includeIndent = false) + { + Aliases = aliases; + IncludeIndent = includeIndent; + } + + public override string ToString() => Aliases?.Any() ?? false ? $"{(IncludeIndent ? Indent : String.Empty)}[Alias({Aliases.Select(an => $"'{an}'").JoinIgnoreEmpty(ItemSeparator)})]{Environment.NewLine}" : String.Empty; + } + + internal class ValidateNotNullOutput + { + public bool HasValidateNotNull { get; } + + public ValidateNotNullOutput(bool hasValidateNotNull) + { + HasValidateNotNull = hasValidateNotNull; + } + + public override string ToString() => HasValidateNotNull ? $"{Indent}[ValidateNotNull()]{Environment.NewLine}" : String.Empty; + } + + internal class AllowEmptyArrayOutput + { + public bool HasAllowEmptyArray { get; } + + public AllowEmptyArrayOutput(bool hasAllowEmptyArray) + { + HasAllowEmptyArray = hasAllowEmptyArray; + } + + public override string ToString() => HasAllowEmptyArray ? $"{Indent}[AllowEmptyCollection()]{Environment.NewLine}" : String.Empty; + } + internal class ArgumentCompleterOutput + { + public CompleterInfo CompleterInfo { get; } + + public ArgumentCompleterOutput(CompleterInfo completerInfo) + { + CompleterInfo = completerInfo; + } + + public override string ToString() => CompleterInfo != null + ? $"{Indent}[ArgumentCompleter({(CompleterInfo.IsTypeCompleter ? $"[{CompleterInfo.Type.Unwrap().ToPsType()}]" : $"{{{CompleterInfo.Script.ToPsSingleLine("; ")}}}")})]{Environment.NewLine}" + : String.Empty; + } + + internal class DefaultInfoOutput + { + public bool HasDefaultInfo { get; } + public DefaultInfo DefaultInfo { get; } + + public DefaultInfoOutput(ParameterGroup parameterGroup) + { + HasDefaultInfo = parameterGroup.HasDefaultInfo; + DefaultInfo = parameterGroup.DefaultInfo; + } + + public override string ToString() + { + var nameText = !String.IsNullOrEmpty(DefaultInfo?.Name) ? $"Name='{DefaultInfo?.Name}'" : String.Empty; + var descriptionText = !String.IsNullOrEmpty(DefaultInfo?.Description) ? $"Description='{DefaultInfo?.Description.ToPsStringLiteral()}'" : String.Empty; + var scriptText = !String.IsNullOrEmpty(DefaultInfo?.Script) ? $"Script='{DefaultInfo?.Script.ToPsSingleLine("; ")}'" : String.Empty; + var propertyText = new[] { nameText, descriptionText, scriptText }.JoinIgnoreEmpty(ItemSeparator); + return HasDefaultInfo ? $"{Indent}[{typeof(DefaultInfoAttribute).ToPsAttributeType()}({propertyText})]{Environment.NewLine}" : String.Empty; + } + } + + internal class ParameterTypeOutput + { + public Type ParameterType { get; } + + public ParameterTypeOutput(Type parameterType) + { + ParameterType = parameterType; + } + + public override string ToString() => $"{Indent}[{ParameterType.ToPsType()}]{Environment.NewLine}"; + } + + internal class ParameterNameOutput + { + public string ParameterName { get; } + public bool IsLast { get; } + + public ParameterNameOutput(string parameterName, bool isLast) + { + ParameterName = parameterName; + IsLast = isLast; + } + + public override string ToString() => $"{Indent}${{{ParameterName}}}{(IsLast ? String.Empty : $",{Environment.NewLine}")}{Environment.NewLine}"; + } + + internal class BaseOutput + { + public VariantGroup VariantGroup { get; } + + protected static readonly bool IsAzure = Convert.ToBoolean(@"true"); + public BaseOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + } + public string ClearTelemetryContext() + { + return (!VariantGroup.IsInternal && IsAzure) ? $@"{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext()" : ""; + } + } + + internal class BeginOutput : BaseOutput + { + public BeginOutput(VariantGroup variantGroup) : base(variantGroup) + { + } + + public string GetProcessCustomAttributesAtRuntime() + { + return VariantGroup.IsInternal ? "" : IsAzure ? $@"{Indent}{Indent}$cmdInfo = Get-Command -Name $mapping[$parameterSet] +{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){{ +{Indent}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) +{Indent}{Indent}}}" : $@"{Indent}{Indent}$cmdInfo = Get-Command -Name $mapping[$parameterSet]{Environment.NewLine}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)"; + } + + private string GetTelemetry() + { + if (!VariantGroup.IsInternal && IsAzure) + { + return $@" +{Indent}{Indent}if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {{ +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() +{Indent}{Indent}}} +{Indent}{Indent}$preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId +{Indent}{Indent}if ($preTelemetryId -eq '') {{ +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() +{Indent}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}}} else {{ +{Indent}{Indent}{Indent}$internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets +{Indent}{Indent}{Indent}if ($internalCalledCmdlets -eq '') {{ +{Indent}{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name +{Indent}{Indent}{Indent}}} else {{ +{Indent}{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name +{Indent}{Indent}{Indent}}} +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' +{Indent}{Indent}}} +"; + } + return ""; + } + public override string ToString() => $@"begin {{ +{Indent}try {{ +{Indent}{Indent}$outBuffer = $null +{Indent}{Indent}if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {{ +{Indent}{Indent}{Indent}$PSBoundParameters['OutBuffer'] = 1 +{Indent}{Indent}}} +{Indent}{Indent}$parameterSet = $PSCmdlet.ParameterSetName +{GetTelemetry()} +{GetParameterSetToCmdletMapping()}{GetDefaultValuesStatements()} +{GetProcessCustomAttributesAtRuntime()} +{Indent}{Indent}$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) +{Indent}{Indent}$scriptCmd = {{& $wrappedCmd @PSBoundParameters}} +{Indent}{Indent}$steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) +{Indent}{Indent}$steppablePipeline.Begin($PSCmdlet) +{Indent}}} catch {{ +{ClearTelemetryContext()} +{Indent}{Indent}throw +{Indent}}} +}} + +"; + + private string GetParameterSetToCmdletMapping() + { + var sb = new StringBuilder(); + sb.AppendLine($"{Indent}{Indent}$mapping = @{{"); + foreach (var variant in VariantGroup.Variants) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}{variant.VariantName} = '{variant.PrivateModuleName}\{variant.PrivateCmdletName}';"); + } + sb.Append($"{Indent}{Indent}}}"); + return sb.ToString(); + } + + private string GetDefaultValuesStatements() + { + var defaultInfos = VariantGroup.ParameterGroups.Where(pg => pg.HasDefaultInfo).Select(pg => pg.DefaultInfo).ToArray(); + var sb = new StringBuilder(); + + foreach (var defaultInfo in defaultInfos) + { + var variantListString = defaultInfo.ParameterGroup.VariantNames.ToPsList(); + var parameterName = defaultInfo.ParameterGroup.ParameterName; + sb.AppendLine(); + sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}')) {{"); + sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}"); + sb.Append($"{Indent}{Indent}}}"); + } + return sb.ToString(); + } + } + + internal class ProcessOutput : BaseOutput + { + public ProcessOutput(VariantGroup variantGroup) : base(variantGroup) + { + } + + private string GetFinally() + { + if (IsAzure && !VariantGroup.IsInternal) + { + return $@" +{Indent}finally {{ +{Indent}{Indent}$backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId +{Indent}{Indent}$backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() +{Indent}}} +"; + } + return ""; + } + public override string ToString() => $@"process {{ +{Indent}try {{ +{Indent}{Indent}$steppablePipeline.Process($_) +{Indent}}} catch {{ +{ClearTelemetryContext()} +{Indent}{Indent}throw +{Indent}}} +{GetFinally()} +}} +"; + } + + internal class EndOutput : BaseOutput + { + public EndOutput(VariantGroup variantGroup) : base(variantGroup) + { + } + + private string GetTelemetry() + { + if (!VariantGroup.IsInternal && IsAzure) + { + return $@" +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets +{Indent}{Indent}if ($preTelemetryId -eq '') {{ +{Indent}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() +{Indent}{Indent}}} +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId +"; + } + return ""; + } + public override string ToString() => $@"end {{ +{Indent}try {{ +{Indent}{Indent}$steppablePipeline.End() +{GetTelemetry()} +{Indent}}} catch {{ +{ClearTelemetryContext()} +{Indent}{Indent}throw +{Indent}}} +}} +"; + } + + internal class HelpCommentOutput + { + public VariantGroup VariantGroup { get; } + public CommentInfo CommentInfo { get; } + + public HelpCommentOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + CommentInfo = variantGroup.CommentInfo; + } + + public override string ToString() + { + var inputs = String.Join(Environment.NewLine, CommentInfo.Inputs.Select(i => $".Inputs{Environment.NewLine}{i}")); + var inputsText = !String.IsNullOrEmpty(inputs) ? $"{Environment.NewLine}{inputs}" : String.Empty; + var outputs = String.Join(Environment.NewLine, CommentInfo.Outputs.Select(o => $".Outputs{Environment.NewLine}{o}")); + var outputsText = !String.IsNullOrEmpty(outputs) ? $"{Environment.NewLine}{outputs}" : String.Empty; + var notes = String.Join($"{Environment.NewLine}{Environment.NewLine}", VariantGroup.ComplexInterfaceInfos.Select(cii => cii.ToNoteOutput())); + var notesText = !String.IsNullOrEmpty(notes) ? $"{Environment.NewLine}.Notes{Environment.NewLine}{ComplexParameterHeader}{notes}" : String.Empty; + var relatedLinks = String.Join(Environment.NewLine, CommentInfo.RelatedLinks.Select(l => $".Link{Environment.NewLine}{l}")); + var relatedLinksText = !String.IsNullOrEmpty(relatedLinks) ? $"{Environment.NewLine}{relatedLinks}" : String.Empty; + var examples = ""; + foreach (var example in VariantGroup.HelpInfo.Examples) + { + examples = examples + ".Example" + "\r\n" + example.Code + "\r\n"; + } + return $@"<# +.Synopsis +{CommentInfo.Synopsis.ToDescriptionFormat(false)} +.Description +{CommentInfo.Description.ToDescriptionFormat(false)} +{examples}{inputsText}{outputsText}{notesText} +.Link +{CommentInfo.OnlineVersion}{relatedLinksText} +#> +"; + } + } + + internal class ParameterDescriptionOutput + { + public string Description { get; } + + public ParameterDescriptionOutput(string description) + { + Description = description; + } + + public override string ToString() => !String.IsNullOrEmpty(Description) + ? Description.ToDescriptionFormat(false).NormalizeNewLines() + .Split(new[] { Environment.NewLine }, StringSplitOptions.None) + .Aggregate(String.Empty, (c, n) => c + $"{Indent}# {n}{Environment.NewLine}") + : String.Empty; + } + + internal class ProfileOutput + { + public string ProfileName { get; } + + public ProfileOutput(string profileName) + { + ProfileName = profileName; + } + + public override string ToString() => ProfileName != NoProfiles ? $"[{typeof(ProfileAttribute).ToPsAttributeType()}('{ProfileName}')]{Environment.NewLine}" : String.Empty; + } + + internal class DescriptionOutput + { + public string Description { get; } + + public DescriptionOutput(string description) + { + Description = description; + } + + public override string ToString() => !String.IsNullOrEmpty(Description) ? $"[{typeof(DescriptionAttribute).ToPsAttributeType()}('{Description.ToPsStringLiteral()}')]{Environment.NewLine}" : String.Empty; + } + + internal class ParameterCategoryOutput + { + public ParameterCategory Category { get; } + + public ParameterCategoryOutput(ParameterCategory category) + { + Category = category; + } + + public override string ToString() => $"{Indent}[{typeof(CategoryAttribute).ToPsAttributeType()}('{Category}')]{Environment.NewLine}"; + } + + internal class InfoOutput + { + public InfoAttribute Info { get; } + public Type ParameterType { get; } + + public InfoOutput(InfoAttribute info, Type parameterType) + { + Info = info; + ParameterType = parameterType; + } + + public override string ToString() + { + // Rendering of InfoAttribute members that are not used currently + /*var serializedNameText = Info.SerializedName != null ? $"SerializedName='{Info.SerializedName}'" : String.Empty; + var readOnlyText = Info.ReadOnly ? "ReadOnly" : String.Empty; + var descriptionText = !String.IsNullOrEmpty(Info.Description) ? $"Description='{Info.Description.ToPsStringLiteral()}'" : String.Empty;*/ + + var requiredText = Info.Required ? "Required" : String.Empty; + var unwrappedType = ParameterType.Unwrap(); + var hasValidPossibleTypes = Info.PossibleTypes.Any(pt => pt != unwrappedType); + var possibleTypesText = hasValidPossibleTypes + ? $"PossibleTypes=({Info.PossibleTypes.Select(pt => $"[{pt.ToPsType()}]").JoinIgnoreEmpty(ItemSeparator)})" + : String.Empty; + var propertyText = new[] { /*serializedNameText, */requiredText,/* readOnlyText,*/ possibleTypesText/*, descriptionText*/ }.JoinIgnoreEmpty(ItemSeparator); + return hasValidPossibleTypes ? $"{Indent}[{typeof(InfoAttribute).ToPsAttributeType()}({propertyText})]{Environment.NewLine}" : String.Empty; + } + } + + internal class PropertySyntaxOutput + { + public string ParameterName { get; } + public Type ParameterType { get; } + public bool IsMandatory { get; } + public int? Position { get; } + + public bool IncludeSpace { get; } + public bool IncludeDash { get; } + + public PropertySyntaxOutput(Parameter parameter) + { + ParameterName = parameter.ParameterName; + ParameterType = parameter.ParameterType; + IsMandatory = parameter.IsMandatory; + Position = parameter.Position; + IncludeSpace = true; + IncludeDash = true; + } + + public PropertySyntaxOutput(ComplexInterfaceInfo complexInterfaceInfo) + { + ParameterName = complexInterfaceInfo.Name; + ParameterType = complexInterfaceInfo.Type; + IsMandatory = complexInterfaceInfo.Required; + Position = null; + IncludeSpace = false; + IncludeDash = false; + } + + public override string ToString() + { + var leftOptional = !IsMandatory ? "[" : String.Empty; + var leftPositional = Position != null ? "[" : String.Empty; + var rightPositional = Position != null ? "]" : String.Empty; + var type = ParameterType != typeof(SwitchParameter) ? $" <{ParameterType.ToSyntaxTypeName()}>" : String.Empty; + var rightOptional = !IsMandatory ? "]" : String.Empty; + var space = IncludeSpace ? " " : String.Empty; + var dash = IncludeDash ? "-" : String.Empty; + return $"{space}{leftOptional}{leftPositional}{dash}{ParameterName}{rightPositional}{type}{rightOptional}"; + } + } + + internal static class PsProxyOutputExtensions + { + public const string NoParameters = "__NoParameters"; + + public const string AllParameterSets = "__AllParameterSets"; + + public const string HalfIndent = " "; + + public const string Indent = HalfIndent + HalfIndent; + + public const string ItemSeparator = ", "; + + public static readonly string ComplexParameterHeader = $"COMPLEX PARAMETER PROPERTIES{Environment.NewLine}{Environment.NewLine}To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.{Environment.NewLine}{Environment.NewLine}"; + + public static string ToPsBool(this bool value) => $"${value.ToString().ToLowerInvariant()}"; + + public static string ToPsType(this Type type) + { + var regex = new Regex(@"^(.*)`{1}\d+(.*)$"); + var typeText = type.ToString(); + var match = regex.Match(typeText); + return match.Success ? $"{match.Groups[1]}{match.Groups[2]}" : typeText; + } + + public static string ToPsAttributeType(this Type type) => type.ToPsType().RemoveEnd("Attribute"); + + // https://stackoverflow.com/a/5284606/294804 + private static string RemoveEnd(this string text, string suffix) => text.EndsWith(suffix) ? text.Substring(0, text.Length - suffix.Length) : text; + + public static string ToPsSingleLine(this string value, string replacer = " ") => value.ReplaceNewLines(replacer, new[] { "
", "\r\n", "\n" }); + + public static string ToPsStringLiteral(this string value) => value?.Replace("'", "''").Replace("‘", "''").Replace("’", "''").ToPsSingleLine().Trim() ?? String.Empty; + + public static string JoinIgnoreEmpty(this IEnumerable values, string separator) => String.Join(separator, values?.Where(v => !String.IsNullOrEmpty(v))); + + // https://stackoverflow.com/a/41961738/294804 + public static string ToSyntaxTypeName(this Type type) + { + if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)) + { + return $"{type.GetGenericArguments().First().ToSyntaxTypeName()}?"; + } + + if (type.IsGenericType) + { + var genericTypes = String.Join(ItemSeparator, type.GetGenericArguments().Select(ToSyntaxTypeName)); + return $"{type.Name.Split('`').First()}<{genericTypes}>"; + } + + return type.Name; + } + + public static OutputTypeOutput ToOutputTypeOutput(this IEnumerable outputTypes) => new OutputTypeOutput(outputTypes); + + public static CmdletBindingOutput ToCmdletBindingOutput(this VariantGroup variantGroup) => new CmdletBindingOutput(variantGroup); + + public static ParameterOutput ToParameterOutput(this Parameter parameter, bool hasMultipleVariantsInVariantGroup, bool hasAllVariantsInParameterGroup) => new ParameterOutput(parameter, hasMultipleVariantsInVariantGroup, hasAllVariantsInParameterGroup); + + public static AliasOutput ToAliasOutput(this string[] aliases, bool includeIndent = false) => new AliasOutput(aliases, includeIndent); + + public static ValidateNotNullOutput ToValidateNotNullOutput(this bool hasValidateNotNull) => new ValidateNotNullOutput(hasValidateNotNull); + + public static AllowEmptyArrayOutput ToAllowEmptyArray(this bool hasAllowEmptyArray) => new AllowEmptyArrayOutput(hasAllowEmptyArray); + + public static ArgumentCompleterOutput ToArgumentCompleterOutput(this CompleterInfo completerInfo) => new ArgumentCompleterOutput(completerInfo); + + public static DefaultInfoOutput ToDefaultInfoOutput(this ParameterGroup parameterGroup) => new DefaultInfoOutput(parameterGroup); + + public static ParameterTypeOutput ToParameterTypeOutput(this Type parameterType) => new ParameterTypeOutput(parameterType); + + public static ParameterNameOutput ToParameterNameOutput(this string parameterName, bool isLast) => new ParameterNameOutput(parameterName, isLast); + + public static BeginOutput ToBeginOutput(this VariantGroup variantGroup) => new BeginOutput(variantGroup); + + public static ProcessOutput ToProcessOutput(this VariantGroup variantGroup) => new ProcessOutput(variantGroup); + + public static EndOutput ToEndOutput(this VariantGroup variantGroup) => new EndOutput(variantGroup); + + public static HelpCommentOutput ToHelpCommentOutput(this VariantGroup variantGroup) => new HelpCommentOutput(variantGroup); + + public static ParameterDescriptionOutput ToParameterDescriptionOutput(this string description) => new ParameterDescriptionOutput(description); + + public static ProfileOutput ToProfileOutput(this string profileName) => new ProfileOutput(profileName); + + public static DescriptionOutput ToDescriptionOutput(this string description) => new DescriptionOutput(description); + + public static ParameterCategoryOutput ToParameterCategoryOutput(this ParameterCategory category) => new ParameterCategoryOutput(category); + + public static PropertySyntaxOutput ToPropertySyntaxOutput(this Parameter parameter) => new PropertySyntaxOutput(parameter); + + public static PropertySyntaxOutput ToPropertySyntaxOutput(this ComplexInterfaceInfo complexInterfaceInfo) => new PropertySyntaxOutput(complexInterfaceInfo); + + public static InfoOutput ToInfoOutput(this InfoAttribute info, Type parameterType) => new InfoOutput(info, parameterType); + + public static string ToNoteOutput(this ComplexInterfaceInfo complexInterfaceInfo, string currentIndent = "", bool includeDashes = false, bool includeBackticks = false, bool isFirst = true) + { + string RenderProperty(ComplexInterfaceInfo info, string indent, bool dash, bool backtick) => + $"{indent}{(dash ? "- " : String.Empty)}{(backtick ? "`" : String.Empty)}{info.ToPropertySyntaxOutput()}{(backtick ? "`" : String.Empty)}: {info.Description}"; + + var nested = complexInterfaceInfo.NestedInfos.Select(ni => + { + var nestedIndent = $"{currentIndent}{HalfIndent}"; + return ni.IsComplexInterface + ? ni.ToNoteOutput(nestedIndent, includeDashes, includeBackticks, false) + : RenderProperty(ni, nestedIndent, includeDashes, includeBackticks); + }).Prepend(RenderProperty(complexInterfaceInfo, currentIndent, !isFirst && includeDashes, includeBackticks)); + return String.Join(Environment.NewLine, nested); + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs new file mode 100644 index 000000000000..421cde4746d2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs @@ -0,0 +1,514 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; +using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell.PsProxyTypeExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + internal class ProfileGroup + { + public string ProfileName { get; } + public Variant[] Variants { get; } + public string ProfileFolder { get; } + + public ProfileGroup(Variant[] variants, string profileName = NoProfiles) + { + ProfileName = profileName; + Variants = variants; + ProfileFolder = ProfileName != NoProfiles ? ProfileName : String.Empty; + } + } + + internal class VariantGroup + { + public string ModuleName { get; } + + public string RootModuleName {get => @"Az.StackHCI";} + public string CmdletName { get; } + public string CmdletVerb { get; } + public string CmdletNoun { get; } + public string ProfileName { get; } + public Variant[] Variants { get; } + public ParameterGroup[] ParameterGroups { get; } + public ComplexInterfaceInfo[] ComplexInterfaceInfos { get; } + + public string[] Aliases { get; } + public PSTypeName[] OutputTypes { get; } + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + public string DefaultParameterSetName { get; } + public bool HasMultipleVariants { get; } + public PsHelpInfo HelpInfo { get; } + public bool IsGenerated { get; } + public bool IsInternal { get; } + + public string OutputFolder { get; } + public string FileName { get; } + public string FilePath { get; } + + public CommentInfo CommentInfo { get; } + + public VariantGroup(string moduleName, string cmdletName, Variant[] variants, string outputFolder, string profileName = NoProfiles, bool isTest = false, bool isInternal = false) + { + ModuleName = moduleName; + CmdletName = cmdletName; + var cmdletNameParts = CmdletName.Split('-'); + CmdletVerb = cmdletNameParts.First(); + CmdletNoun = cmdletNameParts.Last(); + ProfileName = profileName; + Variants = variants; + ParameterGroups = Variants.ToParameterGroups().OrderBy(pg => pg.OrderCategory).ThenByDescending(pg => pg.IsMandatory).ToArray(); + var aliasDuplicates = ParameterGroups.SelectMany(pg => pg.Aliases) + //https://stackoverflow.com/a/18547390/294804 + .GroupBy(a => a).Where(g => g.Count() > 1).Select(g => g.Key).ToArray(); + if (aliasDuplicates.Any()) + { + throw new ParsingMetadataException($"The alias(es) [{String.Join(", ", aliasDuplicates)}] are defined on multiple parameters for cmdlet '{CmdletName}', which is not supported."); + } + ComplexInterfaceInfos = ParameterGroups.Where(pg => !pg.DontShow && pg.IsComplexInterface).OrderBy(pg => pg.ParameterName).Select(pg => pg.ComplexInterfaceInfo).ToArray(); + + Aliases = Variants.SelectMany(v => v.Attributes).ToAliasNames().ToArray(); + OutputTypes = Variants.SelectMany(v => v.Info.OutputType).Where(ot => ot.Type != null).GroupBy(ot => ot.Type).Select(otg => otg.First()).ToArray(); + SupportsShouldProcess = Variants.Any(v => v.SupportsShouldProcess); + SupportsPaging = Variants.Any(v => v.SupportsPaging); + DefaultParameterSetName = DetermineDefaultParameterSetName(); + HasMultipleVariants = Variants.Length > 1; + HelpInfo = Variants.Select(v => v.HelpInfo).FirstOrDefault() ?? new PsHelpInfo(); + IsGenerated = Variants.All(v => v.Attributes.OfType().Any()); + IsInternal = isInternal; + + OutputFolder = outputFolder; + FileName = $"{CmdletName}{(isTest ? ".Tests" : String.Empty)}.ps1"; + FilePath = Path.Combine(OutputFolder, FileName); + + CommentInfo = new CommentInfo(this); + } + + private string DetermineDefaultParameterSetName() + { + var defaultParameterSet = Variants + .Select(v => v.Metadata.DefaultParameterSetName) + .LastOrDefault(dpsn => dpsn.IsValidDefaultParameterSetName()); + + if (String.IsNullOrEmpty(defaultParameterSet)) + { + var variantParamCountGroups = Variants + .Select(v => ( + variant: v.VariantName, + paramCount: v.CmdletOnlyParameters.Count(p => p.IsMandatory), + isSimple: v.CmdletOnlyParameters.Where(p => p.IsMandatory).All(p => p.ParameterType.IsPsSimple()))) + .GroupBy(vpc => vpc.isSimple) + .ToArray(); + var variantParameterCounts = (variantParamCountGroups.Any(g => g.Key) ? variantParamCountGroups.Where(g => g.Key) : variantParamCountGroups).SelectMany(g => g).ToArray(); + var smallestParameterCount = variantParameterCounts.Min(vpc => vpc.paramCount); + defaultParameterSet = variantParameterCounts.First(vpc => vpc.paramCount == smallestParameterCount).variant; + } + + return defaultParameterSet; + } + } + + internal class Variant + { + public string CmdletName { get; } + public string VariantName { get; } + public CommandInfo Info { get; } + public CommandMetadata Metadata { get; } + public PsHelpInfo HelpInfo { get; } + public bool HasParameterSets { get; } + public bool IsFunction { get; } + public string PrivateModuleName { get; } + public string PrivateCmdletName { get; } + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + + public Attribute[] Attributes { get; } + public Parameter[] Parameters { get; } + public Parameter[] CmdletOnlyParameters { get; } + public bool IsInternal { get; } + public bool IsDoNotExport { get; } + public string[] Profiles { get; } + + public Variant(string cmdletName, string variantName, CommandInfo info, CommandMetadata metadata, bool hasParameterSets = false, PsHelpInfo helpInfo = null) + { + CmdletName = cmdletName; + VariantName = variantName; + Info = info; + HelpInfo = helpInfo ?? new PsHelpInfo(); + Metadata = metadata; + HasParameterSets = hasParameterSets; + IsFunction = Info.CommandType == CommandTypes.Function; + PrivateModuleName = Info.Source; + PrivateCmdletName = Metadata.Name; + SupportsShouldProcess = Metadata.SupportsShouldProcess; + SupportsPaging = Metadata.SupportsPaging; + + Attributes = this.ToAttributes(); + Parameters = this.ToParameters().OrderBy(p => p.OrderCategory).ThenByDescending(p => p.IsMandatory).ToArray(); + IsInternal = Attributes.OfType().Any(); + IsDoNotExport = Attributes.OfType().Any(); + CmdletOnlyParameters = Parameters.Where(p => !p.Categories.Any(c => c == ParameterCategory.Azure || c == ParameterCategory.Runtime)).ToArray(); + Profiles = Attributes.OfType().SelectMany(pa => pa.Profiles).ToArray(); + } + } + + internal class ParameterGroup + { + public string ParameterName { get; } + public Parameter[] Parameters { get; } + + public string[] VariantNames { get; } + public string[] AllVariantNames { get; } + public bool HasAllVariants { get; } + public Type ParameterType { get; } + public string Description { get; } + + public string[] Aliases { get; } + public bool HasValidateNotNull { get; } + public bool HasAllowEmptyArray { get; } + public CompleterInfo CompleterInfo { get; } + public DefaultInfo DefaultInfo { get; } + public bool HasDefaultInfo { get; } + public ParameterCategory OrderCategory { get; } + public bool DontShow { get; } + public bool IsMandatory { get; } + public bool SupportsWildcards { get; } + public bool IsComplexInterface { get; } + public ComplexInterfaceInfo ComplexInterfaceInfo { get; } + public InfoAttribute InfoAttribute { get; } + + public int? FirstPosition { get; } + public bool ValueFromPipeline { get; } + public bool ValueFromPipelineByPropertyName { get; } + public bool IsInputType { get; } + + public ParameterGroup(string parameterName, Parameter[] parameters, string[] allVariantNames) + { + ParameterName = parameterName; + Parameters = parameters; + + VariantNames = Parameters.Select(p => p.VariantName).ToArray(); + AllVariantNames = allVariantNames; + HasAllVariants = VariantNames.Any(vn => vn == AllParameterSets) || !AllVariantNames.Except(VariantNames).Any(); + var types = Parameters.Select(p => p.ParameterType).Distinct().ToArray(); + if (types.Length > 1) + { + throw new ParsingMetadataException($"The parameter '{ParameterName}' has multiple parameter types [{String.Join(", ", types.Select(t => t.Name))}] defined, which is not supported."); + } + ParameterType = types.First(); + Description = Parameters.Select(p => p.Description).FirstOrDefault(d => !String.IsNullOrEmpty(d)).EmptyIfNull(); + + Aliases = Parameters.SelectMany(p => p.Attributes).ToAliasNames().ToArray(); + HasValidateNotNull = Parameters.SelectMany(p => p.Attributes.OfType()).Any(); + HasAllowEmptyArray = Parameters.SelectMany(p => p.Attributes.OfType()).Any(); + CompleterInfo = Parameters.Select(p => p.CompleterInfoAttribute).FirstOrDefault()?.ToCompleterInfo() + ?? Parameters.Select(p => p.ArgumentCompleterAttribute).FirstOrDefault()?.ToCompleterInfo(); + DefaultInfo = Parameters.Select(p => p.DefaultInfoAttribute).FirstOrDefault()?.ToDefaultInfo(this) + ?? Parameters.Select(p => p.DefaultValueAttribute).FirstOrDefault(dv => dv != null)?.ToDefaultInfo(this); + HasDefaultInfo = DefaultInfo != null && !String.IsNullOrEmpty(DefaultInfo.Script); + // When DefaultInfo is present, force all parameters from this group to be optional. + if (HasDefaultInfo) + { + foreach (var parameter in Parameters) + { + parameter.IsMandatory = false; + } + } + OrderCategory = Parameters.Select(p => p.OrderCategory).Distinct().DefaultIfEmpty(ParameterCategory.Body).Min(); + DontShow = Parameters.All(p => p.DontShow); + IsMandatory = HasAllVariants && Parameters.Any(p => p.IsMandatory); + SupportsWildcards = Parameters.Any(p => p.SupportsWildcards); + IsComplexInterface = Parameters.Any(p => p.IsComplexInterface); + ComplexInterfaceInfo = Parameters.Where(p => p.IsComplexInterface).Select(p => p.ComplexInterfaceInfo).FirstOrDefault(); + InfoAttribute = Parameters.Select(p => p.InfoAttribute).First(); + + FirstPosition = Parameters.Select(p => p.Position).FirstOrDefault(p => p != null); + ValueFromPipeline = Parameters.Any(p => p.ValueFromPipeline); + ValueFromPipelineByPropertyName = Parameters.Any(p => p.ValueFromPipelineByPropertyName); + IsInputType = ValueFromPipeline || ValueFromPipelineByPropertyName; + } + } + + internal class Parameter + { + public string VariantName { get; } + public string ParameterName { get; } + public ParameterMetadata Metadata { get; } + public PsParameterHelpInfo HelpInfo { get; } + public Type ParameterType { get; } + + public Attribute[] Attributes { get; } + public ParameterCategory[] Categories { get; } + public ParameterCategory OrderCategory { get; } + public PSDefaultValueAttribute DefaultValueAttribute { get; } + public DefaultInfoAttribute DefaultInfoAttribute { get; } + public ParameterAttribute ParameterAttribute { get; } + public bool SupportsWildcards { get; } + public CompleterInfoAttribute CompleterInfoAttribute { get; } + public ArgumentCompleterAttribute ArgumentCompleterAttribute { get; } + + public bool ValueFromPipeline { get; } + public bool ValueFromPipelineByPropertyName { get; } + public int? Position { get; } + public bool DontShow { get; } + public bool IsMandatory { get; set; } + + public InfoAttribute InfoAttribute { get; } + public ComplexInterfaceInfo ComplexInterfaceInfo { get; } + public bool IsComplexInterface { get; } + public string Description { get; } + + public Parameter(string variantName, string parameterName, ParameterMetadata metadata, PsParameterHelpInfo helpInfo = null) + { + VariantName = variantName; + ParameterName = parameterName; + Metadata = metadata; + HelpInfo = helpInfo ?? new PsParameterHelpInfo(); + + Attributes = Metadata.Attributes.ToArray(); + ParameterType = Attributes.OfType().FirstOrDefault()?.Type ?? Metadata.ParameterType; + Categories = Attributes.OfType().SelectMany(ca => ca.Categories).Distinct().ToArray(); + OrderCategory = Categories.DefaultIfEmpty(ParameterCategory.Body).Min(); + DefaultValueAttribute = Attributes.OfType().FirstOrDefault(); + DefaultInfoAttribute = Attributes.OfType().FirstOrDefault(); + ParameterAttribute = Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == VariantName || pa.ParameterSetName == AllParameterSets); + if (ParameterAttribute == null) + { + throw new ParsingMetadataException($"The variant '{VariantName}' has multiple parameter sets defined, which is not supported."); + } + SupportsWildcards = Attributes.OfType().Any(); + CompleterInfoAttribute = Attributes.OfType().FirstOrDefault(); + ArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(); + + ValueFromPipeline = ParameterAttribute.ValueFromPipeline; + ValueFromPipelineByPropertyName = ParameterAttribute.ValueFromPipelineByPropertyName; + Position = ParameterAttribute.Position == Int32.MinValue ? (int?)null : ParameterAttribute.Position; + DontShow = ParameterAttribute.DontShow; + IsMandatory = ParameterAttribute.Mandatory; + + var complexParameterName = ParameterName.ToUpperInvariant(); + var complexMessage = $"{Environment.NewLine}To construct, see NOTES section for {complexParameterName} properties and create a hash table."; + var description = ParameterAttribute.HelpMessage.NullIfEmpty() ?? HelpInfo.Description.NullIfEmpty() ?? InfoAttribute?.Description.NullIfEmpty() ?? String.Empty; + // Remove the complex type message as it will be reinserted if this is a complex type + description = description.NormalizeNewLines().Replace(complexMessage, String.Empty).Replace(complexMessage.ToPsSingleLine(), String.Empty); + // Make an InfoAttribute for processing only if one isn't provided + InfoAttribute = Attributes.OfType().FirstOrDefault() ?? new InfoAttribute { PossibleTypes = new[] { ParameterType.Unwrap() }, Required = IsMandatory }; + // Set the description if the InfoAttribute does not have one since they are exported without a description + InfoAttribute.Description = String.IsNullOrEmpty(InfoAttribute.Description) ? description : InfoAttribute.Description; + ComplexInterfaceInfo = InfoAttribute.ToComplexInterfaceInfo(complexParameterName, ParameterType, true); + IsComplexInterface = ComplexInterfaceInfo.IsComplexInterface; + Description = $"{description}{(IsComplexInterface ? complexMessage : String.Empty)}"; + } + } + + internal class ComplexInterfaceInfo + { + public InfoAttribute InfoAttribute { get; } + + public string Name { get; } + public Type Type { get; } + public bool Required { get; } + public bool ReadOnly { get; } + public string Description { get; } + + public ComplexInterfaceInfo[] NestedInfos { get; } + public bool IsComplexInterface { get; } + + public ComplexInterfaceInfo(string name, Type type, InfoAttribute infoAttribute, bool? required, List seenTypes) + { + Name = name; + Type = type; + InfoAttribute = infoAttribute; + + Required = required ?? InfoAttribute.Required; + ReadOnly = InfoAttribute.ReadOnly; + Description = InfoAttribute.Description.ToPsSingleLine(); + + var unwrappedType = Type.Unwrap(); + var hasBeenSeen = seenTypes?.Contains(unwrappedType) ?? false; + (seenTypes ?? (seenTypes = new List())).Add(unwrappedType); + NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[]{} : + unwrappedType.GetInterfaces() + .Concat(InfoAttribute.PossibleTypes) + .SelectMany(pt => pt.GetProperties() + .SelectMany(pi => pi.GetCustomAttributes(true).OfType() + .Select(ia => ia.ToComplexInterfaceInfo(pi.Name, pi.PropertyType, seenTypes: seenTypes)))) + .Where(cii => !cii.ReadOnly).OrderByDescending(cii => cii.Required).ToArray(); + // https://stackoverflow.com/a/503359/294804 + var associativeArrayInnerType = Type.GetInterfaces() + .FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IAssociativeArray<>)) + ?.GetTypeInfo().GetGenericArguments().First(); + if (!hasBeenSeen && associativeArrayInnerType != null) + { + var anyInfo = new InfoAttribute { Description = "This indicates any property can be added to this object." }; + NestedInfos = NestedInfos.Prepend(anyInfo.ToComplexInterfaceInfo("(Any)", associativeArrayInnerType)).ToArray(); + } + IsComplexInterface = NestedInfos.Any(); + } + } + + internal class CommentInfo + { + public string Description { get; } + public string Synopsis { get; } + + public string[] Examples { get; } + public string[] Inputs { get; } + public string[] Outputs { get; } + + public string OnlineVersion { get; } + public string[] RelatedLinks { get; } + + private const string HelpLinkPrefix = @"https://learn.microsoft.com/powershell/module/"; + + public CommentInfo(VariantGroup variantGroup) + { + var helpInfo = variantGroup.HelpInfo; + Description = variantGroup.Variants.SelectMany(v => v.Attributes).OfType().FirstOrDefault()?.Description.NullIfEmpty() + ?? helpInfo.Description.EmptyIfNull(); + // If there is no Synopsis, PowerShell may put in the Syntax string as the Synopsis. This seems unintended, so we remove the Synopsis in this situation. + var synopsis = helpInfo.Synopsis.EmptyIfNull().Trim().StartsWith(variantGroup.CmdletName) ? String.Empty : helpInfo.Synopsis; + Synopsis = synopsis.NullIfEmpty() ?? Description; + + Examples = helpInfo.Examples.Select(rl => rl.Code).ToArray(); + + Inputs = (variantGroup.ParameterGroups.Where(pg => pg.IsInputType).Select(pg => pg.ParameterType.FullName).ToArray().NullIfEmpty() ?? + helpInfo.InputTypes.Where(it => it.Name.NullIfWhiteSpace() != null).Select(it => it.Name).ToArray()) + .Where(i => i != "None").Distinct().OrderBy(i => i).ToArray(); + Outputs = (variantGroup.OutputTypes.Select(ot => ot.Type.FullName).ToArray().NullIfEmpty() ?? + helpInfo.OutputTypes.Where(it => it.Name.NullIfWhiteSpace() != null).Select(ot => ot.Name).ToArray()) + .Where(o => o != "None").Distinct().OrderBy(o => o).ToArray(); + + // Use root module name in the help link + var moduleName = variantGroup.RootModuleName == "" ? variantGroup.ModuleName.ToLowerInvariant() : variantGroup.RootModuleName.ToLowerInvariant(); + OnlineVersion = helpInfo.OnlineVersion?.Uri.NullIfEmpty() ?? $@"{HelpLinkPrefix}{moduleName}/{variantGroup.CmdletName.ToLowerInvariant()}"; + RelatedLinks = helpInfo.RelatedLinks.Select(rl => rl.Text).ToArray(); + } + } + + internal class CompleterInfo + { + public string Name { get; } + public string Description { get; } + public string Script { get; } + public Type Type { get; } + public bool IsTypeCompleter { get; } + + public CompleterInfo(CompleterInfoAttribute infoAttribute) + { + Name = infoAttribute.Name; + Description = infoAttribute.Description; + Script = infoAttribute.Script; + } + + public CompleterInfo(ArgumentCompleterAttribute completerAttribute) + { + Script = completerAttribute.ScriptBlock?.ToString(); + if (completerAttribute.Type != null) + { + Type = completerAttribute.Type; + IsTypeCompleter = true; + } + } + } + + internal class DefaultInfo + { + public string Name { get; } + public string Description { get; } + public string Script { get; } + public ParameterGroup ParameterGroup { get; } + + public DefaultInfo(DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) + { + Name = infoAttribute.Name; + Description = infoAttribute.Description; + Script = infoAttribute.Script; + ParameterGroup = parameterGroup; + } + + public DefaultInfo(PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) + { + Description = defaultValueAttribute.Help; + ParameterGroup = parameterGroup; + if (defaultValueAttribute.Value != null) + { + Script = defaultValueAttribute.Value.ToString(); + } + } + } + + internal static class PsProxyTypeExtensions + { + public const string NoProfiles = "__NoProfiles"; + + public static bool IsValidDefaultParameterSetName(this string parameterSetName) => + !String.IsNullOrEmpty(parameterSetName) && parameterSetName != AllParameterSets; + + public static Variant[] ToVariants(this CommandInfo info, PsHelpInfo helpInfo) + { + var metadata = new CommandMetadata(info); + var privateCmdletName = metadata.Name.Split('!').First(); + var parts = privateCmdletName.Split('_'); + return parts.Length > 1 + ? new[] { new Variant(parts[0], parts[1], info, metadata, helpInfo: helpInfo) } + // Process multiple parameter sets, so we declare a variant per parameter set. + : info.ParameterSets.Select(ps => new Variant(privateCmdletName, ps.Name, info, metadata, true, helpInfo)).ToArray(); + } + + public static Variant[] ToVariants(this CmdletAndHelpInfo info) => info.CommandInfo.ToVariants(info.HelpInfo); + + public static Variant[] ToVariants(this CommandInfo info, PSObject helpInfo = null) => info.ToVariants(helpInfo?.ToPsHelpInfo()); + + public static Parameter[] ToParameters(this Variant variant) + { + var parameters = variant.Metadata.Parameters.AsEnumerable(); + var parameterHelp = variant.HelpInfo.Parameters.AsEnumerable(); + + if (variant.HasParameterSets) + { + parameters = parameters.Where(p => p.Value.ParameterSets.Keys.Any(k => k == variant.VariantName || k == AllParameterSets)); + parameterHelp = parameterHelp.Where(ph => (!ph.ParameterSetNames.Any() || ph.ParameterSetNames.Any(psn => psn == variant.VariantName || psn == AllParameterSets)) && ph.Name != "IncludeTotalCount"); + } + var result = parameters.Select(p => new Parameter(variant.VariantName, p.Key, p.Value, parameterHelp.FirstOrDefault(ph => ph.Name == p.Key))); + if (variant.SupportsPaging) { + // If supportsPaging is set, we will need to add First and Skip parameters since they are treated as common parameters which as not contained on Metadata>parameters + variant.Info.Parameters["First"].Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == variant.VariantName || pa.ParameterSetName == AllParameterSets).HelpMessage = "Gets only the first 'n' objects."; + variant.Info.Parameters["Skip"].Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == variant.VariantName || pa.ParameterSetName == AllParameterSets).HelpMessage = "Ignores the first 'n' objects and then gets the remaining objects."; + result = result.Append(new Parameter(variant.VariantName, "First", variant.Info.Parameters["First"], parameterHelp.FirstOrDefault(ph => ph.Name == "First"))); + result = result.Append(new Parameter(variant.VariantName, "Skip", variant.Info.Parameters["Skip"], parameterHelp.FirstOrDefault(ph => ph.Name == "Skip"))); + } + return result.ToArray(); + } + + public static Attribute[] ToAttributes(this Variant variant) => variant.IsFunction + ? ((FunctionInfo)variant.Info).ScriptBlock.Attributes.ToArray() + : variant.Metadata.CommandType.GetCustomAttributes(false).Cast().ToArray(); + + public static IEnumerable ToParameterGroups(this Variant[] variants) + { + var allVariantNames = variants.Select(vg => vg.VariantName).ToArray(); + return variants + .SelectMany(v => v.Parameters) + .GroupBy(p => p.ParameterName, StringComparer.InvariantCultureIgnoreCase) + .Select(pg => new ParameterGroup(pg.Key, pg.Select(p => p).ToArray(), allVariantNames)); + } + + public static ComplexInterfaceInfo ToComplexInterfaceInfo(this InfoAttribute infoAttribute, string name, Type type, bool? required = null, List seenTypes = null) + => new ComplexInterfaceInfo(name, type, infoAttribute, required, seenTypes); + + public static CompleterInfo ToCompleterInfo(this CompleterInfoAttribute infoAttribute) => new CompleterInfo(infoAttribute); + public static CompleterInfo ToCompleterInfo(this ArgumentCompleterAttribute completerAttribute) => new CompleterInfo(completerAttribute); + + public static DefaultInfo ToDefaultInfo(this DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) => new DefaultInfo(infoAttribute, parameterGroup); + public static DefaultInfo ToDefaultInfo(this PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) => new DefaultInfo(defaultValueAttribute, parameterGroup); + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/PsAttributes.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/PsAttributes.cs new file mode 100644 index 000000000000..c9b237ee37b6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/PsAttributes.cs @@ -0,0 +1,121 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm +{ + [AttributeUsage(AttributeTargets.Class)] + public class DescriptionAttribute : Attribute + { + public string Description { get; } + + public DescriptionAttribute(string description) + { + Description = description; + } + } + + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)] + public class DoNotExportAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class InternalExportAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class GeneratedAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)] + public class DoNotFormatAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class ProfileAttribute : Attribute + { + public string[] Profiles { get; } + + public ProfileAttribute(params string[] profiles) + { + Profiles = profiles; + } + } + + [AttributeUsage(AttributeTargets.Class)] + public class HttpPathAttribute : Attribute + { + public string Path { get; set; } + public string ApiVersion { get; set; } + } + + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class CategoryAttribute : Attribute + { + public ParameterCategory[] Categories { get; } + + public CategoryAttribute(params ParameterCategory[] categories) + { + Categories = categories; + } + } + + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class ExportAsAttribute : Attribute + { + public Type Type { get; set; } + + public ExportAsAttribute(Type type) + { + Type = type; + } + } + + public enum ParameterCategory + { + // Note: Order is significant + Uri = 0, + Path, + Query, + Header, + Cookie, + Body, + Azure, + Runtime + } + + [AttributeUsage(AttributeTargets.Property)] + public class OriginAttribute : Attribute + { + public PropertyOrigin Origin { get; } + + public OriginAttribute(PropertyOrigin origin) + { + Origin = origin; + } + } + + public enum PropertyOrigin + { + // Note: Order is significant + Inherited = 0, + Owned, + Inlined + } + + [AttributeUsage(AttributeTargets.Property)] + public class FormatTableAttribute : Attribute + { + public int Index { get; set; } = -1; + public bool HasIndex => Index != -1; + public string Label { get; set; } + public int Width { get; set; } = -1; + public bool HasWidth => Width != -1; + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/PsExtensions.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/PsExtensions.cs new file mode 100644 index 000000000000..8d5129376015 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/PsExtensions.cs @@ -0,0 +1,169 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + internal static class PsExtensions + { + // https://stackoverflow.com/a/863944/294804 + // https://stackoverflow.com/a/4452598/294804 + // https://stackoverflow.com/a/28701974/294804 + // Note: This will unwrap nested collections, but we don't generate nested collections. + public static Type Unwrap(this Type type) + { + if (type.IsArray) + { + return type.GetElementType().Unwrap(); + } + + var typeInfo = type.GetTypeInfo(); + if (typeInfo.IsGenericType + && (typeInfo.GetGenericTypeDefinition() == typeof(Nullable<>) || typeof(IEnumerable<>).IsAssignableFrom(type))) + { + return typeInfo.GetGenericArguments().First().Unwrap(); + } + + return type; + } + + // https://stackoverflow.com/a/863944/294804 + private static bool IsSimple(this Type type) + { + var typeInfo = type.GetTypeInfo(); + return typeInfo.IsPrimitive + || typeInfo.IsEnum + || type == typeof(string) + || type == typeof(decimal); + } + + // https://stackoverflow.com/a/32025393/294804 + private static bool HasImplicitConversion(this Type baseType, Type targetType) => + baseType.GetMethods(BindingFlags.Public | BindingFlags.Static) + .Where(mi => mi.Name == "op_Implicit" && mi.ReturnType == targetType) + .Any(mi => mi.GetParameters().FirstOrDefault()?.ParameterType == baseType); + + public static bool IsPsSimple(this Type type) + { + var unwrappedType = type.Unwrap(); + return unwrappedType.IsSimple() + || unwrappedType == typeof(SwitchParameter) + || unwrappedType == typeof(Hashtable) + || unwrappedType == typeof(PSCredential) + || unwrappedType == typeof(ScriptBlock) + || unwrappedType == typeof(DateTime) + || unwrappedType == typeof(Uri) + || unwrappedType.HasImplicitConversion(typeof(string)); + } + + public static string ToPsList(this IEnumerable items) => String.Join(", ", items.Select(i => $"'{i}'")); + + public static IEnumerable ToAliasNames(this IEnumerable attributes) => attributes.OfType().SelectMany(aa => aa.AliasNames).Distinct(); + + public static bool IsArrayAndElementTypeIsT(this object item) + { + var itemType = item.GetType(); + var tType = typeof(T); + return itemType.IsArray && !tType.IsArray && tType.IsAssignableFrom(itemType.GetElementType()); + } + + public static bool IsTArrayAndElementTypeIsItem(this object item) + { + var itemType = item.GetType(); + var tType = typeof(T); + return !itemType.IsArray && tType.IsArray && (tType.GetElementType()?.IsAssignableFrom(itemType) ?? false); + } + + public static bool IsTypeOrArrayOfType(this object item) => item is T || item.IsArrayAndElementTypeIsT() || item.IsTArrayAndElementTypeIsItem(); + + public static T NormalizeArrayType(this object item) + { + if (item is T result) + { + return result; + } + + if (item.IsArrayAndElementTypeIsT()) + { + var array = (T[])Convert.ChangeType(item, typeof(T[])); + return array.FirstOrDefault(); + } + + if (item.IsTArrayAndElementTypeIsItem()) + { + var tType = typeof(T); + var array = Array.CreateInstance(tType.GetElementType(), 1); + array.SetValue(item, 0); + return (T)Convert.ChangeType(array, tType); + } + + return default(T); + } + + public static T GetNestedProperty(this PSObject psObject, params string[] names) => psObject.Properties.GetNestedProperty(names); + + public static T GetNestedProperty(this PSMemberInfoCollection properties, params string[] names) + { + var lastName = names.Last(); + var nestedProperties = names.Take(names.Length - 1).Aggregate(properties, (p, n) => p?.GetProperty(n)?.Properties); + return nestedProperties != null ? nestedProperties.GetProperty(lastName) : default(T); + } + + public static T GetProperty(this PSObject psObject, string name) => psObject.Properties.GetProperty(name); + + public static T GetProperty(this PSMemberInfoCollection properties, string name) + { + switch (properties[name]?.Value) + { + case PSObject psObject when psObject.BaseObject is PSCustomObject && psObject.ImmediateBaseObject.IsTypeOrArrayOfType(): + return psObject.ImmediateBaseObject.NormalizeArrayType(); + case PSObject psObject when psObject.BaseObject.IsTypeOrArrayOfType(): + return psObject.BaseObject.NormalizeArrayType(); + case object value when value.IsTypeOrArrayOfType(): + return value.NormalizeArrayType(); + default: + return default(T); + } + } + + public static IEnumerable RunScript(this PSCmdlet cmdlet, string script) + => PsHelpers.RunScript(cmdlet.InvokeCommand, script); + + public static void RunScript(this PSCmdlet cmdlet, string script) + => cmdlet.RunScript(script); + + public static IEnumerable RunScript(this EngineIntrinsics engineIntrinsics, string script) + => PsHelpers.RunScript(engineIntrinsics.InvokeCommand, script); + + public static void RunScript(this EngineIntrinsics engineIntrinsics, string script) + => engineIntrinsics.RunScript(script); + + public static IEnumerable RunScript(this PSCmdlet cmdlet, ScriptBlock block) + => PsHelpers.RunScript(cmdlet.InvokeCommand, block.ToString()); + + public static void RunScript(this PSCmdlet cmdlet, ScriptBlock block) + => cmdlet.RunScript(block.ToString()); + + public static IEnumerable RunScript(this EngineIntrinsics engineIntrinsics, ScriptBlock block) + => PsHelpers.RunScript(engineIntrinsics.InvokeCommand, block.ToString()); + + public static void RunScript(this EngineIntrinsics engineIntrinsics, ScriptBlock block) + => engineIntrinsics.RunScript(block.ToString()); + + /// + /// Returns if a parameter should be hidden by checking for . + /// + /// A PowerShell parameter. + public static bool IsHidden(this Parameter parameter) + { + return parameter.Attributes.Any(attr => attr is DoNotExportAttribute); + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/PsHelpers.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/PsHelpers.cs new file mode 100644 index 000000000000..45eb810af4c9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/PsHelpers.cs @@ -0,0 +1,105 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using Pwsh = System.Management.Automation.PowerShell; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + internal static class PsHelpers + { + public static IEnumerable RunScript(string script) + => Pwsh.Create().AddScript(script).Invoke(); + + public static void RunScript(string script) + => RunScript(script); + + public static IEnumerable RunScript(CommandInvocationIntrinsics cii, string script) + => cii.InvokeScript(script).Select(o => o?.BaseObject).Where(o => o != null).OfType(); + + public static void RunScript(CommandInvocationIntrinsics cii, string script) + => RunScript(cii, script); + + public static IEnumerable GetModuleCmdlets(PSCmdlet cmdlet, params string[] modulePaths) + { + var getCmdletsCommand = String.Join(" + ", modulePaths.Select(mp => $"(Get-Command -Module (Import-Module '{mp}' -PassThru))")); + return (cmdlet?.RunScript(getCmdletsCommand) ?? RunScript(getCmdletsCommand)) + .Where(ci => ci.CommandType != CommandTypes.Alias); + } + + public static IEnumerable GetModuleCmdlets(params string[] modulePaths) + => GetModuleCmdlets(null, modulePaths); + + public static IEnumerable GetScriptCmdlets(PSCmdlet cmdlet, string scriptFolder) + { + // https://stackoverflow.com/a/40969712/294804 + var wrappedFolder = scriptFolder.Contains("'") ? $@"""{scriptFolder}""" : $@"'{scriptFolder}'"; + var getCmdletsCommand = $@" +$currentFunctions = Get-ChildItem function: +Get-ChildItem -Path {wrappedFolder} -Recurse -Include '*.ps1' -File | ForEach-Object {{ . $_.FullName }} +Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }} +"; + return cmdlet?.RunScript(getCmdletsCommand) ?? RunScript(getCmdletsCommand); + } + + public static IEnumerable GetScriptCmdlets(string scriptFolder) + => GetScriptCmdlets(null, scriptFolder); + + public static IEnumerable GetScriptHelpInfo(PSCmdlet cmdlet, params string[] modulePaths) + { + var importModules = String.Join(Environment.NewLine, modulePaths.Select(mp => $"Import-Module '{mp}'")); + var getHelpCommand = $@" +$currentFunctions = Get-ChildItem function: +{importModules} +Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }} | ForEach-Object {{ Get-Help -Name $_.Name -Full }} +"; + return cmdlet?.RunScript(getHelpCommand) ?? RunScript(getHelpCommand); + } + + public static IEnumerable GetScriptHelpInfo(params string[] modulePaths) + => GetScriptHelpInfo(null, modulePaths); + + public static IEnumerable GetModuleCmdletsAndHelpInfo(PSCmdlet cmdlet, params string[] modulePaths) + { + var getCmdletAndHelp = String.Join(" + ", modulePaths.Select(mp => + $@"(Get-Command -Module (Import-Module '{mp}' -PassThru) | Where-Object {{ $_.CommandType -ne 'Alias' }} | ForEach-Object {{ @{{ CommandInfo = $_; HelpInfo = ( invoke-command {{ try {{ Get-Help -Name $_.Name -Full }} catch{{ '' }} }} ) }} }})" + )); + return (cmdlet?.RunScript(getCmdletAndHelp) ?? RunScript(getCmdletAndHelp)) + .Select(h => new CmdletAndHelpInfo { CommandInfo = (h["CommandInfo"] as PSObject)?.BaseObject as CommandInfo, HelpInfo = h["HelpInfo"] as PSObject }); + } + + public static IEnumerable GetModuleCmdletsAndHelpInfo(params string[] modulePaths) + => GetModuleCmdletsAndHelpInfo(null, modulePaths); + + public static CmdletAndHelpInfo ToCmdletAndHelpInfo(this CommandInfo commandInfo, PSObject helpInfo) => new CmdletAndHelpInfo { CommandInfo = commandInfo, HelpInfo = helpInfo }; + + public const string Psd1Indent = " "; + public const string GuidStart = Psd1Indent + "GUID"; + + public static Guid ReadGuidFromPsd1(string psd1Path) + { + var guid = Guid.NewGuid(); + if (File.Exists(psd1Path)) + { + var currentGuid = File.ReadAllLines(psd1Path) + .FirstOrDefault(l => l.StartsWith(GuidStart))?.Split(new[] { " = " }, StringSplitOptions.RemoveEmptyEntries) + .LastOrDefault()?.Replace("'", String.Empty); + guid = currentGuid != null ? Guid.Parse(currentGuid) : guid; + } + + return guid; + } + } + + internal class CmdletAndHelpInfo + { + public CommandInfo CommandInfo { get; set; } + public PSObject HelpInfo { get; set; } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/StringExtensions.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/StringExtensions.cs new file mode 100644 index 000000000000..ef0005f8171e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/StringExtensions.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + internal static class StringExtensions + { + public static string NullIfEmpty(this string text) => String.IsNullOrEmpty(text) ? null : text; + public static string NullIfWhiteSpace(this string text) => String.IsNullOrWhiteSpace(text) ? null : text; + public static string EmptyIfNull(this string text) => text ?? String.Empty; + + public static bool? ToNullableBool(this string text) => String.IsNullOrEmpty(text) ? (bool?)null : Convert.ToBoolean(text.ToLowerInvariant()); + + public static string ToUpperFirstCharacter(this string text) => String.IsNullOrEmpty(text) ? text : $"{text[0].ToString().ToUpperInvariant()}{text.Remove(0, 1)}"; + + public static string ReplaceNewLines(this string value, string replacer = " ", string[] newLineSymbols = null) + => (newLineSymbols ?? new []{ "\r\n", "\n" }).Aggregate(value.EmptyIfNull(), (current, symbol) => current.Replace(symbol, replacer)); + public static string NormalizeNewLines(this string value) => value.ReplaceNewLines("\u00A0").Replace("\u00A0", Environment.NewLine); + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/XmlExtensions.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/XmlExtensions.cs new file mode 100644 index 000000000000..b336ce7019f0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/BuildTime/XmlExtensions.cs @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.IO; +using System.Xml; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + internal static class XmlExtensions + { + public static string ToXmlString(this T inputObject, bool excludeDeclaration = false) + { + var serializer = new XmlSerializer(typeof(T)); + //https://stackoverflow.com/a/760290/294804 + //https://stackoverflow.com/a/3732234/294804 + var namespaces = new XmlSerializerNamespaces(new[] { XmlQualifiedName.Empty }); + var xmlSettings = new XmlWriterSettings { OmitXmlDeclaration = excludeDeclaration, Indent = true }; + using (var stringWriter = new StringWriter()) + using (var xmlWriter = XmlWriter.Create(stringWriter, xmlSettings)) + { + serializer.Serialize(xmlWriter, inputObject, namespaces); + return stringWriter.ToString(); + } + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/CmdInfoHandler.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/CmdInfoHandler.cs new file mode 100644 index 000000000000..1a8fd6ff6ebc --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/CmdInfoHandler.cs @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Management.Automation; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + using NextDelegate = Func, Task>, Task>; + using SignalDelegate = Func, Task>; + + public class CmdInfoHandler + { + private readonly string processRecordId; + private readonly string parameterSetName; + private readonly InvocationInfo invocationInfo; + + public CmdInfoHandler(string processRecordId, InvocationInfo invocationInfo, string parameterSetName) + { + this.processRecordId = processRecordId; + this.parameterSetName = parameterSetName; + this.invocationInfo = invocationInfo; + } + + public Task SendAsync(HttpRequestMessage request, CancellationToken token, Action cancel, SignalDelegate signal, NextDelegate next) + { + request.Headers.Add("x-ms-client-request-id", processRecordId); + request.Headers.Add("CommandName", invocationInfo?.InvocationName); + request.Headers.Add("FullCommandName", invocationInfo?.MyCommand?.Name); + request.Headers.Add("ParameterSetName", parameterSetName); + + // continue with pipeline. + return next(request, token, cancel, signal); + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/ConversionException.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/ConversionException.cs new file mode 100644 index 000000000000..9f781d9c7634 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/ConversionException.cs @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal class ConversionException : Exception + { + internal ConversionException(string message) + : base(message) { } + + internal ConversionException(JsonNode node, Type targetType) + : base($"Cannot convert '{node.Type}' to a {targetType.Name}") { } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/IJsonConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/IJsonConverter.cs new file mode 100644 index 000000000000..ee8987e396b9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/IJsonConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal interface IJsonConverter + { + JsonNode ToJson(object value); + + object FromJson(JsonNode node); + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/BinaryConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/BinaryConverter.cs new file mode 100644 index 000000000000..6f945e950dea --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/BinaryConverter.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class BinaryConverter : JsonConverter + { + internal override JsonNode ToJson(byte[] value) => new XBinary(value); + + internal override byte[] FromJson(JsonNode node) + { + switch (node.Type) + { + case JsonType.String : return Convert.FromBase64String(node.ToString()); // Base64 Encoded + case JsonType.Binary : return ((XBinary)node).Value; + } + + throw new ConversionException(node, typeof(byte[])); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/BooleanConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/BooleanConverter.cs new file mode 100644 index 000000000000..d1c48467d1a5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/BooleanConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class BooleanConverter : JsonConverter + { + internal override JsonNode ToJson(bool value) => new JsonBoolean(value); + + internal override bool FromJson(JsonNode node) => (bool)node; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/DateTimeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/DateTimeConverter.cs new file mode 100644 index 000000000000..ac8b283b04ff --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/DateTimeConverter.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class DateTimeConverter : JsonConverter + { + internal override JsonNode ToJson(DateTime value) + { + return new JsonDate(value); + } + + internal override DateTime FromJson(JsonNode node) => (DateTime)node; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs new file mode 100644 index 000000000000..a7da14c6a265 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class DateTimeOffsetConverter : JsonConverter + { + internal override JsonNode ToJson(DateTimeOffset value) => new JsonDate(value); + + internal override DateTimeOffset FromJson(JsonNode node) => (DateTimeOffset)node; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/DecimalConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/DecimalConverter.cs new file mode 100644 index 000000000000..38e9dd296a2e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/DecimalConverter.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class DecimalConverter : JsonConverter + { + internal override JsonNode ToJson(decimal value) => new JsonNumber(value.ToString()); + + internal override decimal FromJson(JsonNode node) + { + return (decimal)node; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/DoubleConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/DoubleConverter.cs new file mode 100644 index 000000000000..42f83a1bb15b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/DoubleConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class DoubleConverter : JsonConverter + { + internal override JsonNode ToJson(double value) => new JsonNumber(value); + + internal override double FromJson(JsonNode node) => (double)node; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/EnumConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/EnumConverter.cs new file mode 100644 index 000000000000..fde9e0e6afaa --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/EnumConverter.cs @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class EnumConverter : IJsonConverter + { + private readonly Type type; + + internal EnumConverter(Type type) + { + this.type = type ?? throw new ArgumentNullException(nameof(type)); + } + + public JsonNode ToJson(object value) => new JsonString(value.ToString()); + + public object FromJson(JsonNode node) + { + if (node.Type == JsonType.Number) + { + return Enum.ToObject(type, (int)node); + } + + return Enum.Parse(type, node.ToString(), ignoreCase: true); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/GuidConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/GuidConverter.cs new file mode 100644 index 000000000000..3632ba7b27ec --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/GuidConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class GuidConverter : JsonConverter + { + internal override JsonNode ToJson(Guid value) => new JsonString(value.ToString()); + + internal override Guid FromJson(JsonNode node) => (Guid)node; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/HashSet'1Converter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/HashSet'1Converter.cs new file mode 100644 index 000000000000..9c6158260cbc --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/HashSet'1Converter.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class HashSetConverter : JsonConverter> + { + internal override JsonNode ToJson(HashSet value) + { + return new XSet(value); + } + + internal override HashSet FromJson(JsonNode node) + { + var collection = node as ICollection; + + if (collection.Count == 0) return null; + + // TODO: Remove Linq depedency + return new HashSet(collection.Cast()); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/Int16Converter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/Int16Converter.cs new file mode 100644 index 000000000000..e852618d28fc --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/Int16Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class Int16Converter : JsonConverter + { + internal override JsonNode ToJson(short value) => new JsonNumber(value); + + internal override short FromJson(JsonNode node) => (short)node; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/Int32Converter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/Int32Converter.cs new file mode 100644 index 000000000000..c22ef63aae64 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/Int32Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class Int32Converter : JsonConverter + { + internal override JsonNode ToJson(int value) => new JsonNumber(value); + + internal override int FromJson(JsonNode node) => (int)node; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/Int64Converter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/Int64Converter.cs new file mode 100644 index 000000000000..a974af956723 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/Int64Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class Int64Converter : JsonConverter + { + internal override JsonNode ToJson(long value) => new JsonNumber(value); + + internal override long FromJson(JsonNode node) => (long)node; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/JsonArrayConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/JsonArrayConverter.cs new file mode 100644 index 000000000000..c0a09d519c66 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/JsonArrayConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class JsonArrayConverter : JsonConverter + { + internal override JsonNode ToJson(JsonArray value) => value; + + internal override JsonArray FromJson(JsonNode node) => (JsonArray)node; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/JsonObjectConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/JsonObjectConverter.cs new file mode 100644 index 000000000000..928d574d2660 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/JsonObjectConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class JsonObjectConverter : JsonConverter + { + internal override JsonNode ToJson(JsonObject value) => value; + + internal override JsonObject FromJson(JsonNode node) => (JsonObject)node; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/SingleConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/SingleConverter.cs new file mode 100644 index 000000000000..18f91a74595e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/SingleConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class SingleConverter : JsonConverter + { + internal override JsonNode ToJson(float value) => new JsonNumber(value.ToString()); + + internal override float FromJson(JsonNode node) => (float)node; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/StringConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/StringConverter.cs new file mode 100644 index 000000000000..98dad3254fac --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/StringConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class StringConverter : JsonConverter + { + internal override JsonNode ToJson(string value) => new JsonString(value); + + internal override string FromJson(JsonNode node) => node.ToString(); + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/TimeSpanConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/TimeSpanConverter.cs new file mode 100644 index 000000000000..97647b57874c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/TimeSpanConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class TimeSpanConverter : JsonConverter + { + internal override JsonNode ToJson(TimeSpan value) => new JsonString(value.ToString()); + + internal override TimeSpan FromJson(JsonNode node) => (TimeSpan)node; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/UInt16Converter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/UInt16Converter.cs new file mode 100644 index 000000000000..39f225bd87ea --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/UInt16Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class UInt16Converter : JsonConverter + { + internal override JsonNode ToJson(ushort value) => new JsonNumber(value); + + internal override ushort FromJson(JsonNode node) => (ushort)node; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/UInt32Converter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/UInt32Converter.cs new file mode 100644 index 000000000000..138ffb30d06c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/UInt32Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class UInt32Converter : JsonConverter + { + internal override JsonNode ToJson(uint value) => new JsonNumber(value); + + internal override uint FromJson(JsonNode node) => (uint)node; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/UInt64Converter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/UInt64Converter.cs new file mode 100644 index 000000000000..27536db7ab86 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/UInt64Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class UInt64Converter : JsonConverter + { + internal override JsonNode ToJson(ulong value) => new JsonNumber(value.ToString()); + + internal override ulong FromJson(JsonNode node) => (ulong)node; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/UriConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/UriConverter.cs new file mode 100644 index 000000000000..11383e3839a7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/Instances/UriConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class UriConverter : JsonConverter + { + internal override JsonNode ToJson(Uri value) => new JsonString(value.AbsoluteUri); + + internal override Uri FromJson(JsonNode node) => (Uri)node; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/JsonConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/JsonConverter.cs new file mode 100644 index 000000000000..4d688c40a7d8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/JsonConverter.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public abstract class JsonConverter : IJsonConverter + { + internal abstract T FromJson(JsonNode node); + + internal abstract JsonNode ToJson(T value); + + #region IConverter + + object IJsonConverter.FromJson(JsonNode node) => FromJson(node); + + JsonNode IJsonConverter.ToJson(object value) => ToJson((T)value); + + #endregion + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/JsonConverterAttribute.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/JsonConverterAttribute.cs new file mode 100644 index 000000000000..80538e48d0ed --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/JsonConverterAttribute.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class JsonConverterAttribute : Attribute + { + internal JsonConverterAttribute(Type type) + { + Converter = (IJsonConverter)Activator.CreateInstance(type); + } + + internal IJsonConverter Converter { get; } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/JsonConverterFactory.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/JsonConverterFactory.cs new file mode 100644 index 000000000000..2aa57634d27e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/JsonConverterFactory.cs @@ -0,0 +1,91 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class JsonConverterFactory + { + private static readonly Dictionary converters = new Dictionary(); + + static JsonConverterFactory() + { + AddInternal(new BooleanConverter()); + AddInternal(new DateTimeConverter()); + AddInternal(new DateTimeOffsetConverter()); + AddInternal(new BinaryConverter()); + AddInternal(new DecimalConverter()); + AddInternal(new DoubleConverter()); + AddInternal(new GuidConverter()); + AddInternal(new Int16Converter()); + AddInternal(new Int32Converter()); + AddInternal(new Int64Converter()); + AddInternal(new SingleConverter()); + AddInternal(new StringConverter()); + AddInternal(new TimeSpanConverter()); + AddInternal(new UInt16Converter()); + AddInternal(new UInt32Converter()); + AddInternal(new UInt64Converter()); + AddInternal(new UriConverter()); + + // Hash sets + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + + // JSON + + AddInternal(new JsonObjectConverter()); + AddInternal(new JsonArrayConverter()); + } + + internal static Dictionary Instances => converters; + + internal static IJsonConverter Get(Type type) + { + var details = TypeDetails.Get(type); + + if (details.JsonConverter == null) + { + throw new ConversionException($"No converter found for '{type.Name}'."); + } + + return details.JsonConverter; + } + + internal static bool TryGet(Type type, out IJsonConverter converter) + { + var typeDetails = TypeDetails.Get(type); + + converter = typeDetails.JsonConverter; + + return converter != null; + } + + private static void AddInternal(JsonConverter converter) + => converters.Add(typeof(T), converter); + + private static void AddInternal(IJsonConverter converter) + => converters.Add(typeof(T), converter); + + internal static void Add(JsonConverter converter) + { + if (converter == null) + { + throw new ArgumentNullException(nameof(converter)); + } + + AddInternal(converter); + + var type = TypeDetails.Get(); + + type.JsonConverter = converter; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/StringLikeConverter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/StringLikeConverter.cs new file mode 100644 index 000000000000..d61860ece6b1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Conversions/StringLikeConverter.cs @@ -0,0 +1,45 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class StringLikeConverter : IJsonConverter + { + private readonly Type type; + private readonly MethodInfo parseMethod; + + internal StringLikeConverter(Type type) + { + this.type = type ?? throw new ArgumentNullException(nameof(type)); + this.parseMethod = StringLikeHelper.GetParseMethod(type); + } + + public object FromJson(JsonNode node) => + parseMethod.Invoke(null, new[] { node.ToString() }); + + public JsonNode ToJson(object value) => new JsonString(value.ToString()); + } + + internal static class StringLikeHelper + { + private static readonly Type[] parseMethodParamaterTypes = new[] { typeof(string) }; + + internal static bool IsStringLike(Type type) + { + return GetParseMethod(type) != null; + } + + internal static MethodInfo GetParseMethod(Type type) + { + MethodInfo method = type.GetMethod("Parse", parseMethodParamaterTypes); + + if (method?.IsPublic != true) return null; + + return method; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/IJsonSerializable.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/IJsonSerializable.cs new file mode 100644 index 000000000000..9256f4f67a70 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/IJsonSerializable.cs @@ -0,0 +1,263 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json; +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + public interface IJsonSerializable + { + JsonNode ToJson(JsonObject container = null, SerializationMode serializationMode = SerializationMode.None); + } + internal static class JsonSerializable + { + /// + /// Serializes an enumerable and returns a JsonNode. + /// + /// an IEnumerable collection of items + /// A JsonNode that contains the collection of items serialized. + private static JsonNode ToJsonValue(System.Collections.IEnumerable enumerable) + { + if (enumerable != null) + { + // is it a byte array of some kind? + if (enumerable is System.Collections.Generic.IEnumerable byteEnumerable) + { + return new XBinary(System.Linq.Enumerable.ToArray(byteEnumerable)); + } + + var hasValues = false; + // just create an array of value nodes. + var result = new XNodeArray(); + foreach (var each in enumerable) + { + // we had at least one value. + hasValues = true; + + // try to serialize it. + var node = ToJsonValue(each); + if (null != node) + { + result.Add(node); + } + } + + // if we were able to add values, (or it was just empty), return it. + if (result.Count > 0 || !hasValues) + { + return result; + } + } + + // we couldn't serialize the values. Sorry. + return null; + } + + /// + /// Serializes a valuetype to a JsonNode. + /// + /// a ValueType (ie, a primitive, enum or struct) to be serialized + /// a JsonNode with the serialized value + private static JsonNode ToJsonValue(ValueType vValue) + { + // numeric type + if (vValue is SByte || vValue is Int16 || vValue is Int32 || vValue is Int64 || vValue is Byte || vValue is UInt16 || vValue is UInt32 || vValue is UInt64 || vValue is decimal || vValue is float || vValue is double) + { + return new JsonNumber(vValue.ToString()); + } + + // boolean type + if (vValue is bool bValue) + { + return new JsonBoolean(bValue); + } + + // dates + if (vValue is DateTime dtValue) + { + return new JsonDate(dtValue); + } + + // DictionaryEntity struct type + if (vValue is System.Collections.DictionaryEntry deValue) + { + return new JsonObject { { deValue.Key.ToString(), ToJsonValue(deValue.Value) } }; + } + + // sorry, no idea. + return null; + } + /// + /// Attempts to serialize an object by using ToJson() or ToJsonString() if they exist. + /// + /// the object to be serialized. + /// the serialized JsonNode (if successful), otherwise, null + private static JsonNode TryToJsonValue(dynamic oValue) + { + object jsonValue = null; + dynamic v = oValue; + try + { + jsonValue = v.ToJson().ToString(); + } + catch + { + // no harm... + try + { + jsonValue = v.ToJsonString().ToString(); + } + catch + { + // no worries here either. + } + } + + // if we got something out, let's use it. + if (null != jsonValue) + { + // JsonNumber is really a literal json value. Just don't try to cast that back to an actual number, ok? + return new JsonNumber(jsonValue.ToString()); + } + + return null; + } + + /// + /// Serialize an object by using a variety of methods. + /// + /// the object to be serialized. + /// the serialized JsonNode (if successful), otherwise, null + internal static JsonNode ToJsonValue(object value) + { + // things that implement our interface are preferred. + if (value is Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IJsonSerializable jsonSerializable) + { + return jsonSerializable.ToJson(); + } + + // strings are easy. + if (value is string || value is char) + { + return new JsonString(value.ToString()); + } + + // value types are fairly straightforward (fallback to ToJson()/ToJsonString() or literal JsonString ) + if (value is System.ValueType vValue) + { + return ToJsonValue(vValue) ?? TryToJsonValue(vValue) ?? new JsonString(vValue.ToString()); + } + + // dictionaries are objects that should be able to serialize + if (value is System.Collections.Generic.IDictionary dictionary) + { + return Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.ToJson(dictionary, null); + } + + // hashtables are converted to dictionaries for serialization + if (value is System.Collections.Hashtable hashtable) + { + var dict = new System.Collections.Generic.Dictionary(); + DictionaryExtensions.HashTableToDictionary(hashtable, dict); + return Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.ToJson(dict, null); + } + + // enumerable collections are handled like arrays (again, fallback to ToJson()/ToJsonString() or literal JsonString) + if (value is System.Collections.IEnumerable enumerableValue) + { + // some kind of enumerable value + return ToJsonValue(enumerableValue) ?? TryToJsonValue(value) ?? new JsonString(value.ToString()); + } + + // at this point, we're going to fallback to a string literal here, since we really have no idea what it is. + return new JsonString(value.ToString()); + } + + internal static JsonObject ToJson(System.Collections.Generic.Dictionary dictionary, JsonObject container) => ToJson((System.Collections.Generic.IDictionary)dictionary, container); + + /// + /// Serializes a dictionary into a JsonObject container. + /// + /// The dictionary to serailize + /// the container to serialize the dictionary into + /// the container + internal static JsonObject ToJson(System.Collections.Generic.IDictionary dictionary, JsonObject container) + { + container = container ?? new JsonObject(); + if (dictionary != null && dictionary.Count > 0) + { + foreach (var key in dictionary) + { + // currently, we don't serialize null values. + if (null != key.Value) + { + container.Add(key.Key, ToJsonValue(key.Value)); + continue; + } + } + } + return container; + } + + internal static Func> DeserializeDictionary(Func> dictionaryFactory) + { + return (node) => FromJson(node, dictionaryFactory(), (object)(DeserializeDictionary(dictionaryFactory)) as Func); + } + + internal static System.Collections.Generic.IDictionary FromJson(JsonObject json, System.Collections.Generic.Dictionary container, System.Func objectFactory, System.Collections.Generic.HashSet excludes = null) => FromJson(json, (System.Collections.Generic.IDictionary)container, objectFactory, excludes); + + + internal static System.Collections.Generic.IDictionary FromJson(JsonObject json, System.Collections.Generic.IDictionary container, System.Func objectFactory, System.Collections.Generic.HashSet excludes = null) + { + if (null == json) + { + return container; + } + + foreach (var key in json.Keys) + { + if (true == excludes?.Contains(key)) + { + continue; + } + + var value = json[key]; + try + { + switch (value.Type) + { + case JsonType.Null: + // skip null values. + continue; + + case JsonType.Array: + case JsonType.Boolean: + case JsonType.Date: + case JsonType.Binary: + case JsonType.Number: + case JsonType.String: + container.Add(key, (V)value.ToValue()); + break; + case JsonType.Object: + if (objectFactory != null) + { + var v = objectFactory(value as JsonObject); + if (null != v) + { + container.Add(key, v); + } + } + break; + } + } + catch + { + } + } + return container; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/JsonArray.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/JsonArray.cs new file mode 100644 index 000000000000..c969cef8291d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/JsonArray.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public partial class JsonArray + { + internal override object ToValue() => Count == 0 ? new object[0] : System.Linq.Enumerable.ToArray(System.Linq.Enumerable.Select(this, each => each.ToValue())); + } + + +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/JsonBoolean.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/JsonBoolean.cs new file mode 100644 index 000000000000..b76e125367ac --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/JsonBoolean.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal partial class JsonBoolean + { + internal static JsonBoolean Create(bool? value) => value is bool b ? new JsonBoolean(b) : null; + internal bool ToBoolean() => Value; + + internal override object ToValue() => Value; + } + + +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/JsonNode.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/JsonNode.cs new file mode 100644 index 000000000000..8bd7e76dc971 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/JsonNode.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + using System; + using System.Collections.Generic; + + public partial class JsonNode + { + /// + /// Returns the content of this node as the underlying value. + /// Will default to the string representation if not overridden in child classes. + /// + /// an object with the underlying value of the node. + internal virtual object ToValue() { + return this.ToString(); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/JsonNumber.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/JsonNumber.cs new file mode 100644 index 000000000000..fbd922d71fe7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/JsonNumber.cs @@ -0,0 +1,78 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + using System; + + public partial class JsonNumber + { + internal static readonly DateTime EpochDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + private static long ToUnixTime(DateTime dateTime) + { + return (long)dateTime.Subtract(EpochDate).TotalSeconds; + } + private static DateTime FromUnixTime(long totalSeconds) + { + return EpochDate.AddSeconds(totalSeconds); + } + internal byte ToByte() => this; + internal int ToInt() => this; + internal long ToLong() => this; + internal short ToShort() => this; + internal UInt16 ToUInt16() => this; + internal UInt32 ToUInt32() => this; + internal UInt64 ToUInt64() => this; + internal decimal ToDecimal() => this; + internal double ToDouble() => this; + internal float ToFloat() => this; + + internal static JsonNumber Create(int? value) => value is int n ? new JsonNumber(n) : null; + internal static JsonNumber Create(long? value) => value is long n ? new JsonNumber(n) : null; + internal static JsonNumber Create(float? value) => value is float n ? new JsonNumber(n) : null; + internal static JsonNumber Create(double? value) => value is double n ? new JsonNumber(n) : null; + internal static JsonNumber Create(decimal? value) => value is decimal n ? new JsonNumber(n) : null; + internal static JsonNumber Create(DateTime? value) => value is DateTime date ? new JsonNumber(ToUnixTime(date)) : null; + + public static implicit operator DateTime(JsonNumber number) => FromUnixTime(number); + internal DateTime ToDateTime() => this; + + internal JsonNumber(decimal value) + { + this.value = value.ToString(); + } + internal override object ToValue() + { + if (IsInteger) + { + if (int.TryParse(this.value, out int iValue)) + { + return iValue; + } + if (long.TryParse(this.value, out long lValue)) + { + return lValue; + } + } + else + { + if (float.TryParse(this.value, out float fValue)) + { + return fValue; + } + if (double.TryParse(this.value, out double dValue)) + { + return dValue; + } + if (decimal.TryParse(this.value, out decimal dcValue)) + { + return dcValue; + } + } + return null; + } + } + + +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/JsonObject.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/JsonObject.cs new file mode 100644 index 000000000000..c99c4c6a69cd --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/JsonObject.cs @@ -0,0 +1,183 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + using System; + using System.Collections.Generic; + + public partial class JsonObject + { + internal override object ToValue() => Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.JsonSerializable.FromJson(this, new System.Collections.Generic.Dictionary(), (obj) => obj.ToValue()); + + internal void SafeAdd(string name, Func valueFn) + { + if (valueFn != null) + { + var value = valueFn(); + if (null != value) + { + items.Add(name, value); + } + } + } + + internal void SafeAdd(string name, JsonNode value) + { + if (null != value) + { + items.Add(name, value); + } + } + + internal T NullableProperty(string propertyName) where T : JsonNode + { + if (this.TryGetValue(propertyName, out JsonNode value)) + { + if (value.IsNull) + { + return null; + } + if (value is T tval) + { + return tval; + } + /* it's present, but not the correct type... */ + //throw new Exception($"Property {propertyName} in object expected type {typeof(T).Name} but value of type {value.Type.ToString()} was found."); + } + return null; + } + + internal JsonObject Property(string propertyName) + { + return PropertyT(propertyName); + } + + internal T PropertyT(string propertyName) where T : JsonNode + { + if (this.TryGetValue(propertyName, out JsonNode value)) + { + if (value.IsNull) + { + return null; // we're going to assume that the consumer knows what to do if null is explicity returned? + } + + if (value is T tval) + { + return tval; + } + /* it's present, but not the correct type... */ + // throw new Exception($"Property {propertyName} in object expected type {typeof(T).Name} but value of type {value.Type.ToString()} was found."); + } + return null; + } + + internal int NumberProperty(string propertyName, ref int output) => output = this.PropertyT(propertyName)?.ToInt() ?? output; + internal float NumberProperty(string propertyName, ref float output) => output = this.PropertyT(propertyName)?.ToFloat() ?? output; + internal byte NumberProperty(string propertyName, ref byte output) => output = this.PropertyT(propertyName)?.ToByte() ?? output; + internal long NumberProperty(string propertyName, ref long output) => output = this.PropertyT(propertyName)?.ToLong() ?? output; + internal double NumberProperty(string propertyName, ref double output) => output = this.PropertyT(propertyName)?.ToDouble() ?? output; + internal decimal NumberProperty(string propertyName, ref decimal output) => output = this.PropertyT(propertyName)?.ToDecimal() ?? output; + internal short NumberProperty(string propertyName, ref short output) => output = this.PropertyT(propertyName)?.ToShort() ?? output; + internal DateTime NumberProperty(string propertyName, ref DateTime output) => output = this.PropertyT(propertyName)?.ToDateTime() ?? output; + + internal int? NumberProperty(string propertyName, ref int? output) => output = this.NullableProperty(propertyName)?.ToInt() ?? null; + internal float? NumberProperty(string propertyName, ref float? output) => output = this.NullableProperty(propertyName)?.ToFloat() ?? null; + internal byte? NumberProperty(string propertyName, ref byte? output) => output = this.NullableProperty(propertyName)?.ToByte() ?? null; + internal long? NumberProperty(string propertyName, ref long? output) => output = this.NullableProperty(propertyName)?.ToLong() ?? null; + internal double? NumberProperty(string propertyName, ref double? output) => output = this.NullableProperty(propertyName)?.ToDouble() ?? null; + internal decimal? NumberProperty(string propertyName, ref decimal? output) => output = this.NullableProperty(propertyName)?.ToDecimal() ?? null; + internal short? NumberProperty(string propertyName, ref short? output) => output = this.NullableProperty(propertyName)?.ToShort() ?? null; + + internal DateTime? NumberProperty(string propertyName, ref DateTime? output) => output = this.NullableProperty(propertyName)?.ToDateTime() ?? null; + + + internal string StringProperty(string propertyName) => this.PropertyT(propertyName)?.ToString(); + internal string StringProperty(string propertyName, ref string output) => output = this.PropertyT(propertyName)?.ToString() ?? output; + internal char StringProperty(string propertyName, ref char output) => output = this.PropertyT(propertyName)?.ToChar() ?? output; + internal char? StringProperty(string propertyName, ref char? output) => output = this.PropertyT(propertyName)?.ToChar() ?? null; + + internal DateTime StringProperty(string propertyName, ref DateTime output) => DateTime.TryParse(this.PropertyT(propertyName)?.ToString(), out output) ? output : output; + internal DateTime? StringProperty(string propertyName, ref DateTime? output) => output = DateTime.TryParse(this.PropertyT(propertyName)?.ToString(), out var o) ? o : output; + + + internal bool BooleanProperty(string propertyName, ref bool output) => output = this.PropertyT(propertyName)?.ToBoolean() ?? output; + internal bool? BooleanProperty(string propertyName, ref bool? output) => output = this.PropertyT(propertyName)?.ToBoolean() ?? null; + + internal T[] ArrayProperty(string propertyName, ref T[] output, Func deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + output = new T[array.Count]; + for (var i = 0; i < output.Length; i++) + { + output[i] = deserializer(array[i]); + } + } + return output; + } + internal T[] ArrayProperty(string propertyName, Func deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + var output = new T[array.Count]; + for (var i = 0; i < output.Length; i++) + { + output[i] = deserializer(array[i]); + } + return output; + } + return new T[0]; + } + internal void IterateArrayProperty(string propertyName, Action deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + for (var i = 0; i < array.Count; i++) + { + deserializer(array[i]); + } + } + } + + internal Dictionary DictionaryProperty(string propertyName, ref Dictionary output, Func deserializer) + { + var dictionary = this.PropertyT(propertyName); + if (output == null) + { + output = new Dictionary(); + } + else + { + output.Clear(); + } + if (dictionary != null) + { + foreach (var key in dictionary.Keys) + { + output[key] = deserializer(dictionary[key]); + } + } + return output; + } + + internal static JsonObject Create(IDictionary source, Func selector) + { + if (source == null || selector == null) + { + return null; + } + var result = new JsonObject(); + + foreach (var key in source.Keys) + { + result.SafeAdd(key, selector(source[key])); + } + return result; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/JsonString.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/JsonString.cs new file mode 100644 index 000000000000..ad81fcd4c609 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/JsonString.cs @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + using System; + using System.Globalization; + using System.Linq; + + public partial class JsonString + { + internal static string DateFormat = "yyyy-MM-dd"; + internal static string DateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK"; + internal static string DateTimeRfc1123Format = "R"; + + internal static JsonString Create(string value) => value == null ? null : new JsonString(value); + internal static JsonString Create(char? value) => value is char c ? new JsonString(c.ToString()) : null; + + internal static JsonString CreateDate(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateFormat, CultureInfo.CurrentCulture)) : null; + internal static JsonString CreateDateTime(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateTimeFormat, CultureInfo.CurrentCulture)) : null; + internal static JsonString CreateDateTimeRfc1123(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateTimeRfc1123Format, CultureInfo.CurrentCulture)) : null; + + internal char ToChar() => this.Value?.ToString()?.FirstOrDefault() ?? default(char); + public static implicit operator char(JsonString value) => value?.ToString()?.FirstOrDefault() ?? default(char); + public static implicit operator char? (JsonString value) => value?.ToString()?.FirstOrDefault(); + + public static implicit operator DateTime(JsonString value) => DateTime.TryParse(value, out var output) ? output : default(DateTime); + public static implicit operator DateTime? (JsonString value) => DateTime.TryParse(value, out var output) ? output : default(DateTime?); + + } + + +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/XNodeArray.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/XNodeArray.cs new file mode 100644 index 000000000000..1f14980020c1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Customizations/XNodeArray.cs @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + using System; + using System.Linq; + + public partial class XNodeArray + { + internal static XNodeArray Create(T[] source, Func selector) + { + if (source == null || selector == null) + { + return null; + } + var result = new XNodeArray(); + foreach (var item in source.Select(selector)) + { + result.SafeAdd(item); + } + return result; + } + internal void SafeAdd(JsonNode item) + { + if (item != null) + { + items.Add(item); + } + } + internal void SafeAdd(Func itemFn) + { + if (itemFn != null) + { + var item = itemFn(); + if (item != null) + { + items.Add(item); + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Debugging.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Debugging.cs new file mode 100644 index 000000000000..94ab790b9121 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Debugging.cs @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + internal static class AttachDebugger + { + internal static void Break() + { + while (!System.Diagnostics.Debugger.IsAttached) + { + System.Console.Error.WriteLine($"Waiting for debugger to attach to process {System.Diagnostics.Process.GetCurrentProcess().Id}"); + for (int i = 0; i < 50; i++) + { + if (System.Diagnostics.Debugger.IsAttached) + { + break; + } + System.Threading.Thread.Sleep(100); + System.Console.Error.Write("."); + } + System.Console.Error.WriteLine(); + } + System.Diagnostics.Debugger.Break(); + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/DictionaryExtensions.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/DictionaryExtensions.cs new file mode 100644 index 000000000000..8b513613cc32 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/DictionaryExtensions.cs @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + internal static class DictionaryExtensions + { + internal static void HashTableToDictionary(System.Collections.Hashtable hashtable, System.Collections.Generic.IDictionary dictionary) + { + if (null == hashtable) + { + return; + } + foreach (var each in hashtable.Keys) + { + var key = each.ToString(); + var value = hashtable[key]; + if (null != value) + { + try + { + dictionary[key] = (V)value; + } + catch + { + // Values getting dropped; not compatible with target dictionary. Not sure what to do here. + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/EventData.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/EventData.cs new file mode 100644 index 000000000000..24acbcc89065 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/EventData.cs @@ -0,0 +1,78 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + + using System; + using System.Threading; + + ///Represents the data in signaled event. + public partial class EventData + { + /// + /// The type of the event being signaled + /// + public string Id; + + /// + /// The user-ready message from the event. + /// + public string Message; + + /// + /// When the event is about a parameter, this is the parameter name. + /// Used in Validation Events + /// + public string Parameter; + + /// + /// This represents a numeric value associated with the event. + /// Use for progress-style events + /// + public double Value; + + /// + /// Any extended data for an event should be serialized and stored here. + /// + public string ExtendedData; + + /// + /// If the event triggers after the request message has been created, this will contain the Request Message (which in HTTP calls would be HttpRequestMessage) + /// + /// Typically you'd cast this to the expected type to use it: + /// + /// if(eventData.RequestMessgae is HttpRequestMessage httpRequest) + /// { + /// httpRequest.Headers.Add("x-request-flavor", "vanilla"); + /// } + /// + /// + public object RequestMessage; + + /// + /// If the event triggers after the response is back, this will contain the Response Message (which in HTTP calls would be HttpResponseMessage) + /// + /// Typically you'd cast this to the expected type to use it: + /// + /// if(eventData.ResponseMessage is HttpResponseMessage httpResponse){ + /// var flavor = httpResponse.Headers.GetValue("x-request-flavor"); + /// } + /// + /// + public object ResponseMessage; + + /// + /// Cancellation method for this event. + /// + /// If the event consumer wishes to cancel the request that initiated this event, call Cancel() + /// + /// + /// The original initiator of the request must provide the implementation of this. + /// + public System.Action Cancel; + } + +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/EventDataExtensions.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/EventDataExtensions.cs new file mode 100644 index 000000000000..b8a1c002e563 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/EventDataExtensions.cs @@ -0,0 +1,94 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + using System; + + /// + /// PowerShell-specific data on top of the llc# EventData + /// + /// + /// In PowerShell, we add on the EventDataConverter to support sending events between modules. + /// Obviously, this code would need to be duplcated on both modules. + /// This is preferable to sharing a common library, as versioning makes that problematic. + /// + [System.ComponentModel.TypeConverter(typeof(EventDataConverter))] + public partial class EventData : EventArgs + { + } + + /// + /// A PowerShell PSTypeConverter to adapt an EventData object that has been passed. + /// Usually used between modules. + /// + public class EventDataConverter : System.Management.Automation.PSTypeConverter + { + public override bool CanConvertTo(object sourceValue, Type destinationType) => false; + public override object ConvertTo(object sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase) => null; + public override bool CanConvertFrom(dynamic sourceValue, Type destinationType) => destinationType == typeof(EventData) && CanConvertFrom(sourceValue); + public override object ConvertFrom(dynamic sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Verifies that a given object has the required members to convert it to the target type (EventData) + /// + /// Uses a dynamic type so that it is able to use the simplest code without excessive checking. + /// + /// The instance to verify + /// True, if the object has all the required parameters. + public static bool CanConvertFrom(dynamic sourceValue) + { + try + { + // check if this has *required* parameters... + sourceValue?.Id?.GetType(); + sourceValue?.Message?.GetType(); + sourceValue?.Cancel?.GetType(); + + // remaining parameters are not *required*, + // and if they have values, it will copy them at conversion time. + } + catch + { + // if anything throws an exception (because it's null, or doesn't have that member) + return false; + } + return true; + } + + /// + /// Returns result of the delegate as the expected type, or default(T) + /// + /// This isolates any exceptions from the consumer. + /// + /// A delegate that returns a value + /// The desired output type + /// The value from the function if the type is correct + private static T To(Func srcValue) + { + try { return srcValue(); } + catch { return default(T); } + } + + /// + /// Converts an incoming object to the expected type by treating the incoming object as a dynamic, and coping the expected values. + /// + /// the incoming object + /// EventData + public static EventData ConvertFrom(dynamic sourceValue) + { + return new EventData + { + Id = To(() => sourceValue.Id), + Message = To(() => sourceValue.Message), + Parameter = To(() => sourceValue.Parameter), + Value = To(() => sourceValue.Value), + RequestMessage = To(() => sourceValue.RequestMessage), + ResponseMessage = To(() => sourceValue.ResponseMessage), + Cancel = To(() => sourceValue.Cancel) + }; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/EventListener.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/EventListener.cs new file mode 100644 index 000000000000..e3357bf7f3fd --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/EventListener.cs @@ -0,0 +1,247 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + + using System; + using System.Linq; + using System.Collections; + using System.Collections.Generic; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using GetEventData = System.Func; + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public interface IValidates + { + Task Validate(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IEventListener listener); + } + + /// + /// The IEventListener Interface defines the communication mechanism for Signaling events during a remote call. + /// + /// + /// The interface is designed to be as minimal as possible, allow for quick peeking of the event type (id) + /// and the cancellation status and provides a delegate for retrieving the event details themselves. + /// + public interface IEventListener + { + Task Signal(string id, CancellationToken token, GetEventData createMessage); + CancellationToken Token { get; } + System.Action Cancel { get; } + } + + internal static partial class Extensions + { + public static Task Signal(this IEventListener instance, string id, CancellationToken token, Func createMessage) => instance.Signal(id, token, createMessage); + public static Task Signal(this IEventListener instance, string id, CancellationToken token) => instance.Signal(id, token, () => new EventData { Id = id, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpRequestMessage request, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = request, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, EventData message) => instance.Signal(id, token, () => { message.Id = id; message.Cancel = instance.Cancel; return message; }); + + public static Task Signal(this IEventListener instance, string id, Func createMessage) => instance.Signal(id, instance.Token, createMessage); + public static Task Signal(this IEventListener instance, string id) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpRequestMessage request, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = request, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, EventData message) => instance.Signal(id, instance.Token, () => { message.Id = id; message.Cancel = instance.Cancel; return message; }); + + public static Task Signal(this IEventListener instance, string id, System.Uri uri) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = uri.ToString(), Cancel = instance.Cancel }); + + public static async Task AssertNotNull(this IEventListener instance, string parameterName, object value) + { + if (value == null) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' should not be null", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertMinimumLength(this IEventListener instance, string parameterName, string value, int length) + { + if (value != null && value.Length < length) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, Message = $"Length of '{parameterName}' is less than {length}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertMaximumLength(this IEventListener instance, string parameterName, string value, int length) + { + if (value != null && value.Length > length) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, Message = $"Length of '{parameterName}' is greater than {length}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + + public static async Task AssertRegEx(this IEventListener instance, string parameterName, string value, string regularExpression) + { + if (value != null && !System.Text.RegularExpressions.Regex.Match(value, regularExpression).Success) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' does not validate against pattern /{regularExpression}/", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertEnum(this IEventListener instance, string parameterName, string value, params string[] values) + { + if (!values.Any(each => each.Equals(value))) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' is not one of ({values.Aggregate((c, e) => $"'{e}',{c}")}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertObjectIsValid(this IEventListener instance, string parameterName, object inst) + { + await (inst as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.IValidates)?.Validate(instance); + } + + public static async Task AssertIsLessThan(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) >= 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be less than {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsGreaterThan(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) <= 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be greater than {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsLessThanOrEqual(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) > 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be less than or equal to {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsGreaterThanOrEqual(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) < 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be greater than or equal to {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, Int64? value, Int64 multiple) + { + if (null != value && value % multiple != 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, double? value, double multiple) + { + if (null != value) + { + var i = (Int64)(value / multiple); + if (i != value / multiple) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, decimal? value, decimal multiple) + { + if (null != value) + { + var i = (Int64)(value / multiple); + if (i != value / multiple) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + } + } + + /// + /// An Implementation of the IEventListener that supports subscribing to events and dispatching them + /// (used for manually using the lowlevel interface) + /// + public class EventListener : CancellationTokenSource, IEnumerable>, IEventListener + { + private Dictionary calls = new Dictionary(); + public IEnumerator> GetEnumerator() => calls.GetEnumerator(); + IEnumerator IEnumerable.GetEnumerator() => calls.GetEnumerator(); + public EventListener() + { + } + + public new Action Cancel => base.Cancel; + private Event tracer; + + public EventListener(params (string name, Event callback)[] initializer) + { + foreach (var each in initializer) + { + Add(each.name, each.callback); + } + } + + public void Add(string name, SynchEvent callback) + { + Add(name, (message) => { callback(message); return Task.CompletedTask; }); + } + + public void Add(string name, Event callback) + { + if (callback != null) + { + if (string.IsNullOrEmpty(name)) + { + if (calls.ContainsKey(name)) + { + tracer += callback; + } + else + { + tracer = callback; + } + } + else + { + if (calls.ContainsKey(name)) + { + calls[name ?? System.String.Empty] += callback; + } + else + { + calls[name ?? System.String.Empty] = callback; + } + } + } + } + + + public async Task Signal(string id, CancellationToken token, GetEventData createMessage) + { + using (NoSynchronizationContext) + { + if (!string.IsNullOrEmpty(id) && (calls.TryGetValue(id, out Event listener) || tracer != null)) + { + var message = createMessage(); + message.Id = id; + + await listener?.Invoke(message); + await tracer?.Invoke(message); + + if (token.IsCancellationRequested) + { + throw new OperationCanceledException($"Canceled by event {id} ", this.Token); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Events.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Events.cs new file mode 100644 index 000000000000..10b457f565a4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Events.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + public static partial class Events + { + public const string Log = nameof(Log); + public const string Validation = nameof(Validation); + public const string ValidationWarning = nameof(ValidationWarning); + public const string AfterValidation = nameof(AfterValidation); + public const string RequestCreated = nameof(RequestCreated); + public const string ResponseCreated = nameof(ResponseCreated); + public const string URLCreated = nameof(URLCreated); + public const string Finally = nameof(Finally); + public const string HeaderParametersAdded = nameof(HeaderParametersAdded); + public const string BodyContentSet = nameof(BodyContentSet); + public const string BeforeCall = nameof(BeforeCall); + public const string BeforeResponseDispatch = nameof(BeforeResponseDispatch); + public const string FollowingNextLink = nameof(FollowingNextLink); + public const string DelayBeforePolling = nameof(DelayBeforePolling); + public const string Polling = nameof(Polling); + + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/EventsExtensions.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/EventsExtensions.cs new file mode 100644 index 000000000000..d4cb9e173672 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/EventsExtensions.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + public static partial class Events + { + public const string CmdletProcessRecordStart = nameof(CmdletProcessRecordStart); + public const string CmdletProcessRecordAsyncStart = nameof(CmdletProcessRecordAsyncStart); + public const string CmdletException = nameof(CmdletException); + public const string CmdletGetPipeline = nameof(CmdletGetPipeline); + public const string CmdletBeforeAPICall = nameof(CmdletBeforeAPICall); + public const string CmdletBeginProcessing = nameof(CmdletBeginProcessing); + public const string CmdletEndProcessing = nameof(CmdletEndProcessing); + public const string CmdletProcessRecordEnd = nameof(CmdletProcessRecordEnd); + public const string CmdletProcessRecordAsyncEnd = nameof(CmdletProcessRecordAsyncEnd); + public const string CmdletAfterAPICall = nameof(CmdletAfterAPICall); + + public const string Verbose = nameof(Verbose); + public const string Debug = nameof(Debug); + public const string Information = nameof(Information); + public const string Error = nameof(Error); + public const string Warning = nameof(Warning); + } + +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Extensions.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Extensions.cs new file mode 100644 index 000000000000..e5277eda08ac --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Extensions.cs @@ -0,0 +1,117 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + using System.Linq; + using System; + + internal static partial class Extensions + { + public static T[] SubArray(this T[] array, int offset, int length) + { + return new ArraySegment(array, offset, length) + .ToArray(); + } + + public static T ReadHeaders(this T instance, global::System.Net.Http.Headers.HttpResponseHeaders headers) where T : class + { + (instance as IHeaderSerializable)?.ReadHeaders(headers); + return instance; + } + + internal static bool If(T input, out T output) + { + if (null == input) + { + output = default(T); + return false; + } + output = input; + return true; + } + + internal static void AddIf(T value, System.Action addMethod) + { + // if value is present (and it's not just an empty JSON Object) + if (null != value && (value as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject)?.Keys.Count != 0) + { + addMethod(value); + } + } + + internal static void AddIf(T value, string serializedName, System.Action addMethod) + { + // if value is present (and it's not just an empty JSON Object) + if (null != value && (value as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject)?.Keys.Count != 0) + { + addMethod(serializedName, value); + } + } + + /// + /// Returns the first header value as a string from an HttpReponseMessage. + /// + /// the HttpResponseMessage to fetch a header from + /// the header name + /// the first header value as a string from an HttpReponseMessage. string.empty if there is no header value matching + internal static string GetFirstHeader(this System.Net.Http.HttpResponseMessage response, string headerName) => response.Headers.FirstOrDefault(each => string.Equals(headerName, each.Key, System.StringComparison.OrdinalIgnoreCase)).Value?.FirstOrDefault() ?? string.Empty; + + /// + /// Sets the Synchronization Context to null, and returns an IDisposable that when disposed, + /// will restore the synchonization context to the original value. + /// + /// This is used a less-invasive means to ensure that code in the library that doesn't + /// need to be continued in the original context doesn't have to have ConfigureAwait(false) + /// on every single await + /// + /// If the SynchronizationContext is null when this is used, the resulting IDisposable + /// will not do anything (this prevents excessive re-setting of the SynchronizationContext) + /// + /// Usage: + /// + /// using(NoSynchronizationContext) { + /// await SomeAsyncOperation(); + /// await SomeOtherOperation(); + /// } + /// + /// + /// + /// An IDisposable that will return the SynchronizationContext to original state + internal static System.IDisposable NoSynchronizationContext => System.Threading.SynchronizationContext.Current == null ? Dummy : new NoSyncContext(); + + /// + /// An instance of the Dummy IDispoable. + /// + /// + internal static System.IDisposable Dummy = new DummyDisposable(); + + /// + /// An IDisposable that does absolutely nothing. + /// + internal class DummyDisposable : System.IDisposable + { + public void Dispose() + { + } + } + /// + /// An IDisposable that saves the SynchronizationContext,sets it to null and + /// restores it to the original upon Dispose(). + /// + /// NOTE: This is designed to be less invasive than using .ConfigureAwait(false) + /// on every single await in library code (ie, places where we know we don't need + /// to continue in the same context as we went async) + /// + internal class NoSyncContext : System.IDisposable + { + private System.Threading.SynchronizationContext original = System.Threading.SynchronizationContext.Current; + internal NoSyncContext() + { + System.Threading.SynchronizationContext.SetSynchronizationContext(null); + } + public void Dispose() => System.Threading.SynchronizationContext.SetSynchronizationContext(original); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs new file mode 100644 index 000000000000..2b2696ef5b11 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs @@ -0,0 +1,23 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal static class StringBuilderExtensions + { + /// + /// Extracts the buffered value and resets the buffer + /// + internal static string Extract(this StringBuilder builder) + { + var text = builder.ToString(); + + builder.Clear(); + + return text; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Helpers/Extensions/TypeExtensions.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Helpers/Extensions/TypeExtensions.cs new file mode 100644 index 000000000000..a282b33adc5d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Helpers/Extensions/TypeExtensions.cs @@ -0,0 +1,61 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal static class TypeExtensions + { + internal static bool IsNullable(this Type type) => + type.IsGenericType && type.GetGenericTypeDefinition().Equals(typeof(Nullable<>)); + + internal static Type GetOpenGenericInterface(this Type candidateType, Type openGenericInterfaceType) + { + + if (candidateType.IsGenericType && candidateType.GetGenericTypeDefinition() == openGenericInterfaceType) + { + return candidateType; + } + + // Check if it references it's own converter.... + + foreach (Type interfaceType in candidateType.GetInterfaces()) + { + if (interfaceType.IsGenericType + && interfaceType.GetGenericTypeDefinition().Equals(openGenericInterfaceType)) + { + return interfaceType; + } + } + + return null; + } + + // Author: Sebastian Good + // http://stackoverflow.com/questions/503263/how-to-determine-if-a-type-implements-a-specific-generic-interface-type + internal static bool ImplementsOpenGenericInterface(this Type candidateType, Type openGenericInterfaceType) + { + if (candidateType.Equals(openGenericInterfaceType)) + { + return true; + } + + if (candidateType.IsGenericType && candidateType.GetGenericTypeDefinition().Equals(openGenericInterfaceType)) + { + return true; + } + + foreach (Type i in candidateType.GetInterfaces()) + { + if (i.IsGenericType && i.ImplementsOpenGenericInterface(openGenericInterfaceType)) + { + return true; + } + } + + return false; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Helpers/Seperator.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Helpers/Seperator.cs new file mode 100644 index 000000000000..b370a53c9740 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Helpers/Seperator.cs @@ -0,0 +1,11 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal static class Seperator + { + internal static readonly char[] Dash = { '-' }; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Helpers/TypeDetails.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Helpers/TypeDetails.cs new file mode 100644 index 000000000000..6f08baedbd87 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Helpers/TypeDetails.cs @@ -0,0 +1,116 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + + + + internal class TypeDetails + { + private readonly Type info; + + internal TypeDetails(Type info) + { + this.info = info ?? throw new ArgumentNullException(nameof(info)); + } + + internal Type NonNullType { get; set; } + + internal object DefaultValue { get; set; } + + internal bool IsNullable { get; set; } + + internal bool IsList { get; set; } + + internal bool IsStringLike { get; set; } + + internal bool IsEnum => info.IsEnum; + + internal bool IsArray => info.IsArray; + + internal bool IsValueType => info.IsValueType; + + internal Type ElementType { get; set; } + + internal IJsonConverter JsonConverter { get; set; } + + #region Creation + + private static readonly ConcurrentDictionary cache = new ConcurrentDictionary(); + + internal static TypeDetails Get() => Get(typeof(T)); + + internal static TypeDetails Get(Type type) => cache.GetOrAdd(type, Create); + + private static TypeDetails Create(Type type) + { + var isGenericList = !type.IsPrimitive && type.ImplementsOpenGenericInterface(typeof(IList<>)); + var isList = !type.IsPrimitive && (isGenericList || typeof(IList).IsAssignableFrom(type)); + + var isNullable = type.IsNullable(); + + Type elementType; + + if (type.IsArray) + { + elementType = type.GetElementType(); + } + else if (isGenericList) + { + var iList = type.GetOpenGenericInterface(typeof(IList<>)); + + elementType = iList.GetGenericArguments()[0]; + } + else + { + elementType = null; + } + + var nonNullType = isNullable ? type.GetGenericArguments()[0] : type; + + var isStringLike = false; + + IJsonConverter converter; + + var jsonConverterAttribute = type.GetCustomAttribute(); + + if (jsonConverterAttribute != null) + { + converter = jsonConverterAttribute.Converter; + } + else if (nonNullType.IsEnum) + { + converter = new EnumConverter(nonNullType); + } + else if (JsonConverterFactory.Instances.TryGetValue(nonNullType, out converter)) + { + } + else if (StringLikeHelper.IsStringLike(nonNullType)) + { + isStringLike = true; + + converter = new StringLikeConverter(nonNullType); + } + + return new TypeDetails(nonNullType) { + NonNullType = nonNullType, + DefaultValue = type.IsValueType ? Activator.CreateInstance(type) : null, + IsNullable = isNullable, + IsList = isList, + IsStringLike = isStringLike, + ElementType = elementType, + JsonConverter = converter + }; + } + + #endregion + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Helpers/XHelper.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Helpers/XHelper.cs new file mode 100644 index 000000000000..c5620922fc6d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Helpers/XHelper.cs @@ -0,0 +1,75 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal static class XHelper + { + internal static JsonNode Create(JsonType type, TypeCode code, object value) + { + switch (type) + { + case JsonType.Binary : return new XBinary((byte[])value); + case JsonType.Boolean : return new JsonBoolean((bool)value); + case JsonType.Number : return new JsonNumber(value.ToString()); + case JsonType.String : return new JsonString((string)value); + } + + throw new Exception($"JsonType '{type}' does not have a fast conversion"); + } + + internal static bool TryGetElementType(TypeCode code, out JsonType type) + { + switch (code) + { + case TypeCode.Boolean : type = JsonType.Boolean; return true; + case TypeCode.Byte : type = JsonType.Number; return true; + case TypeCode.DateTime : type = JsonType.Date; return true; + case TypeCode.Decimal : type = JsonType.Number; return true; + case TypeCode.Double : type = JsonType.Number; return true; + case TypeCode.Empty : type = JsonType.Null; return true; + case TypeCode.Int16 : type = JsonType.Number; return true; + case TypeCode.Int32 : type = JsonType.Number; return true; + case TypeCode.Int64 : type = JsonType.Number; return true; + case TypeCode.SByte : type = JsonType.Number; return true; + case TypeCode.Single : type = JsonType.Number; return true; + case TypeCode.String : type = JsonType.String; return true; + case TypeCode.UInt16 : type = JsonType.Number; return true; + case TypeCode.UInt32 : type = JsonType.Number; return true; + case TypeCode.UInt64 : type = JsonType.Number; return true; + } + + type = default; + + return false; + } + + internal static JsonType GetElementType(TypeCode code) + { + switch (code) + { + case TypeCode.Boolean : return JsonType.Boolean; + case TypeCode.Byte : return JsonType.Number; + case TypeCode.DateTime : return JsonType.Date; + case TypeCode.Decimal : return JsonType.Number; + case TypeCode.Double : return JsonType.Number; + case TypeCode.Empty : return JsonType.Null; + case TypeCode.Int16 : return JsonType.Number; + case TypeCode.Int32 : return JsonType.Number; + case TypeCode.Int64 : return JsonType.Number; + case TypeCode.SByte : return JsonType.Number; + case TypeCode.Single : return JsonType.Number; + case TypeCode.String : return JsonType.String; + case TypeCode.UInt16 : return JsonType.Number; + case TypeCode.UInt32 : return JsonType.Number; + case TypeCode.UInt64 : return JsonType.Number; + default : return JsonType.Object; + } + + throw new Exception($"TypeCode '{code}' does not have a fast converter"); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/HttpPipeline.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/HttpPipeline.cs new file mode 100644 index 000000000000..d5759ec818be --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/HttpPipeline.cs @@ -0,0 +1,88 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + using System.Net.Http; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + using System.Collections; + using System.Linq; + + using GetEventData = System.Func; + using NextDelegate = System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>; + + using SignalDelegate = System.Func, System.Threading.Tasks.Task>; + using GetParameterDelegate = System.Func, string, object>; + using SendAsyncStepDelegate = System.Func, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>; + using PipelineChangeDelegate = System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>; + using ModuleLoadPipelineDelegate = System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>>; + using NewRequestPipelineDelegate = System.Action, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>>; + +/* + public class DelegateBasedEventListener : IEventListener + { + private EventListenerDelegate _listener; + public DelegateBasedEventListener(EventListenerDelegate listener) + { + _listener = listener; + } + public CancellationToken Token => CancellationToken.None; + public System.Action Cancel => () => { }; + + + public Task Signal(string id, CancellationToken token, GetEventData createMessage) + { + return _listener(id, token, () => createMessage()); + } + } +*/ + /// + /// This is a necessary extension to the SendAsyncFactory to support the 'generic' delegate format. + /// + public partial class SendAsyncFactory + { + /// + /// This translates a generic-defined delegate for a listener into one that fits our ISendAsync pattern. + /// (Provided to support out-of-module delegation for Azure Cmdlets) + /// + /// The Pipeline Step as a delegate + public SendAsyncFactory(SendAsyncStepDelegate step) => this.implementation = (request, listener, next) => + step( + request, + listener.Token, + listener.Cancel, + (id, token, getEventData) => listener.Signal(id, token, () => { + var data = EventDataConverter.ConvertFrom( getEventData() ) as EventData; + data.Id = id; + data.Cancel = listener.Cancel; + data.RequestMessage = request; + return data; + }), + (req, token, cancel, listenerDelegate) => next.SendAsync(req, listener)); + } + + public partial class HttpPipeline : ISendAsync + { + public HttpPipeline Append(SendAsyncStepDelegate item) + { + if (item != null) + { + Append(new SendAsyncFactory(item)); + } + return this; + } + + public HttpPipeline Prepend(SendAsyncStepDelegate item) + { + if (item != null) + { + Prepend(new SendAsyncFactory(item)); + } + return this; + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/HttpPipelineMocking.ps1 b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/HttpPipelineMocking.ps1 new file mode 100644 index 000000000000..8c09535215ec --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/HttpPipelineMocking.ps1 @@ -0,0 +1,110 @@ +$ErrorActionPreference = "Stop" + +# get the recording path +if (-not $TestRecordingFile) { + $TestRecordingFile = Join-Path $PSScriptRoot 'recording.json' +} + +# create the Http Pipeline Recorder +$Mock = New-Object -Type Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PipelineMock $TestRecordingFile + +# set the recorder to the appropriate mode (default to 'live') +Write-Host -ForegroundColor Green "Running '$TestMode' mode..." +switch ($TestMode) { + 'record' { + Write-Host -ForegroundColor Green "Recording to $TestRecordingFile" + $Mock.SetRecord() + $null = erase -ea 0 $TestRecordingFile + } + 'playback' { + if (-not (Test-Path $TestRecordingFile)) { + Write-Host -fore:yellow "Recording file '$TestRecordingFile' is not present. Tests expecting recorded responses will fail" + } else { + Write-Host -ForegroundColor Green "Using recording $TestRecordingFile" + } + $Mock.SetPlayback() + $Mock.ForceResponseHeaders["Retry-After"] = "0"; + } + default: { + $Mock.SetLive() + } +} + +# overrides for Pester Describe/Context/It + +function Describe( + [Parameter(Mandatory = $true, Position = 0)] + [string] $Name, + + [Alias('Tags')] + [string[]] $Tag = @(), + + [Parameter(Position = 1)] + [ValidateNotNull()] + [ScriptBlock] $Fixture = $(Throw "No test script block is provided. (Have you put the open curly brace on the next line?)") +) { + $Mock.PushDescription($Name) + try { + return pester\Describe -Name $Name -Tag $Tag -Fixture $fixture + } + finally { + $Mock.PopDescription() + } +} + +function Context( + [Parameter(Mandatory = $true, Position = 0)] + [string] $Name, + + [Alias('Tags')] + [string[]] $Tag = @(), + + [Parameter(Position = 1)] + [ValidateNotNull()] + [ScriptBlock] $Fixture = $(Throw "No test script block is provided. (Have you put the open curly brace on the next line?)") +) { + $Mock.PushContext($Name) + try { + return pester\Context -Name $Name -Tag $Tag -Fixture $fixture + } + finally { + $Mock.PopContext() + } +} + +function It { + [CmdletBinding(DefaultParameterSetName = 'Normal')] + param( + [Parameter(Mandatory = $true, Position = 0)] + [string]$Name, + + [Parameter(Position = 1)] + [ScriptBlock] $Test = { }, + + [System.Collections.IDictionary[]] $TestCases, + + [Parameter(ParameterSetName = 'Pending')] + [Switch] $Pending, + + [Parameter(ParameterSetName = 'Skip')] + [Alias('Ignore')] + [Switch] $Skip + ) + $Mock.PushScenario($Name) + + try { + if ($skip) { + return pester\It -Name $Name -Test $Test -TestCases $TestCases -Skip + } + if ($pending) { + return pester\It -Name $Name -Test $Test -TestCases $TestCases -Pending + } + return pester\It -Name $Name -Test $Test -TestCases $TestCases + } + finally { + $null = $Mock.PopScenario() + } +} + +# set the HttpPipelineAppend for all the cmdlets +$PSDefaultParameterValues["*:HttpPipelinePrepend"] = $Mock diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/IAssociativeArray.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/IAssociativeArray.cs new file mode 100644 index 000000000000..b5bd0c4a1d5f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/IAssociativeArray.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +#define DICT_PROPERTIES +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + /// A subset of IDictionary that doesn't implement IEnumerable or IDictionary to work around PowerShell's aggressive formatter + public interface IAssociativeArray + { +#if DICT_PROPERTIES + System.Collections.Generic.IEnumerable Keys { get; } + System.Collections.Generic.IEnumerable Values { get; } + int Count { get; } +#endif + System.Collections.Generic.IDictionary AdditionalProperties { get; } + T this[string index] { get; set; } + void Add(string key, T value); + bool ContainsKey(string key); + bool Remove(string key); + bool TryGetValue(string key, out T value); + void Clear(); + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/IHeaderSerializable.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/IHeaderSerializable.cs new file mode 100644 index 000000000000..c8eafe28664f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/IHeaderSerializable.cs @@ -0,0 +1,14 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + public interface IHeaderSerializable + { + void ReadHeaders(global::System.Net.Http.Headers.HttpResponseHeaders headers); + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/ISendAsync.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/ISendAsync.cs new file mode 100644 index 000000000000..a041e44cc442 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/ISendAsync.cs @@ -0,0 +1,300 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + using System.Net.Http; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + using System.Collections; + using System.Linq; + + /// + /// The interface for sending an HTTP request across the wire. + /// + public interface ISendAsync + { + Task SendAsync(HttpRequestMessage request, IEventListener callback); + } + + public class SendAsyncTerminalFactory : ISendAsyncTerminalFactory, ISendAsync + { + SendAsync implementation; + + public SendAsyncTerminalFactory(SendAsync implementation) => this.implementation = implementation; + public SendAsyncTerminalFactory(ISendAsync implementation) => this.implementation = implementation.SendAsync; + public ISendAsync Create() => this; + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => implementation(request, callback); + } + + public partial class SendAsyncFactory : ISendAsyncFactory + { + public class Sender : ISendAsync + { + internal ISendAsync next; + internal SendAsyncStep implementation; + + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => implementation(request, callback, next); + } + SendAsyncStep implementation; + + public SendAsyncFactory(SendAsyncStep implementation) => this.implementation = implementation; + public ISendAsync Create(ISendAsync next) => new Sender { next = next, implementation = implementation }; + + } + + public class HttpClientFactory : ISendAsyncTerminalFactory, ISendAsync + { + HttpClient client; + public HttpClientFactory() : this(new HttpClient()) + { + } + public HttpClientFactory(HttpClient client) => this.client = client; + public ISendAsync Create() => this; + + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, callback.Token); + } + + public interface ISendAsyncFactory + { + ISendAsync Create(ISendAsync next); + } + + public interface ISendAsyncTerminalFactory + { + ISendAsync Create(); + } + + public partial class HttpPipeline : ISendAsync + { + private ISendAsync pipeline; + private ISendAsyncTerminalFactory terminal; + private List steps = new List(); + + public HttpPipeline() : this(new HttpClientFactory()) + { + } + + public HttpPipeline(ISendAsyncTerminalFactory terminalStep) + { + if (terminalStep == null) + { + throw new System.ArgumentNullException(nameof(terminalStep), "Terminal Step Factory in HttpPipeline may not be null"); + } + TerminalFactory = terminalStep; + } + + /// + /// Returns an HttpPipeline with the current state of this pipeline. + /// + public HttpPipeline Clone() => new HttpPipeline(terminal) { steps = this.steps.ToList(), pipeline = this.pipeline }; + + public ISendAsyncTerminalFactory TerminalFactory + { + get => terminal; + set + { + if (value == null) + { + throw new System.ArgumentNullException("TerminalFactory in HttpPipeline may not be null"); + } + terminal = value; + } + } + + public ISendAsync Pipeline + { + get + { + // if the pipeline has been created and not invalidated, return it. + if (this.pipeline != null) + { + return this.pipeline; + } + + // create the pipeline from scratch. + var next = terminal.Create(); + foreach (var factory in steps) + { + // skip factories that return null. + next = factory.Create(next) ?? next; + } + return this.pipeline = next; + } + } + + public int Count => steps.Count; + + public HttpPipeline Prepend(ISendAsyncFactory item) + { + if (item != null) + { + steps.Add(item); + pipeline = null; + } + return this; + } + + public HttpPipeline Append(SendAsyncStep item) + { + if (item != null) + { + Append(new SendAsyncFactory(item)); + } + return this; + } + + public HttpPipeline Prepend(SendAsyncStep item) + { + if (item != null) + { + Prepend(new SendAsyncFactory(item)); + } + return this; + } + public HttpPipeline Append(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Append(new SendAsyncFactory(item)); + } + } + return this; + } + + public HttpPipeline Prepend(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Prepend(new SendAsyncFactory(item)); + } + } + return this; + } + + public HttpPipeline Append(ISendAsyncFactory item) + { + if (item != null) + { + steps.Insert(0, item); + pipeline = null; + } + return this; + } + public HttpPipeline Prepend(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Prepend(item); + } + } + return this; + } + + public HttpPipeline Append(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Append(item); + } + } + return this; + } + + // you can use this as the ISendAsync Implementation + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => Pipeline.SendAsync(request, callback); + } + + internal static partial class Extensions + { + internal static HttpRequestMessage CloneAndDispose(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + using (original) + { + return original.Clone(requestUri, method); + } + } + + internal static Task CloneWithContentAndDispose(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + using (original) + { + return original.CloneWithContent(requestUri, method); + } + } + + /// + /// Clones an HttpRequestMessage (without the content) + /// + /// Original HttpRequestMessage (Will be diposed before returning) + /// + /// + /// A clone of the HttpRequestMessage + internal static HttpRequestMessage Clone(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + var clone = new HttpRequestMessage + { + Method = method ?? original.Method, + RequestUri = requestUri ?? original.RequestUri, + Version = original.Version, + }; + + foreach (KeyValuePair prop in original.Properties) + { + clone.Properties.Add(prop); + } + + foreach (KeyValuePair> header in original.Headers) + { + /* + **temporarily skip cloning telemetry related headers** + clone.Headers.TryAddWithoutValidation(header.Key, header.Value); + */ + if (!"x-ms-unique-id".Equals(header.Key) && !"x-ms-client-request-id".Equals(header.Key) && !"CommandName".Equals(header.Key) && !"FullCommandName".Equals(header.Key) && !"ParameterSetName".Equals(header.Key) && !"User-Agent".Equals(header.Key)) + { + clone.Headers.TryAddWithoutValidation(header.Key, header.Value); + } + } + + return clone; + } + + /// + /// Clones an HttpRequestMessage (including the content stream and content headers) + /// + /// Original HttpRequestMessage (Will be diposed before returning) + /// + /// + /// A clone of the HttpRequestMessage + internal static async Task CloneWithContent(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + var clone = original.Clone(requestUri, method); + var stream = new System.IO.MemoryStream(); + if (original.Content != null) + { + await original.Content.CopyToAsync(stream).ConfigureAwait(false); + stream.Position = 0; + clone.Content = new StreamContent(stream); + if (original.Content.Headers != null) + { + foreach (var h in original.Content.Headers) + { + clone.Content.Headers.Add(h.Key, h.Value); + } + } + } + return clone; + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/InfoAttribute.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/InfoAttribute.cs new file mode 100644 index 000000000000..768f5e765f90 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/InfoAttribute.cs @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + using System; + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Class)] + public class InfoAttribute : Attribute + { + public bool Required { get; set; } = false; + public bool ReadOnly { get; set; } = false; + public Type[] PossibleTypes { get; set; } = new Type[0]; + public string Description { get; set; } = ""; + public string SerializedName { get; set; } = ""; + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + public class CompleterInfoAttribute : Attribute + { + public string Script { get; set; } = ""; + public string Name { get; set; } = ""; + public string Description { get; set; } = ""; + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + public class DefaultInfoAttribute : Attribute + { + public string Script { get; set; } = ""; + public string Name { get; set; } = ""; + public string Description { get; set; } = ""; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Iso/IsoDate.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Iso/IsoDate.cs new file mode 100644 index 000000000000..6a47398b5eb3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Iso/IsoDate.cs @@ -0,0 +1,214 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal struct IsoDate + { + internal int Year { get; set; } // 0-3000 + + internal int Month { get; set; } // 1-12 + + internal int Day { get; set; } // 1-31 + + internal int Hour { get; set; } // 0-24 + + internal int Minute { get; set; } // 0-60 (60 is a special case) + + internal int Second { get; set; } // 0-60 (60 is used for leap seconds) + + internal double Millisecond { get; set; } // 0-999.9... + + internal TimeSpan Offset { get; set; } + + internal DateTimeKind Kind { get; set; } + + internal TimeSpan TimeOfDay => new TimeSpan(Hour, Minute, Second); + + internal DateTime ToDateTime() + { + if (Kind == DateTimeKind.Utc || Offset == TimeSpan.Zero) + { + return new DateTime(Year, Month, Day, Hour, Minute, Second, (int)Millisecond, DateTimeKind.Utc); + } + + return ToDateTimeOffset().DateTime; + } + + internal DateTimeOffset ToDateTimeOffset() + { + return new DateTimeOffset( + Year, + Month, + Day, + Hour, + Minute, + Second, + (int)Millisecond, + Offset + ); + } + + internal DateTime ToUtcDateTime() + { + return ToDateTimeOffset().UtcDateTime; + } + + public override string ToString() + { + var sb = new StringBuilder(); + + // yyyy-MM-dd + sb.Append($"{Year}-{Month:00}-{Day:00}"); + + if (TimeOfDay > new TimeSpan(0)) + { + sb.Append($"T{Hour:00}:{Minute:00}"); + + if (TimeOfDay.Seconds > 0) + { + sb.Append($":{Second:00}"); + } + } + + if (Offset.Ticks == 0) + { + sb.Append('Z'); // UTC + } + else + { + if (Offset.Ticks >= 0) + { + sb.Append('+'); + } + + sb.Append($"{Offset.Hours:00}:{Offset.Minutes:00}"); + } + + return sb.ToString(); + } + + internal static IsoDate FromDateTimeOffset(DateTimeOffset date) + { + return new IsoDate { + Year = date.Year, + Month = date.Month, + Day = date.Day, + Hour = date.Hour, + Minute = date.Minute, + Second = date.Second, + Offset = date.Offset, + Kind = date.Offset == TimeSpan.Zero ? DateTimeKind.Utc : DateTimeKind.Unspecified + }; + } + + private static readonly char[] timeSeperators = { ':', '.' }; + + internal static IsoDate Parse(string text) + { + var tzIndex = -1; + var timeIndex = text.IndexOf('T'); + + var builder = new IsoDate { Day = 1, Month = 1 }; + + // TODO: strip the time zone offset off the end + string dateTime = text; + string timeZone = null; + + if (dateTime.IndexOf('Z') > -1) + { + tzIndex = dateTime.LastIndexOf('Z'); + + builder.Kind = DateTimeKind.Utc; + } + else if (dateTime.LastIndexOf('+') > 10) + { + tzIndex = dateTime.LastIndexOf('+'); + } + else if (dateTime.LastIndexOf('-') > 10) + { + tzIndex = dateTime.LastIndexOf('-'); + } + + if (tzIndex > -1) + { + timeZone = dateTime.Substring(tzIndex); + dateTime = dateTime.Substring(0, tzIndex); + } + + string date = (timeIndex == -1) ? dateTime : dateTime.Substring(0, timeIndex); + + var dateParts = date.Split(Seperator.Dash); // '-' + + for (int i = 0; i < dateParts.Length; i++) + { + var part = dateParts[i]; + + switch (i) + { + case 0: builder.Year = int.Parse(part); break; + case 1: builder.Month = int.Parse(part); break; + case 2: builder.Day = int.Parse(part); break; + } + } + + if (timeIndex > -1) + { + string[] timeParts = dateTime.Substring(timeIndex + 1).Split(timeSeperators); + + for (int i = 0; i < timeParts.Length; i++) + { + var part = timeParts[i]; + + switch (i) + { + case 0: builder.Hour = int.Parse(part); break; + case 1: builder.Minute = int.Parse(part); break; + case 2: builder.Second = int.Parse(part); break; + case 3: builder.Millisecond = double.Parse("0." + part) * 1000; break; + } + } + } + + if (timeZone != null && timeZone != "Z") + { + var hours = int.Parse(timeZone.Substring(1, 2)); + var minutes = int.Parse(timeZone.Substring(4, 2)); + + if (timeZone[0] == '-') + { + hours = -hours; + minutes = -minutes; + } + + builder.Offset = new TimeSpan(hours, minutes, 0); + } + + return builder; + } + } + + /* + YYYY # eg 1997 + YYYY-MM # eg 1997-07 + YYYY-MM-DD # eg 1997-07-16 + YYYY-MM-DDThh:mmTZD # eg 1997-07-16T19:20+01:00 + YYYY-MM-DDThh:mm:ssTZD # eg 1997-07-16T19:20:30+01:00 + YYYY-MM-DDThh:mm:ss.sTZD # eg 1997-07-16T19:20:30.45+01:00 + + where: + + YYYY = four-digit year + MM = two-digit month (01=January, etc.) + DD = two-digit day of month (01 through 31) + hh = two digits of hour (00 through 23) (am/pm NOT allowed) + mm = two digits of minute (00 through 59) + ss = two digits of second (00 through 59) + s = one or more digits representing a decimal fraction of a second + TZD = time zone designator (Z or +hh:mm or -hh:mm) + */ +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/JsonType.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/JsonType.cs new file mode 100644 index 000000000000..966ff3aac9c9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/JsonType.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal enum JsonType + { + Null = 0, + Object = 1, + Array = 2, + Binary = 3, + Boolean = 4, + Date = 5, + Number = 6, + String = 7 + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/MessageAttribute.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/MessageAttribute.cs new file mode 100644 index 000000000000..18d28e9895f9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/MessageAttribute.cs @@ -0,0 +1,350 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.generated.runtime.Properties; + using System; + using System.Collections.Generic; + using System.Globalization; + using System.Linq; + using System.Management.Automation; + using System.Text; + + [AttributeUsage(AttributeTargets.All)] + public class GenericBreakingChangeAttribute : Attribute + { + private string _message; + //A dexcription of what the change is about, non mandatory + public string ChangeDescription { get; set; } = null; + + //The version the change is effective from, non mandatory + public string DeprecateByVersion { get; } + public string DeprecateByAzVersion { get; } + + //The date on which the change comes in effect + public DateTime ChangeInEfectByDate { get; } + public bool ChangeInEfectByDateSet { get; } = false; + + //Old way of calling the cmdlet + public string OldWay { get; set; } + //New way fo calling the cmdlet + public string NewWay { get; set; } + + public GenericBreakingChangeAttribute(string message, string deprecateByAzVersion, string deprecateByVersion) + { + _message = message; + this.DeprecateByAzVersion = deprecateByAzVersion; + this.DeprecateByVersion = deprecateByVersion; + } + + public GenericBreakingChangeAttribute(string message, string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) + { + _message = message; + this.DeprecateByVersion = deprecateByVersion; + this.DeprecateByAzVersion = deprecateByAzVersion; + + if (DateTime.TryParse(changeInEfectByDate, new CultureInfo("en-US"), DateTimeStyles.None, out DateTime result)) + { + this.ChangeInEfectByDate = result; + this.ChangeInEfectByDateSet = true; + } + } + + public DateTime getInEffectByDate() + { + return this.ChangeInEfectByDate.Date; + } + + + /** + * This function prints out the breaking change message for the attribute on the cmdline + * */ + public void PrintCustomAttributeInfo(Action writeOutput) + { + + if (!GetAttributeSpecificMessage().StartsWith(Environment.NewLine)) + { + writeOutput(Environment.NewLine); + } + writeOutput(string.Format(Resources.BreakingChangesAttributesDeclarationMessage, GetAttributeSpecificMessage())); + + + if (!string.IsNullOrWhiteSpace(ChangeDescription)) + { + writeOutput(string.Format(Resources.BreakingChangesAttributesChangeDescriptionMessage, this.ChangeDescription)); + } + + if (ChangeInEfectByDateSet) + { + writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByDateMessage, this.ChangeInEfectByDate.ToString("d"))); + } + + writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByAzVersion, this.DeprecateByAzVersion)); + writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByVersion, this.DeprecateByVersion)); + + if (OldWay != null && NewWay != null) + { + writeOutput(string.Format(Resources.BreakingChangesAttributesUsageChangeMessageConsole, OldWay, NewWay)); + } + } + + public virtual bool IsApplicableToInvocation(InvocationInfo invocation) + { + return true; + } + + protected virtual string GetAttributeSpecificMessage() + { + return _message; + } + } + + [AttributeUsage(AttributeTargets.All)] + public class CmdletBreakingChangeAttribute : GenericBreakingChangeAttribute + { + + public string ReplacementCmdletName { get; set; } + + public CmdletBreakingChangeAttribute(string deprecateByAzVersion, string deprecateByVersion) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion) + { + } + + public CmdletBreakingChangeAttribute(string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate) + { + } + + protected override string GetAttributeSpecificMessage() + { + if (string.IsNullOrWhiteSpace(ReplacementCmdletName)) + { + return Resources.BreakingChangesAttributesCmdLetDeprecationMessageNoReplacement; + } + else + { + return string.Format(Resources.BreakingChangesAttributesCmdLetDeprecationMessageWithReplacement, ReplacementCmdletName); + } + } + } + + [AttributeUsage(AttributeTargets.All)] + public class ParameterSetBreakingChangeAttribute : GenericBreakingChangeAttribute + { + public string[] ChangedParameterSet { set; get; } + + public ParameterSetBreakingChangeAttribute(string[] changedParameterSet, string deprecateByAzVersion, string deprecateByVersion) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion) + { + ChangedParameterSet = changedParameterSet; + } + + public ParameterSetBreakingChangeAttribute(string[] changedParameterSet, string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate) + { + ChangedParameterSet = changedParameterSet; + } + + protected override string GetAttributeSpecificMessage() + { + + return Resources.BreakingChangesAttributesParameterSetDeprecationMessageNoReplacement; + + } + + public bool IsApplicableToInvocation(InvocationInfo invocation, string parameterSetName) + { + if (ChangedParameterSet != null) + return ChangedParameterSet.Contains(parameterSetName); + return false; + } + + } + + [AttributeUsage(AttributeTargets.All)] + public class PreviewMessageAttribute : Attribute + { + public string _message; + + public DateTime EstimatedGaDate { get; } + + public bool IsEstimatedGaDateSet { get; } = false; + + + public PreviewMessageAttribute() + { + this._message = Resources.PreviewCmdletMessage; + } + + public PreviewMessageAttribute(string message) + { + this._message = string.IsNullOrEmpty(message) ? Resources.PreviewCmdletMessage : message; + } + + public PreviewMessageAttribute(string message, string estimatedDateOfGa) : this(message) + { + if (DateTime.TryParse(estimatedDateOfGa, new CultureInfo("en-US"), DateTimeStyles.None, out DateTime result)) + { + this.EstimatedGaDate = result; + this.IsEstimatedGaDateSet = true; + } + } + + public void PrintCustomAttributeInfo(Action writeOutput) + { + writeOutput(this._message); + + if (IsEstimatedGaDateSet) + { + writeOutput(string.Format(Resources.PreviewCmdletETAMessage, this.EstimatedGaDate.ToShortDateString())); + } + } + + public virtual bool IsApplicableToInvocation(InvocationInfo invocation) + { + return true; + } + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + public class ParameterBreakingChangeAttribute : GenericBreakingChangeAttribute + { + public string NameOfParameterChanging { get; } + + public string ReplaceMentCmdletParameterName { get; set; } = null; + + public bool IsBecomingMandatory { get; set; } = false; + + public String OldParamaterType { get; set; } + + public String NewParameterType { get; set; } + + public ParameterBreakingChangeAttribute(string nameOfParameterChanging, string deprecateByAzVersion, string deprecateByVersion) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion) + { + this.NameOfParameterChanging = nameOfParameterChanging; + } + + public ParameterBreakingChangeAttribute(string nameOfParameterChanging, string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate) + { + this.NameOfParameterChanging = nameOfParameterChanging; + } + + protected override string GetAttributeSpecificMessage() + { + StringBuilder message = new StringBuilder(); + if (!string.IsNullOrWhiteSpace(ReplaceMentCmdletParameterName)) + { + if (IsBecomingMandatory) + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterReplacedMandatory, NameOfParameterChanging, ReplaceMentCmdletParameterName)); + } + else + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterReplaced, NameOfParameterChanging, ReplaceMentCmdletParameterName)); + } + } + else + { + if (IsBecomingMandatory) + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterMandatoryNow, NameOfParameterChanging)); + } + else + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterChanging, NameOfParameterChanging)); + } + } + + //See if the type of the param is changing + if (OldParamaterType != null && !string.IsNullOrWhiteSpace(NewParameterType)) + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterTypeChange, OldParamaterType, NewParameterType)); + } + return message.ToString(); + } + + /// + /// See if the bound parameters contain the current parameter, if they do + /// then the attribbute is applicable + /// If the invocationInfo is null we return true + /// + /// + /// bool + public override bool IsApplicableToInvocation(InvocationInfo invocationInfo) + { + bool? applicable = invocationInfo == null ? true : invocationInfo.BoundParameters?.Keys?.Contains(this.NameOfParameterChanging); + return applicable.HasValue ? applicable.Value : false; + } + } + + [AttributeUsage(AttributeTargets.All)] + public class OutputBreakingChangeAttribute : GenericBreakingChangeAttribute + { + public string DeprecatedCmdLetOutputType { get; } + + //This is still a String instead of a Type as this + //might be undefined at the time of adding the attribute + public string ReplacementCmdletOutputType { get; set; } + + public string[] DeprecatedOutputProperties { get; set; } + + public string[] NewOutputProperties { get; set; } + + public OutputBreakingChangeAttribute(string deprecatedCmdletOutputType, string deprecateByAzVersion, string deprecateByVersion) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion) + { + this.DeprecatedCmdLetOutputType = deprecatedCmdletOutputType; + } + + public OutputBreakingChangeAttribute(string deprecatedCmdletOutputType, string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate) + { + this.DeprecatedCmdLetOutputType = deprecatedCmdletOutputType; + } + + protected override string GetAttributeSpecificMessage() + { + StringBuilder message = new StringBuilder(); + + //check for the deprecation scenario + if (string.IsNullOrWhiteSpace(ReplacementCmdletOutputType) && NewOutputProperties == null && DeprecatedOutputProperties == null && string.IsNullOrWhiteSpace(ChangeDescription)) + { + message.Append(string.Format(Resources.BreakingChangesAttributesCmdLetOutputTypeDeprecated, DeprecatedCmdLetOutputType)); + } + else + { + if (!string.IsNullOrWhiteSpace(ReplacementCmdletOutputType)) + { + message.Append(string.Format(Resources.BreakingChangesAttributesCmdLetOutputChange1, DeprecatedCmdLetOutputType, ReplacementCmdletOutputType)); + } + else + { + message.Append(string.Format(Resources.BreakingChangesAttributesCmdLetOutputChange2, DeprecatedCmdLetOutputType)); + } + + if (DeprecatedOutputProperties != null && DeprecatedOutputProperties.Length > 0) + { + message.Append(Resources.BreakingChangesAttributesCmdLetOutputPropertiesRemoved); + foreach (string property in DeprecatedOutputProperties) + { + message.Append(" '" + property + "'"); + } + } + + if (NewOutputProperties != null && NewOutputProperties.Length > 0) + { + message.Append(Resources.BreakingChangesAttributesCmdLetOutputPropertiesAdded); + foreach (string property in NewOutputProperties) + { + message.Append(" '" + property + "'"); + } + } + } + return message.ToString(); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/MessageAttributeHelper.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/MessageAttributeHelper.cs new file mode 100644 index 000000000000..125cbc67c3b8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/MessageAttributeHelper.cs @@ -0,0 +1,184 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// 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. +// ---------------------------------------------------------------------------------- +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.generated.runtime.Properties; + using System; + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using System.Reflection; + using System.Text; + using System.Threading.Tasks; + public class MessageAttributeHelper + { + private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + public const string BREAKING_CHANGE_ATTRIBUTE_INFORMATION_LINK = "https://aka.ms/azps-changewarnings"; + public const string SUPPRESS_ERROR_OR_WARNING_MESSAGE_ENV_VARIABLE_NAME = "SuppressAzurePowerShellBreakingChangeWarnings"; + + /** + * This function takes in a CommandInfo (CmdletInfo or FunctionInfo) + * And reads all the deprecation attributes attached to it + * Prints a message on the cmdline For each of the attribute found + * + * the boundParameterNames is a list of parameters bound to the cmdlet at runtime, + * We only process the Parameter beaking change attributes attached only params listed in this list (if present) + * */ + public static void ProcessCustomAttributesAtRuntime(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet, System.Management.Automation.PSCmdlet psCmdlet, bool showPreviewMessage = true) + { + bool supressWarningOrError = false; + + try + { + supressWarningOrError = bool.Parse(System.Environment.GetEnvironmentVariable(SUPPRESS_ERROR_OR_WARNING_MESSAGE_ENV_VARIABLE_NAME)); + } + catch (Exception) + { + //no action + } + + if (supressWarningOrError) + { + //Do not process the attributes at runtime... The env variable to override the warning messages is set + return; + } + if (IsAzure && invocationInfo.BoundParameters.ContainsKey("DefaultProfile")) + { + psCmdlet.WriteWarning("The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription."); + } + + ProcessBreakingChangeAttributesAtRuntime(commandInfo, invocationInfo, parameterSet, psCmdlet); + + } + + private static void ProcessBreakingChangeAttributesAtRuntime(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet, System.Management.Automation.PSCmdlet psCmdlet) + { + List attributes = new List(GetAllBreakingChangeAttributesInType(commandInfo, invocationInfo, parameterSet)); + StringBuilder sb = new StringBuilder(); + Action appendAttributeMessage = (string s) => sb.Append(s); + + if (attributes != null && attributes.Count > 0) + { + appendAttributeMessage(string.Format(Resources.BreakingChangesAttributesHeaderMessage, commandInfo.Name.Split('_')[0])); + + foreach (GenericBreakingChangeAttribute attribute in attributes) + { + attribute.PrintCustomAttributeInfo(appendAttributeMessage); + } + + appendAttributeMessage(string.Format(Resources.BreakingChangesAttributesFooterMessage, BREAKING_CHANGE_ATTRIBUTE_INFORMATION_LINK)); + + psCmdlet.WriteWarning(sb.ToString()); + } + } + + + public static void ProcessPreviewMessageAttributesAtRuntime(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet, System.Management.Automation.PSCmdlet psCmdlet) + { + List previewAttributes = new List(GetAllPreviewAttributesInType(commandInfo, invocationInfo)); + StringBuilder sb = new StringBuilder(); + Action appendAttributeMessage = (string s) => sb.Append(s); + + if (previewAttributes != null && previewAttributes.Count > 0) + { + foreach (PreviewMessageAttribute attribute in previewAttributes) + { + attribute.PrintCustomAttributeInfo(appendAttributeMessage); + } + psCmdlet.WriteWarning(sb.ToString()); + } + } + + /** + * This function takes in a CommandInfo (CmdletInfo or FunctionInfo) + * And returns all the deprecation attributes attached to it + * + * the boundParameterNames is a list of parameters bound to the cmdlet at runtime, + * We only process the Parameter beaking change attributes attached only params listed in this list (if present) + **/ + private static IEnumerable GetAllBreakingChangeAttributesInType(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet) + { + List attributeList = new List(); + + if (commandInfo.GetType() == typeof(CmdletInfo)) + { + var type = ((CmdletInfo)commandInfo).ImplementingType; + attributeList.AddRange(type.GetCustomAttributes(typeof(GenericBreakingChangeAttribute), false).Cast()); + + foreach (MethodInfo m in type.GetRuntimeMethods()) + { + attributeList.AddRange((m.GetCustomAttributes(typeof(GenericBreakingChangeAttribute), false).Cast())); + } + + foreach (FieldInfo f in type.GetRuntimeFields()) + { + attributeList.AddRange(f.GetCustomAttributes(typeof(GenericBreakingChangeAttribute), false).Cast()); + } + + foreach (PropertyInfo p in type.GetRuntimeProperties()) + { + attributeList.AddRange(p.GetCustomAttributes(typeof(GenericBreakingChangeAttribute), false).Cast()); + } + } + else if (commandInfo.GetType() == typeof(FunctionInfo)) + { + attributeList.AddRange(((FunctionInfo)commandInfo).ScriptBlock.Attributes.Where(e => typeof(GenericBreakingChangeAttribute).IsAssignableFrom(e.GetType())).Cast()); + foreach (var parameter in ((FunctionInfo)commandInfo).Parameters) + { + attributeList.AddRange(parameter.Value.Attributes.Where(e => typeof(GenericBreakingChangeAttribute).IsAssignableFrom(e.GetType())).Cast()); + } + } + return invocationInfo == null ? attributeList : attributeList.Where(e => e.GetType() == typeof(ParameterSetBreakingChangeAttribute) ? ((ParameterSetBreakingChangeAttribute)e).IsApplicableToInvocation(invocationInfo, parameterSet) : e.IsApplicableToInvocation(invocationInfo)); + } + + public static bool ContainsPreviewAttribute(CommandInfo commandInfo, InvocationInfo invocationInfo) + { + return GetAllPreviewAttributesInType(commandInfo, invocationInfo)?.Count() > 0; + } + + private static IEnumerable GetAllPreviewAttributesInType(CommandInfo commandInfo, InvocationInfo invocationInfo) + { + List attributeList = new List(); + if (commandInfo.GetType() == typeof(CmdletInfo)) + { + var type = ((CmdletInfo)commandInfo).ImplementingType; + attributeList.AddRange(type.GetCustomAttributes(typeof(PreviewMessageAttribute), false).Cast()); + + foreach (MethodInfo m in type.GetRuntimeMethods()) + { + attributeList.AddRange((m.GetCustomAttributes(typeof(PreviewMessageAttribute), false).Cast())); + } + + foreach (FieldInfo f in type.GetRuntimeFields()) + { + attributeList.AddRange(f.GetCustomAttributes(typeof(PreviewMessageAttribute), false).Cast()); + } + + foreach (PropertyInfo p in type.GetRuntimeProperties()) + { + attributeList.AddRange(p.GetCustomAttributes(typeof(PreviewMessageAttribute), false).Cast()); + } + } + else if (commandInfo.GetType() == typeof(FunctionInfo)) + { + attributeList.AddRange(((FunctionInfo)commandInfo).ScriptBlock.Attributes.Where(e => typeof(PreviewMessageAttribute).IsAssignableFrom(e.GetType())).Cast()); + foreach (var parameter in ((FunctionInfo)commandInfo).Parameters) + { + attributeList.AddRange(parameter.Value.Attributes.Where(e => typeof(PreviewMessageAttribute).IsAssignableFrom(e.GetType())).Cast()); + } + } + return invocationInfo == null ? attributeList : attributeList.Where(e => e.IsApplicableToInvocation(invocationInfo)); + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Method.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Method.cs new file mode 100644 index 000000000000..dab88ef1eaa7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Method.cs @@ -0,0 +1,19 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + internal static class Method + { + internal static System.Net.Http.HttpMethod Get = System.Net.Http.HttpMethod.Get; + internal static System.Net.Http.HttpMethod Put = System.Net.Http.HttpMethod.Put; + internal static System.Net.Http.HttpMethod Head = System.Net.Http.HttpMethod.Head; + internal static System.Net.Http.HttpMethod Post = System.Net.Http.HttpMethod.Post; + internal static System.Net.Http.HttpMethod Delete = System.Net.Http.HttpMethod.Delete; + internal static System.Net.Http.HttpMethod Options = System.Net.Http.HttpMethod.Options; + internal static System.Net.Http.HttpMethod Trace = System.Net.Http.HttpMethod.Trace; + internal static System.Net.Http.HttpMethod Patch = new System.Net.Http.HttpMethod("PATCH"); + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Models/JsonMember.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Models/JsonMember.cs new file mode 100644 index 000000000000..50246626863d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Models/JsonMember.cs @@ -0,0 +1,83 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Reflection; +using System.Runtime.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + + + internal sealed class JsonMember + { + private readonly TypeDetails type; + + private readonly Func getter; + private readonly Action setter; + + internal JsonMember(PropertyInfo property, int defaultOrder) + { + getter = property.GetValue; + setter = property.SetValue; + + var dataMember = property.GetCustomAttribute(); + + Name = dataMember?.Name ?? property.Name; + Order = dataMember?.Order ?? defaultOrder; + EmitDefaultValue = dataMember?.EmitDefaultValue ?? true; + + this.type = TypeDetails.Get(property.PropertyType); + + CanRead = property.CanRead; + } + + internal JsonMember(FieldInfo field, int defaultOrder) + { + getter = field.GetValue; + setter = field.SetValue; + + var dataMember = field.GetCustomAttribute(); + + Name = dataMember?.Name ?? field.Name; + Order = dataMember?.Order ?? defaultOrder; + EmitDefaultValue = dataMember?.EmitDefaultValue ?? true; + + this.type = TypeDetails.Get(field.FieldType); + + CanRead = true; + } + + internal string Name { get; } + + internal int Order { get; } + + internal TypeDetails TypeDetails => type; + + internal Type Type => type.NonNullType; + + internal bool IsList => type.IsList; + + // Arrays, Sets, ... + internal Type ElementType => type.ElementType; + + internal IJsonConverter Converter => type.JsonConverter; + + internal bool EmitDefaultValue { get; } + + internal bool IsStringLike => type.IsStringLike; + + internal object DefaultValue => type.DefaultValue; + + internal bool CanRead { get; } + + #region Helpers + + internal object GetValue(object instance) => getter(instance); + + internal void SetValue(object instance, object value) => setter(instance, value); + + #endregion + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Models/JsonModel.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Models/JsonModel.cs new file mode 100644 index 000000000000..5bbc37d05432 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Models/JsonModel.cs @@ -0,0 +1,89 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal class JsonModel + { + private Dictionary map; + private readonly object _sync = new object(); + + private JsonModel(Type type, List members) + { + Type = type ?? throw new ArgumentNullException(nameof(type)); + Members = members ?? throw new ArgumentNullException(nameof(members)); + } + + internal string Name => Type.Name; + + internal Type Type { get; } + + internal List Members { get; } + + internal JsonMember this[string name] + { + get + { + if (map == null) + { + lock (_sync) + { + if (map == null) + { + map = new Dictionary(); + + foreach (JsonMember m in Members) + { + map[m.Name.ToLower()] = m; + } + } + } + } + + + map.TryGetValue(name.ToLower(), out JsonMember member); + + return member; + } + } + + internal static JsonModel FromType(Type type) + { + var members = new List(); + + int i = 0; + + // BindingFlags.Instance | BindingFlags.Public + + foreach (var member in type.GetFields()) + { + if (member.IsStatic) continue; + + if (member.IsDefined(typeof(IgnoreDataMemberAttribute))) continue; + + members.Add(new JsonMember(member, i)); + + i++; + } + + foreach (var member in type.GetProperties(BindingFlags.Public | BindingFlags.Instance)) + { + if (member.IsDefined(typeof(IgnoreDataMemberAttribute))) continue; + + members.Add(new JsonMember(member, i)); + + i++; + } + + members.Sort((a, b) => a.Order.CompareTo(b.Order)); // inline sort + + return new JsonModel(type, members); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Models/JsonModelCache.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Models/JsonModelCache.cs new file mode 100644 index 000000000000..46eada9e445a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Models/JsonModelCache.cs @@ -0,0 +1,19 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Runtime.CompilerServices; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal static class JsonModelCache + { + private static readonly ConditionalWeakTable cache + = new ConditionalWeakTable(); + + internal static JsonModel Get(Type type) => cache.GetValue(type, Create); + + private static JsonModel Create(Type type) => JsonModel.FromType(type); + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/Collections/JsonArray.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/Collections/JsonArray.cs new file mode 100644 index 000000000000..3e762529511a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/Collections/JsonArray.cs @@ -0,0 +1,65 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public abstract partial class JsonArray : JsonNode, IEnumerable + { + internal override JsonType Type => JsonType.Array; + + internal abstract JsonType? ElementType { get; } + + public abstract int Count { get; } + + internal virtual bool IsSet => false; + + internal bool IsEmpty => Count == 0; + + #region IEnumerable + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + #endregion + + #region Static Helpers + + internal static JsonArray Create(short[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(int[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(long[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(decimal[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(float[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(string[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(XBinary[] values) + => new XImmutableArray(values); + + #endregion + + internal static new JsonArray Parse(string text) + => (JsonArray)JsonNode.Parse(text); + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/Collections/XImmutableArray.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/Collections/XImmutableArray.cs new file mode 100644 index 000000000000..b20fcbf6bee9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/Collections/XImmutableArray.cs @@ -0,0 +1,62 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal sealed class XImmutableArray : JsonArray, IEnumerable + { + private readonly T[] values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XImmutableArray(T[] values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + public override JsonNode this[int index] => + XHelper.Create(elementType, elementCode, values[index]); + + internal override JsonType? ElementType => elementType; + + public override int Count => values.Length; + + public bool IsReadOnly => true; + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (T value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (T value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + + #region Static Constructor + + internal XImmutableArray Create(T[] items) + { + return new XImmutableArray(items); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/Collections/XList.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/Collections/XList.cs new file mode 100644 index 000000000000..4194d1b88c5a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/Collections/XList.cs @@ -0,0 +1,64 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal sealed class XList : JsonArray, IEnumerable + { + private readonly IList values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XList(IList values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + public override JsonNode this[int index] => + XHelper.Create(elementType, elementCode, values[index]); + + internal override JsonType? ElementType => elementType; + + public override int Count => values.Count; + + public bool IsReadOnly => values.IsReadOnly; + + #region IList + + public void Add(T value) + { + values.Add(value); + } + + public bool Contains(T value) => values.Contains(value); + + #endregion + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs new file mode 100644 index 000000000000..57c19aac14ab --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs @@ -0,0 +1,68 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed partial class XNodeArray : JsonArray, ICollection + { + private readonly List items; + + internal XNodeArray() + { + items = new List(); + } + + internal XNodeArray(params JsonNode[] values) + { + items = new List(values); + } + + public override JsonNode this[int index] => items[index]; + + internal override JsonType? ElementType => null; + + public bool IsReadOnly => false; + + public override int Count => items.Count; + + #region ICollection Members + + public void Add(JsonNode item) + { + items.Add(item); + } + + void ICollection.Clear() + { + items.Clear(); + } + + public bool Contains(JsonNode item) => items.Contains(item); + + void ICollection.CopyTo(JsonNode[] array, int arrayIndex) + { + items.CopyTo(array, arrayIndex); + } + + public bool Remove(JsonNode item) + { + return items.Remove(item); + } + + #endregion + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + #endregion + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/Collections/XSet.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/Collections/XSet.cs new file mode 100644 index 000000000000..61a38e748b2a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/Collections/XSet.cs @@ -0,0 +1,60 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal sealed class XSet : JsonArray, IEnumerable + { + private readonly HashSet values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XSet(IEnumerable values) + : this(new HashSet(values)) + { } + + internal XSet(HashSet values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + internal override JsonType Type => JsonType.Array; + + internal override JsonType? ElementType => elementType; + + public bool IsReadOnly => true; + + public override int Count => values.Count; + + internal override bool IsSet => true; + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + + internal HashSet AsHashSet() => values; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/JsonBoolean.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/JsonBoolean.cs new file mode 100644 index 000000000000..16bc0fc1337a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/JsonBoolean.cs @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal sealed partial class JsonBoolean : JsonNode + { + internal static readonly JsonBoolean True = new JsonBoolean(true); + internal static readonly JsonBoolean False = new JsonBoolean(false); + + internal JsonBoolean(bool value) + { + Value = value; + } + + internal bool Value { get; } + + internal override JsonType Type => JsonType.Boolean; + + internal static new JsonBoolean Parse(string text) + { + switch (text) + { + case "false": return False; + case "true": return True; + + default: throw new ArgumentException($"Expected true or false. Was {text}."); + } + } + + #region Implicit Casts + + public static implicit operator bool(JsonBoolean data) => data.Value; + + public static implicit operator JsonBoolean(bool data) => new JsonBoolean(data); + + #endregion + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/JsonDate.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/JsonDate.cs new file mode 100644 index 000000000000..805e66787be6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/JsonDate.cs @@ -0,0 +1,173 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + + + internal sealed partial class JsonDate : JsonNode, IEquatable, IComparable + { + internal static bool AssumeUtcWhenKindIsUnspecified = true; + + private readonly DateTimeOffset value; + + internal JsonDate(DateTime value) + { + if (value.Kind == DateTimeKind.Unspecified && AssumeUtcWhenKindIsUnspecified) + { + value = DateTime.SpecifyKind(value, DateTimeKind.Utc); + } + + this.value = value; + } + + internal JsonDate(DateTimeOffset value) + { + this.value = value; + } + + internal override JsonType Type => JsonType.Date; + + #region Helpers + + internal DateTimeOffset ToDateTimeOffset() + { + return value; + } + + internal DateTime ToDateTime() + { + if (value.Offset == TimeSpan.Zero) + { + return value.UtcDateTime; + } + + return value.DateTime; + } + + internal DateTime ToUtcDateTime() => value.UtcDateTime; + + internal int ToUnixTimeSeconds() + { + return (int)value.ToUnixTimeSeconds(); + } + + internal long ToUnixTimeMilliseconds() + { + return (int)value.ToUnixTimeMilliseconds(); + } + + internal string ToIsoString() + { + return IsoDate.FromDateTimeOffset(value).ToString(); + } + + #endregion + + public override string ToString() + { + return ToIsoString(); + } + + internal static new JsonDate Parse(string text) + { + if (text == null) throw new ArgumentNullException(nameof(text)); + + // TODO support: unixtimeseconds.partialseconds + + if (text.Length > 4 && _IsNumber(text)) // UnixTime + { + var date = DateTimeOffset.FromUnixTimeSeconds(long.Parse(text)); + + return new JsonDate(date); + } + else if (text.Length <= 4 || text[4] == '-') // ISO: 2012- + { + return new JsonDate(IsoDate.Parse(text).ToDateTimeOffset()); + } + else + { + // NOT ISO ENCODED + // "Thu, 5 Apr 2012 16:59:01 +0200", + return new JsonDate(DateTimeOffset.Parse(text)); + } + } + + private static bool _IsNumber(string text) + { + foreach (var c in text) + { + if (!char.IsDigit(c)) return false; + } + + return true; + } + + internal static JsonDate FromUnixTime(int seconds) + { + return new JsonDate(DateTimeOffset.FromUnixTimeSeconds(seconds)); + } + + internal static JsonDate FromUnixTime(double seconds) + { + var milliseconds = (long)(seconds * 1000d); + + return new JsonDate(DateTimeOffset.FromUnixTimeMilliseconds(milliseconds)); + } + + #region Implicit Casts + + public static implicit operator DateTimeOffset(JsonDate value) + => value.ToDateTimeOffset(); + + public static implicit operator DateTime(JsonDate value) + => value.ToDateTime(); + + // From Date + public static implicit operator JsonDate(DateTimeOffset value) + { + return new JsonDate(value); + } + + public static implicit operator JsonDate(DateTime value) + { + return new JsonDate(value); + } + + // From String + public static implicit operator JsonDate(string value) + { + return Parse(value); + } + + #endregion + + #region Equality + + public override bool Equals(object obj) + { + return obj is JsonDate date && date.value == this.value; + } + + public bool Equals(JsonDate other) + { + return this.value == other.value; + } + + public override int GetHashCode() => value.GetHashCode(); + + #endregion + + #region IComparable Members + + int IComparable.CompareTo(JsonDate other) + { + return value.CompareTo(other.value); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/JsonNode.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/JsonNode.cs new file mode 100644 index 000000000000..2c5aea1f59d2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/JsonNode.cs @@ -0,0 +1,250 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + + + public abstract partial class JsonNode + { + internal abstract JsonType Type { get; } + + public virtual JsonNode this[int index] => throw new NotImplementedException(); + + public virtual JsonNode this[string name] + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + + #region Type Helpers + + internal bool IsArray => Type == JsonType.Array; + + internal bool IsDate => Type == JsonType.Date; + + internal bool IsObject => Type == JsonType.Object; + + internal bool IsNumber => Type == JsonType.Number; + + internal bool IsNull => Type == JsonType.Null; + + #endregion + + internal void WriteTo(TextWriter textWriter, bool pretty = true) + { + var writer = new JsonWriter(textWriter, pretty); + + writer.WriteNode(this); + } + + internal T As() + where T : new() + => new JsonSerializer().Deseralize((JsonObject)this); + + internal T[] ToArrayOf() + { + return (T[])new JsonSerializer().DeserializeArray(typeof(T[]), (JsonArray)this); + } + + #region ToString Overrides + + public override string ToString() => ToString(pretty: true); + + internal string ToString(bool pretty) + { + var sb = new StringBuilder(); + + using (var writer = new StringWriter(sb)) + { + WriteTo(writer, pretty); + + return sb.ToString(); + } + } + + #endregion + + #region Static Constructors + + internal static JsonNode Parse(string text) + { + return Parse(new SourceReader(new StringReader(text))); + } + + internal static JsonNode Parse(TextReader textReader) + => Parse(new SourceReader(textReader)); + + private static JsonNode Parse(SourceReader sourceReader) + { + using (var parser = new JsonParser(sourceReader)) + { + return parser.ReadNode(); + } + } + + internal static JsonNode FromObject(object instance) + => new JsonSerializer().Serialize(instance); + + #endregion + + #region Implict Casts + + public static implicit operator string(JsonNode node) => node.ToString(); + + #endregion + + #region Explict Casts + + public static explicit operator DateTime(JsonNode node) + { + switch (node.Type) + { + case JsonType.Date: + return ((JsonDate)node).ToDateTime(); + + case JsonType.String: + return JsonDate.Parse(node.ToString()).ToDateTime(); + + case JsonType.Number: + var num = (JsonNumber)node; + + if (num.IsInteger) + { + return DateTimeOffset.FromUnixTimeSeconds(num).UtcDateTime; + } + else + { + return DateTimeOffset.FromUnixTimeMilliseconds((long)((double)num * 1000)).UtcDateTime; + } + } + + throw new ConversionException(node, typeof(DateTime)); + } + + public static explicit operator DateTimeOffset(JsonNode node) + { + switch (node.Type) + { + case JsonType.Date : return ((JsonDate)node).ToDateTimeOffset(); + case JsonType.String : return JsonDate.Parse(node.ToString()).ToDateTimeOffset(); + + case JsonType.Number: + var num = (JsonNumber)node; + + if (num.IsInteger) + { + return DateTimeOffset.FromUnixTimeSeconds(num); + } + else + { + return DateTimeOffset.FromUnixTimeMilliseconds((long)((double)num * 1000)); + } + + } + + throw new ConversionException(node, typeof(DateTimeOffset)); + } + + public static explicit operator float(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return float.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(float)); + } + + public static explicit operator double(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return double.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(double)); + } + + public static explicit operator decimal(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number: return (JsonNumber)node; + case JsonType.String: return decimal.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(decimal)); + } + + public static explicit operator Guid(JsonNode node) + => new Guid(node.ToString()); + + public static explicit operator short(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return short.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(short)); + } + + public static explicit operator int(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return int.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(int)); + } + + public static explicit operator long(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number: return (JsonNumber)node; + case JsonType.String: return long.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(long)); + } + + public static explicit operator bool(JsonNode node) + => ((JsonBoolean)node).Value; + + public static explicit operator ushort(JsonNode node) + => (JsonNumber)node; + + public static explicit operator uint(JsonNode node) + => (JsonNumber)node; + + public static explicit operator ulong(JsonNode node) + => (JsonNumber)node; + + public static explicit operator TimeSpan(JsonNode node) + => TimeSpan.Parse(node.ToString()); + + public static explicit operator Uri(JsonNode node) + { + if (node.Type == JsonType.String) + { + return new Uri(node.ToString()); + } + + throw new ConversionException(node, typeof(Uri)); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/JsonNumber.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/JsonNumber.cs new file mode 100644 index 000000000000..32ff7994b026 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/JsonNumber.cs @@ -0,0 +1,109 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed partial class JsonNumber : JsonNode + { + private readonly string value; + private readonly bool overflows = false; + + internal JsonNumber(string value) + { + this.value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal JsonNumber(int value) + { + this.value = value.ToString(); + } + + internal JsonNumber(long value) + { + this.value = value.ToString(); + + if (value > 9007199254740991) + { + overflows = true; + } + } + + internal JsonNumber(float value) + { + this.value = value.ToString(System.Globalization.CultureInfo.InvariantCulture); + } + + internal JsonNumber(double value) + { + this.value = value.ToString(System.Globalization.CultureInfo.InvariantCulture); + } + + internal override JsonType Type => JsonType.Number; + + internal string Value => value; + + #region Helpers + + internal bool Overflows => overflows; + + internal bool IsInteger => !value.Contains("."); + + internal bool IsFloat => value.Contains("."); + + #endregion + + #region Casting + + public static implicit operator byte(JsonNumber number) + => byte.Parse(number.Value); + + public static implicit operator short(JsonNumber number) + => short.Parse(number.Value); + + public static implicit operator int(JsonNumber number) + => int.Parse(number.Value); + + public static implicit operator long(JsonNumber number) + => long.Parse(number.value); + + public static implicit operator UInt16(JsonNumber number) + => ushort.Parse(number.Value); + + public static implicit operator UInt32(JsonNumber number) + => uint.Parse(number.Value); + + public static implicit operator UInt64(JsonNumber number) + => ulong.Parse(number.Value); + + public static implicit operator decimal(JsonNumber number) + => decimal.Parse(number.Value, System.Globalization.CultureInfo.InvariantCulture); + + public static implicit operator Double(JsonNumber number) + => double.Parse(number.value, System.Globalization.CultureInfo.InvariantCulture); + + public static implicit operator float(JsonNumber number) + => float.Parse(number.value, System.Globalization.CultureInfo.InvariantCulture); + + public static implicit operator JsonNumber(short data) + => new JsonNumber(data.ToString()); + + public static implicit operator JsonNumber(int data) + => new JsonNumber(data); + + public static implicit operator JsonNumber(long data) + => new JsonNumber(data); + + public static implicit operator JsonNumber(Single data) + => new JsonNumber(data.ToString()); + + public static implicit operator JsonNumber(double data) + => new JsonNumber(data.ToString()); + + #endregion + + public override string ToString() => value; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/JsonObject.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/JsonObject.cs new file mode 100644 index 000000000000..95616d0f06bb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/JsonObject.cs @@ -0,0 +1,172 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public partial class JsonObject : JsonNode, IDictionary + { + private readonly Dictionary items; + + internal JsonObject() + { + items = new Dictionary(); + } + + internal JsonObject(IEnumerable> properties) + { + if (properties == null) throw new ArgumentNullException(nameof(properties)); + + items = new Dictionary(); + + foreach (var field in properties) + { + items.Add(field.Key, field.Value); + } + } + + #region IDictionary Constructors + + internal JsonObject(IDictionary dic) + { + items = new Dictionary(dic.Count); + + foreach (var pair in dic) + { + Add(pair.Key, pair.Value); + } + } + + #endregion + + internal override JsonType Type => JsonType.Object; + + #region Add Overloads + + public void Add(string name, JsonNode value) => + items.Add(name, value); + + public void Add(string name, byte[] value) => + items.Add(name, new XBinary(value)); + + public void Add(string name, DateTime value) => + items.Add(name, new JsonDate(value)); + + public void Add(string name, int value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, long value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, float value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, double value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, string value) => + items.Add(name, new JsonString(value)); + + public void Add(string name, bool value) => + items.Add(name, new JsonBoolean(value)); + + public void Add(string name, Uri url) => + items.Add(name, new JsonString(url.AbsoluteUri)); + + public void Add(string name, string[] values) => + items.Add(name, new XImmutableArray(values)); + + public void Add(string name, int[] values) => + items.Add(name, new XImmutableArray(values)); + + #endregion + + #region ICollection> Members + + void ICollection>.Add(KeyValuePair item) + { + items.Add(item.Key, item.Value); + } + + void ICollection>.Clear() + { + items.Clear(); + } + + bool ICollection>.Contains(KeyValuePair item) => + throw new NotImplementedException(); + + void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) => + throw new NotImplementedException(); + + + int ICollection>.Count => items.Count; + + bool ICollection>.IsReadOnly => false; + + bool ICollection>.Remove(KeyValuePair item) => + throw new NotImplementedException(); + + #endregion + + #region IDictionary Members + + public bool ContainsKey(string key) => items.ContainsKey(key); + + public ICollection Keys => items.Keys; + + public bool Remove(string key) => items.Remove(key); + + public bool TryGetValue(string key, out JsonNode value) => + items.TryGetValue(key, out value); + + public ICollection Values => items.Values; + + public override JsonNode this[string key] + { + get => items[key]; + set => items[key] = value; + } + + #endregion + + #region IEnumerable + + IEnumerator> IEnumerable>.GetEnumerator() + => items.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + #endregion + + #region Helpers + + internal static new JsonObject FromObject(object instance) => + (JsonObject)new JsonSerializer().Serialize(instance); + + #endregion + + #region Static Constructors + + internal static JsonObject FromStream(Stream stream) + { + using (var tr = new StreamReader(stream)) + { + return (JsonObject)Parse(tr); + } + } + + internal static new JsonObject Parse(string text) + { + return (JsonObject)JsonNode.Parse(text); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/JsonString.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/JsonString.cs new file mode 100644 index 000000000000..07c7282900cf --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/JsonString.cs @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed partial class JsonString : JsonNode, IEquatable + { + private readonly string value; + + internal JsonString(string value) + { + this.value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal override JsonType Type => JsonType.String; + + internal string Value => value; + + internal int Length => value.Length; + + #region #region Implicit Casts + + public static implicit operator string(JsonString data) => data.Value; + + public static implicit operator JsonString(string value) => new JsonString(value); + + #endregion + + public override int GetHashCode() => value.GetHashCode(); + + public override string ToString() => value; + + #region IEquatable + + bool IEquatable.Equals(JsonString other) => this.Value == other.Value; + + #endregion + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/XBinary.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/XBinary.cs new file mode 100644 index 000000000000..79a02ee5f0fb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/XBinary.cs @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal sealed class XBinary : JsonNode + { + private readonly byte[] _value; + private readonly string _base64; + + internal XBinary(byte[] value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal XBinary(string base64EncodedString) + { + _base64 = base64EncodedString ?? throw new ArgumentNullException(nameof(base64EncodedString)); + } + + internal override JsonType Type => JsonType.Binary; + + internal byte[] Value => _value ?? Convert.FromBase64String(_base64); + + #region #region Implicit Casts + + public static implicit operator byte[] (XBinary data) => data.Value; + + public static implicit operator XBinary(byte[] data) => new XBinary(data); + + #endregion + + public override int GetHashCode() => Value.GetHashCode(); + + public override string ToString() => _base64 ?? Convert.ToBase64String(_value); + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/XNull.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/XNull.cs new file mode 100644 index 000000000000..0830256d5b78 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Nodes/XNull.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal sealed class XNull : JsonNode + { + internal static readonly XNull Instance = new XNull(); + + private XNull() { } + + internal override JsonType Type => JsonType.Null; + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Parser/Exceptions/ParseException.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Parser/Exceptions/ParseException.cs new file mode 100644 index 000000000000..21306a399525 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Parser/Exceptions/ParseException.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal class ParserException : Exception + { + internal ParserException(string message) + : base(message) + { } + + internal ParserException(string message, SourceLocation location) + : base(message) + { + + Location = location; + } + + internal SourceLocation Location { get; } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Parser/JsonParser.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Parser/JsonParser.cs new file mode 100644 index 000000000000..2f1c441d9166 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Parser/JsonParser.cs @@ -0,0 +1,180 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public class JsonParser : IDisposable + { + private readonly TokenReader reader; + + internal JsonParser(TextReader reader) + : this(new SourceReader(reader)) { } + + internal JsonParser(SourceReader sourceReader) + { + if (sourceReader == null) + throw new ArgumentNullException(nameof(sourceReader)); + + this.reader = new TokenReader(new JsonTokenizer(sourceReader)); + + this.reader.Next(); // Start with the first token + } + + internal IEnumerable ReadNodes() + { + JsonNode node; + + while ((node = ReadNode()) != null) yield return node; + } + + internal JsonNode ReadNode() + { + if (reader.Current.Kind == TokenKind.Eof || reader.Current.IsTerminator) + { + return null; + } + + switch (reader.Current.Kind) + { + case TokenKind.LeftBrace : return ReadObject(); // { + case TokenKind.LeftBracket : return ReadArray(); // [ + + default: throw new ParserException($"Expected '{{' or '['. Was {reader.Current}."); + } + } + + private JsonNode ReadFieldValue() + { + // Boolean, Date, Null, Number, String, Uri + if (reader.Current.IsLiteral) + { + return ReadLiteral(); + } + else + { + switch (reader.Current.Kind) + { + case TokenKind.LeftBracket: return ReadArray(); + case TokenKind.LeftBrace : return ReadObject(); + + default: throw new ParserException($"Unexpected token reading field value. Was {reader.Current}."); + } + } + } + + private JsonNode ReadLiteral() + { + var literal = reader.Current; + + reader.Next(); // Read the literal token + + switch (literal.Kind) + { + case TokenKind.Boolean : return JsonBoolean.Parse(literal.Value); + case TokenKind.Null : return XNull.Instance; + case TokenKind.Number : return new JsonNumber(literal.Value); + case TokenKind.String : return new JsonString(literal.Value); + + default: throw new ParserException($"Unexpected token reading literal. Was {literal}."); + } + } + + internal JsonObject ReadObject() + { + reader.Ensure(TokenKind.LeftBrace, "object"); + + reader.Next(); // Read '{' (Object start) + + var jsonObject = new JsonObject(); + + // Read the object's fields until we reach the end of the object ('}') + while (reader.Current.Kind != TokenKind.RightBrace) + { + if (reader.Current.Kind == TokenKind.Comma) + { + reader.Next(); // Read ',' (Seperator) + } + + // Ensure we have a field name + reader.Ensure(TokenKind.String, "Expected field name"); + + var field = ReadField(); + + jsonObject.Add(field.Key, field.Value); + } + + reader.Next(); // Read '}' (Object end) + + return jsonObject; + } + + + // TODO: Use ValueTuple in C#7 + private KeyValuePair ReadField() + { + var fieldName = reader.Current.Value; + + reader.Next(); // Read the field name + + reader.Ensure(TokenKind.Colon, "field"); + + reader.Next(); // Read ':' (Field value indicator) + + return new KeyValuePair(fieldName, ReadFieldValue()); + } + + + internal JsonArray ReadArray() + { + reader.Ensure(TokenKind.LeftBracket, "array"); + + var array = new XNodeArray(); + + reader.Next(); // Read the '[' (Array start) + + // Read the array's items + while (reader.Current.Kind != TokenKind.RightBracket) + { + if (reader.Current.Kind == TokenKind.Comma) + { + reader.Next(); // Read the ',' (Seperator) + } + + if (reader.Current.IsLiteral) + { + array.Add(ReadLiteral()); // Boolean, Date, Number, Null, String, Uri + } + else if (reader.Current.Kind == TokenKind.LeftBracket) + { + array.Add(ReadArray()); // Array + } + else if (reader.Current.Kind == TokenKind.LeftBrace) + { + array.Add(ReadObject()); // Object + } + else + { + throw new ParserException($"Expected comma, literal, or object. Was {reader.Current}."); + } + } + + reader.Next(); // Read the ']' (Array end) + + return array; + } + + #region IDisposable + + public void Dispose() + { + reader.Dispose(); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Parser/JsonToken.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Parser/JsonToken.cs new file mode 100644 index 000000000000..855a621e38c6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Parser/JsonToken.cs @@ -0,0 +1,66 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal enum TokenKind + { + LeftBrace, // { Object start + RightBrace, // } Object end + + LeftBracket, // [ Array start + RightBracket, // ] Array end + + Comma, // , Comma + Colon, // : Value indicator + Dot, // . Access field indicator + Terminator, // \0 Stream terminator + + Boolean = 31, // true or false + Null = 33, // null + Number = 34, // i.e. -1.93, -1, 0, 1, 1.1 + String = 35, // i.e. "text" + + Eof = 50 + } + + internal /* readonly */ struct JsonToken + { + internal static readonly JsonToken BraceOpen = new JsonToken(TokenKind.LeftBrace, "{"); + internal static readonly JsonToken BraceClose = new JsonToken(TokenKind.RightBrace, "}"); + + internal static readonly JsonToken BracketOpen = new JsonToken(TokenKind.LeftBracket, "["); + internal static readonly JsonToken BracketClose = new JsonToken(TokenKind.RightBracket, "]"); + + internal static readonly JsonToken Colon = new JsonToken(TokenKind.Colon, ":"); + internal static readonly JsonToken Comma = new JsonToken(TokenKind.Comma, ","); + internal static readonly JsonToken Terminator = new JsonToken(TokenKind.Terminator, "\0"); + + internal static readonly JsonToken True = new JsonToken(TokenKind.Boolean, "true"); + internal static readonly JsonToken False = new JsonToken(TokenKind.Boolean, "false"); + internal static readonly JsonToken Null = new JsonToken(TokenKind.Null, "null"); + + internal static readonly JsonToken Eof = new JsonToken(TokenKind.Eof, null); + + internal JsonToken(TokenKind kind, string value) + { + Kind = kind; + Value = value; + } + + internal readonly TokenKind Kind; + + internal readonly string Value; + + public override string ToString() => Kind + ": " + Value; + + #region Helpers + + internal bool IsLiteral => (byte)Kind > 30 && (byte)Kind < 40; + + internal bool IsTerminator => Kind == TokenKind.Terminator; + + #endregion + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Parser/JsonTokenizer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Parser/JsonTokenizer.cs new file mode 100644 index 000000000000..21cb01f44428 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Parser/JsonTokenizer.cs @@ -0,0 +1,177 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + using System.IO; + + + public class JsonTokenizer : IDisposable + { + private readonly StringBuilder sb = new StringBuilder(); + + private readonly SourceReader reader; + + internal JsonTokenizer(TextReader reader) + : this(new SourceReader(reader)) { } + + internal JsonTokenizer(SourceReader reader) + { + this.reader = reader; + + reader.Next(); // Start with the first char + } + + internal JsonToken ReadNext() + { + reader.SkipWhitespace(); + + if (reader.IsEof) return JsonToken.Eof; + + switch (reader.Current) + { + case '"': return ReadQuotedString(); + + // Symbols + case '[' : reader.Next(); return JsonToken.BracketOpen; // Array start + case ']' : reader.Next(); return JsonToken.BracketClose; // Array end + case ',' : reader.Next(); return JsonToken.Comma; // Value seperator + case ':' : reader.Next(); return JsonToken.Colon; // Field value indicator + case '{' : reader.Next(); return JsonToken.BraceOpen; // Object start + case '}' : reader.Next(); return JsonToken.BraceClose; // Object end + case '\0' : reader.Next(); return JsonToken.Terminator; // Stream terminiator + + default: return ReadLiteral(); + } + } + + private JsonToken ReadQuotedString() + { + Expect('"', "quoted string indicator"); + + reader.Next(); // Read '"' (Starting quote) + + // Read until we reach an unescaped quote char + while (reader.Current != '"') + { + EnsureNotEof("quoted string"); + + if (reader.Current == '\\') + { + char escapedCharacter = reader.ReadEscapeCode(); + + sb.Append(escapedCharacter); + + continue; + } + + StoreCurrentCharacterAndReadNext(); + } + + reader.Next(); // Read '"' (Ending quote) + + return new JsonToken(TokenKind.String, value: sb.Extract()); + } + + private JsonToken ReadLiteral() + { + if (char.IsDigit(reader.Current) || + reader.Current == '-' || + reader.Current == '+') + { + return ReadNumber(); + } + + return ReadIdentifer(); + } + + private JsonToken ReadNumber() + { + // Read until we hit a non-numeric character + // -6.247737e-06 + // E + + while (char.IsDigit(reader.Current) + || reader.Current == '.' + || reader.Current == 'e' + || reader.Current == 'E' + || reader.Current == '-' + || reader.Current == '+') + { + StoreCurrentCharacterAndReadNext(); + } + + return new JsonToken(TokenKind.Number, value: sb.Extract()); + } + + int count = 0; + + private JsonToken ReadIdentifer() + { + count++; + + if (!char.IsLetter(reader.Current)) + { + throw new ParserException( + message : $"Expected literal (number, boolean, or null). Was '{reader.Current}'.", + location : reader.Location + ); + } + + // Read letters, numbers, and underscores '_' + while (char.IsLetterOrDigit(reader.Current) || reader.Current == '_') + { + StoreCurrentCharacterAndReadNext(); + } + + string text = sb.Extract(); + + switch (text) + { + case "true": return JsonToken.True; + case "false": return JsonToken.False; + case "null": return JsonToken.Null; + + default: return new JsonToken(TokenKind.String, text); + } + } + + private void Expect(char character, string description) + { + if (reader.Current != character) + { + throw new ParserException( + message: $"Expected {description} ('{character}'). Was '{reader.Current}'.", + location: reader.Location + ); + } + } + + private void EnsureNotEof(string tokenType) + { + if (reader.IsEof) + { + throw new ParserException( + message: $"Unexpected EOF while reading {tokenType}.", + location: reader.Location + ); + } + } + + private void StoreCurrentCharacterAndReadNext() + { + sb.Append(reader.Current); + + reader.Next(); + } + + public void Dispose() + { + reader.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Parser/Location.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Parser/Location.cs new file mode 100644 index 000000000000..d84aea31ddbf --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Parser/Location.cs @@ -0,0 +1,43 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal struct SourceLocation + { + private int line; + private int column; + private int position; + + internal SourceLocation(int line = 0, int column = 0, int position = 0) + { + this.line = line; + this.column = column; + this.position = position; + } + + internal int Line => line; + + internal int Column => column; + + internal int Position => position; + + internal void Advance() + { + this.column++; + this.position++; + } + + internal void MarkNewLine() + { + this.line++; + this.column = 0; + } + + internal SourceLocation Clone() + { + return new SourceLocation(line, column, position); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Parser/Readers/SourceReader.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Parser/Readers/SourceReader.cs new file mode 100644 index 000000000000..da8dada9e3be --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Parser/Readers/SourceReader.cs @@ -0,0 +1,130 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Globalization; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public sealed class SourceReader : IDisposable + { + private readonly TextReader source; + + private char current; + + private readonly SourceLocation location = new SourceLocation(); + + private bool isEof = false; + + internal SourceReader(TextReader textReader) + { + this.source = textReader ?? throw new ArgumentNullException(nameof(textReader)); + } + + /// + /// Advances to the next character + /// + internal void Next() + { + // Advance to the new line when we see a new line '\n'. + // A new line may be prefixed by a carriage return '\r'. + + if (current == '\n') + { + location.MarkNewLine(); + } + + int charCode = source.Read(); // -1 for end + + if (charCode >= 0) + { + current = (char)charCode; + } + else + { + // If we've already marked this as the EOF, throw an exception + if (isEof) + { + throw new EndOfStreamException("Cannot advance past end of stream."); + } + + isEof = true; + + current = '\0'; + } + + location.Advance(); + } + + internal void SkipWhitespace() + { + while (char.IsWhiteSpace(current)) + { + Next(); + } + } + + internal char ReadEscapeCode() + { + Next(); + + char escapedChar = current; + + Next(); // Consume escaped character + + switch (escapedChar) + { + // Special escape codes + case '"': return '"'; // " (Quotation mark) U+0022 + case '/': return '/'; // / (Solidus) U+002F + case '\\': return '\\'; // \ (Reverse solidus) U+005C + + // Control Characters + case '0': return '\0'; // Nul (0) U+0000 + case 'a': return '\a'; // Alert (7) + case 'b': return '\b'; // Backspace (8) U+0008 + case 'f': return '\f'; // Form feed (12) U+000C + case 'n': return '\n'; // Line feed (10) U+000A + case 'r': return '\r'; // Carriage return (13) U+000D + case 't': return '\t'; // Horizontal tab (9) U+0009 + case 'v': return '\v'; // Vertical tab + + // Unicode escape sequence + case 'u': return ReadUnicodeEscapeSequence(); // U+XXXX + + default: throw new Exception($"Unrecognized escape sequence '\\{escapedChar}'"); + } + } + + private readonly char[] hexCode = new char[4]; + + private char ReadUnicodeEscapeSequence() + { + hexCode[0] = current; Next(); + hexCode[1] = current; Next(); + hexCode[2] = current; Next(); + hexCode[3] = current; Next(); + + return Convert.ToChar(int.Parse( + s : new string(hexCode), + style : NumberStyles.HexNumber, + provider: NumberFormatInfo.InvariantInfo + )); + } + + internal char Current => current; + + internal bool IsEof => isEof; + + internal char Peek() => (char)source.Peek(); + + internal SourceLocation Location => location; + + public void Dispose() + { + source.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Parser/TokenReader.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Parser/TokenReader.cs new file mode 100644 index 000000000000..f04cd3857c57 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Parser/TokenReader.cs @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + public class TokenReader : IDisposable + { + private readonly JsonTokenizer tokenizer; + private JsonToken current; + + internal TokenReader(JsonTokenizer tokenizer) + { + this.tokenizer = tokenizer ?? throw new ArgumentNullException(nameof(tokenizer)); + } + + internal void Next() + { + current = tokenizer.ReadNext(); + } + + internal JsonToken Current => current; + + internal void Ensure(TokenKind kind, string readerName) + { + if (current.Kind != kind) + { + throw new ParserException($"Expected {kind} while reading {readerName}). Was {current}."); + } + } + + public void Dispose() + { + tokenizer.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/PipelineMocking.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/PipelineMocking.cs new file mode 100644 index 000000000000..851665d3a133 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/PipelineMocking.cs @@ -0,0 +1,262 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + using System.Threading.Tasks; + using System.Collections.Generic; + using System.Net.Http; + using System.Linq; + using System.Net; + using Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json; + + public enum MockMode + { + Live, + Record, + Playback, + + } + + public class PipelineMock + { + + private System.Collections.Generic.Stack scenario = new System.Collections.Generic.Stack(); + private System.Collections.Generic.Stack context = new System.Collections.Generic.Stack(); + private System.Collections.Generic.Stack description = new System.Collections.Generic.Stack(); + + private readonly string recordingPath; + private int counter = 0; + + public static implicit operator Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep(PipelineMock instance) => instance.SendAsync; + + public MockMode Mode { get; set; } = MockMode.Live; + public PipelineMock(string recordingPath) + { + this.recordingPath = recordingPath; + } + + public void PushContext(string text) => context.Push(text); + + public void PushDescription(string text) => description.Push(text); + + + public void PushScenario(string it) + { + // reset counter too + counter = 0; + + scenario.Push(it); + } + + public void PopContext() => context.Pop(); + + public void PopDescription() => description.Pop(); + + public void PopScenario() => scenario.Pop(); + + public void SetRecord() => Mode = MockMode.Record; + + public void SetPlayback() => Mode = MockMode.Playback; + + public void SetLive() => Mode = MockMode.Live; + + public string Scenario => (scenario.Count > 0 ? scenario.Peek() : "[NoScenario]"); + public string Description => (description.Count > 0 ? description.Peek() : "[NoDescription]"); + public string Context => (context.Count > 0 ? context.Peek() : "[NoContext]"); + + /// + /// Headers that we substitute out blank values for in the recordings + /// Add additional headers as necessary + /// + public static HashSet Blacklist = new HashSet(System.StringComparer.CurrentCultureIgnoreCase) { + "Authorization", + }; + + public Dictionary ForceResponseHeaders = new Dictionary(); + + internal static XImmutableArray Removed = new XImmutableArray(new string[] { "[Filtered]" }); + + internal static IEnumerable> FilterHeaders(IEnumerable>> headers) => headers.Select(header => new KeyValuePair(header.Key, Blacklist.Contains(header.Key) ? Removed : new XImmutableArray(header.Value.ToArray()))); + + internal static JsonNode SerializeContent(HttpContent content, ref bool isBase64) => content == null ? XNull.Instance : SerializeContent(content.ReadAsByteArrayAsync().Result, ref isBase64); + + internal static JsonNode SerializeContent(byte[] content, ref bool isBase64) + { + if (null == content || content.Length == 0) + { + return XNull.Instance; + } + var first = content[0]; + var last = content[content.Length - 1]; + + // plaintext for JSON/SGML/XML/HTML/STRINGS/ARRAYS + if ((first == '{' && last == '}') || (first == '<' && last == '>') || (first == '[' && last == ']') || (first == '"' && last == '"')) + { + return new JsonString(System.Text.Encoding.UTF8.GetString(content)); + } + + // base64 for everyone else + return new JsonString(System.Convert.ToBase64String(content)); + } + + internal static byte[] DeserializeContent(string content, bool isBase64) + { + if (string.IsNullOrWhiteSpace(content)) + { + return new byte[0]; + } + + if (isBase64) + { + try + { + return System.Convert.FromBase64String(content); + } + catch + { + // hmm. didn't work, return it as a string I guess. + } + } + return System.Text.Encoding.UTF8.GetBytes(content); + } + + public void SaveMessage(string rqKey, HttpRequestMessage request, HttpResponseMessage response) + { + var messages = System.IO.File.Exists(this.recordingPath) ? Load() : new JsonObject() ?? new JsonObject(); + bool isBase64Request = false; + bool isBase64Response = false; + messages[rqKey] = new JsonObject { + { "Request",new JsonObject { + { "Method", request.Method.Method }, + { "RequestUri", request.RequestUri }, + { "Content", SerializeContent( request.Content, ref isBase64Request) }, + { "isContentBase64", isBase64Request }, + { "Headers", new JsonObject(FilterHeaders(request.Headers)) }, + { "ContentHeaders", request.Content == null ? new JsonObject() : new JsonObject(FilterHeaders(request.Content.Headers))} + } }, + {"Response", new JsonObject { + { "StatusCode", (int)response.StatusCode}, + { "Headers", new JsonObject(FilterHeaders(response.Headers))}, + { "ContentHeaders", new JsonObject(FilterHeaders(response.Content.Headers))}, + { "Content", SerializeContent(response.Content, ref isBase64Response) }, + { "isContentBase64", isBase64Response }, + }} + }; + System.IO.File.WriteAllText(this.recordingPath, messages.ToString()); + } + + private JsonObject Load() + { + if (System.IO.File.Exists(this.recordingPath)) + { + try + { + return JsonObject.FromStream(System.IO.File.OpenRead(this.recordingPath)); + } + catch + { + throw new System.Exception($"Invalid recording file: '{recordingPath}'"); + } + } + + throw new System.ArgumentException($"Missing recording file: '{recordingPath}'", nameof(recordingPath)); + } + + public HttpResponseMessage LoadMessage(string rqKey) + { + var responses = Load(); + var message = responses.Property(rqKey); + + if (null == message) + { + throw new System.ArgumentException($"Missing Request '{rqKey}' in recording file", nameof(rqKey)); + } + + var sc = 0; + var reqMessage = message.Property("Request"); + var respMessage = message.Property("Response"); + + // --------------------------- deserialize response ---------------------------------------------------------------- + bool isBase64Response = false; + respMessage.BooleanProperty("isContentBase64", ref isBase64Response); + var response = new HttpResponseMessage + { + StatusCode = (HttpStatusCode)respMessage.NumberProperty("StatusCode", ref sc), + Content = new System.Net.Http.ByteArrayContent(DeserializeContent(respMessage.StringProperty("Content"), isBase64Response)) + }; + + foreach (var each in respMessage.Property("Headers")) + { + response.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + foreach (var frh in ForceResponseHeaders) + { + response.Headers.Remove(frh.Key); + response.Headers.TryAddWithoutValidation(frh.Key, frh.Value); + } + + foreach (var each in respMessage.Property("ContentHeaders")) + { + response.Content.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + // --------------------------- deserialize request ---------------------------------------------------------------- + bool isBase64Request = false; + reqMessage.BooleanProperty("isContentBase64", ref isBase64Request); + response.RequestMessage = new HttpRequestMessage + { + Method = new HttpMethod(reqMessage.StringProperty("Method")), + RequestUri = new System.Uri(reqMessage.StringProperty("RequestUri")), + Content = new System.Net.Http.ByteArrayContent(DeserializeContent(reqMessage.StringProperty("Content"), isBase64Request)) + }; + + foreach (var each in reqMessage.Property("Headers")) + { + response.RequestMessage.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + foreach (var each in reqMessage.Property("ContentHeaders")) + { + response.RequestMessage.Content.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + return response; + } + + public async Task SendAsync(HttpRequestMessage request, IEventListener callback, ISendAsync next) + { + counter++; + var rqkey = $"{Description}+{Context}+{Scenario}+${request.Method.Method}+{request.RequestUri}+{counter}"; + + switch (Mode) + { + case MockMode.Record: + //Add following code since the request.Content will be released after sendAsync + var requestClone = request; + if (requestClone.Content != null) + { + requestClone = await request.CloneWithContent(request.RequestUri, request.Method); + } + // make the call + var response = await next.SendAsync(request, callback); + + // save the message to the recording file + SaveMessage(rqkey, requestClone, response); + + // return the response. + return response; + + case MockMode.Playback: + // load and return the response. + return LoadMessage(rqkey); + + default: + // pass-thru, do nothing + return await next.SendAsync(request, callback); + } + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Properties/Resources.Designer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Properties/Resources.Designer.cs new file mode 100644 index 000000000000..bb797fc6cce5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Properties/Resources.Designer.cs @@ -0,0 +1,5655 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.generated.runtime.Properties +{ + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager + { + get + { + if (object.ReferenceEquals(resourceMan, null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.generated.runtime.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to The remote server returned an error: (401) Unauthorized.. + /// + public static string AccessDeniedExceptionMessage + { + get + { + return ResourceManager.GetString("AccessDeniedExceptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account id doesn't match one in subscription.. + /// + public static string AccountIdDoesntMatchSubscription + { + get + { + return ResourceManager.GetString("AccountIdDoesntMatchSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account needs to be specified. + /// + public static string AccountNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("AccountNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account "{0}" has been added.. + /// + public static string AddAccountAdded + { + get + { + return ResourceManager.GetString("AddAccountAdded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to To switch to a different subscription, please use Select-AzureSubscription.. + /// + public static string AddAccountChangeSubscription + { + get + { + return ResourceManager.GetString("AddAccountChangeSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Skipping external tenant {0}, because you are using a guest or a foreign principal object identity. In order to access this tenant, please run Add-AzureAccount without "-Credential".. + /// + public static string AddAccountNonInteractiveGuestOrFpo + { + get + { + return ResourceManager.GetString("AddAccountNonInteractiveGuestOrFpo", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription "{0}" is selected as the default subscription.. + /// + public static string AddAccountShowDefaultSubscription + { + get + { + return ResourceManager.GetString("AddAccountShowDefaultSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to To view all the subscriptions, please use Get-AzureSubscription.. + /// + public static string AddAccountViewSubscriptions + { + get + { + return ResourceManager.GetString("AddAccountViewSubscriptions", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-On {0} is created successfully.. + /// + public static string AddOnCreatedMessage + { + get + { + return ResourceManager.GetString("AddOnCreatedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-on name {0} is already used.. + /// + public static string AddOnNameAlreadyUsed + { + get + { + return ResourceManager.GetString("AddOnNameAlreadyUsed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-On {0} not found.. + /// + public static string AddOnNotFound + { + get + { + return ResourceManager.GetString("AddOnNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-on {0} is removed successfully.. + /// + public static string AddOnRemovedMessage + { + get + { + return ResourceManager.GetString("AddOnRemovedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-On {0} is updated successfully.. + /// + public static string AddOnUpdatedMessage + { + get + { + return ResourceManager.GetString("AddOnUpdatedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role has been created at {0}\{1}.. + /// + public static string AddRoleMessageCreate + { + get + { + return ResourceManager.GetString("AddRoleMessageCreate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role has been created at {0}\{1}. For easy access to Microsoft Azure services from your application code, install the Microsoft Azure client library for Node.js by running ‘npm install azure’.. + /// + public static string AddRoleMessageCreateNode + { + get + { + return ResourceManager.GetString("AddRoleMessageCreateNode", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role has been created at {0}\{1}. For easy access to Microsoft Azure services from your application code, install the Microsoft Azure client library for PHP by running "pear WindowsAzure/WindowsAzure".. + /// + public static string AddRoleMessageCreatePHP + { + get + { + return ResourceManager.GetString("AddRoleMessageCreatePHP", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to set role permissions. Please give the 'Network Service' user 'Read & execute' and 'Modify' permissions to the role folder, or run PowerShell as an Administrator. + /// + public static string AddRoleMessageInsufficientPermissions + { + get + { + return ResourceManager.GetString("AddRoleMessageInsufficientPermissions", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A role name '{0}' already exists. + /// + public static string AddRoleMessageRoleExists + { + get + { + return ResourceManager.GetString("AddRoleMessageRoleExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Profile {0} already has an endpoint with name {1}. + /// + public static string AddTrafficManagerEndpointFailed + { + get + { + return ResourceManager.GetString("AddTrafficManagerEndpointFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure PowerShell collects usage data in order to improve your experience. + ///The data is anonymous and does not include commandline argument values. + ///The data is collected by Microsoft. + /// + ///Use the Disable-AzDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the Az.Accounts module. To disable data collection: PS > Disable-AzDataCollection. + ///Use the Enable-AzDataCollection cmdlet to turn the feature On. The cmdlet can be found in the Az.Accounts module. To enable [rest of string was truncated]";. + /// + public static string ARMDataCollectionMessage + { + get + { + return ResourceManager.GetString("ARMDataCollectionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [Common.Authentication]: Authenticating for account {0} with single tenant {1}.. + /// + public static string AuthenticatingForSingleTenant + { + get + { + return ResourceManager.GetString("AuthenticatingForSingleTenant", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Windows Azure Powershell\. + /// + public static string AzureDirectory + { + get + { + return ResourceManager.GetString("AzureDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to https://manage.windowsazure.com. + /// + public static string AzurePortalUrl + { + get + { + return ResourceManager.GetString("AzurePortalUrl", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AZURE_PORTAL_URL. + /// + public static string AzurePortalUrlEnv + { + get + { + return ResourceManager.GetString("AzurePortalUrlEnv", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Selected profile must not be null.. + /// + public static string AzureProfileMustNotBeNull + { + get + { + return ResourceManager.GetString("AzureProfileMustNotBeNull", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure SDK\{0}\. + /// + public static string AzureSdkDirectory + { + get + { + return ResourceManager.GetString("AzureSdkDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File '{0}' already exists. Use the -Force parameter to overwrite it.. + /// + public static string AzureVMDscArchiveAlreadyExists + { + get + { + return ResourceManager.GetString("AzureVMDscArchiveAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find configuration data file: {0}. + /// + public static string AzureVMDscCannotFindConfigurationDataFile + { + get + { + return ResourceManager.GetString("AzureVMDscCannotFindConfigurationDataFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Create Archive. + /// + public static string AzureVMDscCreateArchiveAction + { + get + { + return ResourceManager.GetString("AzureVMDscCreateArchiveAction", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The configuration data must be a .psd1 file. + /// + public static string AzureVMDscInvalidConfigurationDataFile + { + get + { + return ResourceManager.GetString("AzureVMDscInvalidConfigurationDataFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Parsing configuration script: {0}. + /// + public static string AzureVMDscParsingConfiguration + { + get + { + return ResourceManager.GetString("AzureVMDscParsingConfiguration", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Storage Blob '{0}' already exists. Use the -Force parameter to overwrite it.. + /// + public static string AzureVMDscStorageBlobAlreadyExists + { + get + { + return ResourceManager.GetString("AzureVMDscStorageBlobAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Upload '{0}'. + /// + public static string AzureVMDscUploadToBlobStorageAction + { + get + { + return ResourceManager.GetString("AzureVMDscUploadToBlobStorageAction", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Execution failed because a background thread could not prompt the user.. + /// + public static string BaseShouldMethodFailureReason + { + get + { + return ResourceManager.GetString("BaseShouldMethodFailureReason", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Base Uri was empty.. + /// + public static string BaseUriEmpty + { + get + { + return ResourceManager.GetString("BaseUriEmpty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} begin processing without ParameterSet.. + /// + public static string BeginProcessingWithoutParameterSetLog + { + get + { + return ResourceManager.GetString("BeginProcessingWithoutParameterSetLog", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} begin processing with ParameterSet '{1}'.. + /// + public static string BeginProcessingWithParameterSetLog + { + get + { + return ResourceManager.GetString("BeginProcessingWithParameterSetLog", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Blob with the name {0} already exists in the account.. + /// + public static string BlobAlreadyExistsInTheAccount + { + get + { + return ResourceManager.GetString("BlobAlreadyExistsInTheAccount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to https://{0}.blob.core.windows.net/. + /// + public static string BlobEndpointUri + { + get + { + return ResourceManager.GetString("BlobEndpointUri", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AZURE_BLOBSTORAGE_TEMPLATE. + /// + public static string BlobEndpointUriEnv + { + get + { + return ResourceManager.GetString("BlobEndpointUriEnv", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The parameter : '{0}' is changing.. + /// + public static string BreakingChangeAttributeParameterChanging + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterChanging", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The parameter : '{0}' is becoming mandatory.. + /// + public static string BreakingChangeAttributeParameterMandatoryNow + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterMandatoryNow", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The parameter : '{0}' is being replaced by parameter : '{1}'.. + /// + public static string BreakingChangeAttributeParameterReplaced + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterReplaced", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The parameter : '{0}' is being replaced by mandatory parameter : '{1}'.. + /// + public static string BreakingChangeAttributeParameterReplacedMandatory + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterReplacedMandatory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The type of the parameter is changing from '{0}' to '{1}'.. + /// + public static string BreakingChangeAttributeParameterTypeChange + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterTypeChange", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Change description : {0} + ///. + /// + public static string BreakingChangesAttributesChangeDescriptionMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesChangeDescriptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The cmdlet is being deprecated. There will be no replacement for it.. + /// + public static string BreakingChangesAttributesCmdLetDeprecationMessageNoReplacement + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetDeprecationMessageNoReplacement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The cmdlet is being deprecated. There will be no replacement for it.. + /// + public static string BreakingChangesAttributesParameterSetDeprecationMessageNoReplacement + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesParameterSetDeprecationMessageNoReplacement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The cmdlet '{0}' is replacing this cmdlet.. + /// + public static string BreakingChangesAttributesCmdLetDeprecationMessageWithReplacement + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetDeprecationMessageWithReplacement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The output type is changing from the existing type :'{0}' to the new type :'{1}'. + /// + public static string BreakingChangesAttributesCmdLetOutputChange1 + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputChange1", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to "The output type '{0}' is changing". + /// + public static string BreakingChangesAttributesCmdLetOutputChange2 + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputChange2", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to + ///- The following properties are being added to the output type : + ///. + /// + public static string BreakingChangesAttributesCmdLetOutputPropertiesAdded + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputPropertiesAdded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to + /// - The following properties in the output type are being deprecated : + ///. + /// + public static string BreakingChangesAttributesCmdLetOutputPropertiesRemoved + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputPropertiesRemoved", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The output type '{0}' is being deprecated without a replacement.. + /// + public static string BreakingChangesAttributesCmdLetOutputTypeDeprecated + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputTypeDeprecated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to - {0} + /// + ///. + /// + public static string BreakingChangesAttributesDeclarationMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesDeclarationMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to - Cmdlet : '{0}' + /// - {1} + ///. + /// + public static string BreakingChangesAttributesDeclarationMessageWithCmdletName + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesDeclarationMessageWithCmdletName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to NOTE : Go to {0} for steps to suppress (and other related information on) the breaking change messages.. + /// + public static string BreakingChangesAttributesFooterMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesFooterMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Breaking changes in the cmdlet '{0}' :. + /// + public static string BreakingChangesAttributesHeaderMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesHeaderMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note : This change will take effect on '{0}' + ///. + /// + public static string BreakingChangesAttributesInEffectByDateMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesInEffectByDateMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note :The change is expected to take effect from version : '{0}' + /// + ///. + /// + public static string BreakingChangesAttributesInEffectByVersion + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesInEffectByVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note :The change is expected to take effect from az version : '{0}' + /// + ///. + /// + public static string BreakingChangesAttributesInEffectByAzVersion + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesInEffectByAzVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ```powershell + ///# Old + ///{0} + /// + ///# New + ///{1} + ///``` + /// + ///. + /// + public static string BreakingChangesAttributesUsageChangeMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesUsageChangeMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cmdlet invocation changes : + /// Old Way : {0} + /// New Way : {1}. + /// + public static string BreakingChangesAttributesUsageChangeMessageConsole + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesUsageChangeMessageConsole", resourceCulture); + } + } + + /// + /// The cmdlet is in experimental stage. The function may not be enabled in current subscription. + /// + public static string ExperimentalCmdletMessage + { + get + { + return ResourceManager.GetString("ExperimentalCmdletMessage", resourceCulture); + } + } + + + + /// + /// Looks up a localized string similar to CACHERUNTIMEURL. + /// + public static string CacheRuntimeUrl + { + get + { + return ResourceManager.GetString("CacheRuntimeUrl", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to cache. + /// + public static string CacheRuntimeValue + { + get + { + return ResourceManager.GetString("CacheRuntimeValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to CacheRuntimeVersion. + /// + public static string CacheRuntimeVersionKey + { + get + { + return ResourceManager.GetString("CacheRuntimeVersionKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Installing caching version {0} for Role '{1}' (the caching version locally installed is: {2}). + /// + public static string CacheVersionWarningText + { + get + { + return ResourceManager.GetString("CacheVersionWarningText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot change built-in environment {0}.. + /// + public static string CannotChangeBuiltinEnvironment + { + get + { + return ResourceManager.GetString("CannotChangeBuiltinEnvironment", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find {0} with name {1}.. + /// + public static string CannotFind + { + get + { + return ResourceManager.GetString("CannotFind", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deployment for service {0} with {1} slot doesn't exist. + /// + public static string CannotFindDeployment + { + get + { + return ResourceManager.GetString("CannotFindDeployment", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Can't find valid Microsoft Azure role in current directory {0}. + /// + public static string CannotFindRole + { + get + { + return ResourceManager.GetString("CannotFindRole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service {0} configuration file (ServiceConfiguration.Cloud.cscfg) is either null or doesn't exist. + /// + public static string CannotFindServiceConfigurationFile + { + get + { + return ResourceManager.GetString("CannotFindServiceConfigurationFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid service path! Cannot locate ServiceDefinition.csdef in current folder or parent folders.. + /// + public static string CannotFindServiceRoot + { + get + { + return ResourceManager.GetString("CannotFindServiceRoot", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription named {0} with id {1} is not currently imported. You must import this subscription before it can be updated.. + /// + public static string CannotUpdateUnknownSubscription + { + get + { + return ResourceManager.GetString("CannotUpdateUnknownSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ManagementCertificate. + /// + public static string CertificateElementName + { + get + { + return ResourceManager.GetString("CertificateElementName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to certificate.pfx. + /// + public static string CertificateFileName + { + get + { + return ResourceManager.GetString("CertificateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Certificate imported into CurrentUser\My\{0}. + /// + public static string CertificateImportedMessage + { + get + { + return ResourceManager.GetString("CertificateImportedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No certificate was found in the certificate store with thumbprint {0}. + /// + public static string CertificateNotFoundInStore + { + get + { + return ResourceManager.GetString("CertificateNotFoundInStore", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Your account does not have access to the private key for certificate {0}. + /// + public static string CertificatePrivateKeyAccessError + { + get + { + return ResourceManager.GetString("CertificatePrivateKeyAccessError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} {1} deployment for {2} service. + /// + public static string ChangeDeploymentStateWaitMessage + { + get + { + return ResourceManager.GetString("ChangeDeploymentStateWaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cloud service {0} is in {1} state.. + /// + public static string ChangeDeploymentStatusCompleteMessage + { + get + { + return ResourceManager.GetString("ChangeDeploymentStatusCompleteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Changing/Removing public environment '{0}' is not allowed.. + /// + public static string ChangePublicEnvironmentMessage + { + get + { + return ResourceManager.GetString("ChangePublicEnvironmentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service {0} is set to value {1}. + /// + public static string ChangeSettingsElementMessage + { + get + { + return ResourceManager.GetString("ChangeSettingsElementMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Changing public environment is not supported.. + /// + public static string ChangingDefaultEnvironmentNotSupported + { + get + { + return ResourceManager.GetString("ChangingDefaultEnvironmentNotSupported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Choose which publish settings file to use:. + /// + public static string ChoosePublishSettingsFile + { + get + { + return ResourceManager.GetString("ChoosePublishSettingsFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel. + /// + public static string ClientDiagnosticLevelName + { + get + { + return ResourceManager.GetString("ClientDiagnosticLevelName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1. + /// + public static string ClientDiagnosticLevelValue + { + get + { + return ResourceManager.GetString("ClientDiagnosticLevelValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to cloud_package.cspkg. + /// + public static string CloudPackageFileName + { + get + { + return ResourceManager.GetString("CloudPackageFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ServiceConfiguration.Cloud.cscfg. + /// + public static string CloudServiceConfigurationFileName + { + get + { + return ResourceManager.GetString("CloudServiceConfigurationFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-ons for {0}. + /// + public static string CloudServiceDescription + { + get + { + return ResourceManager.GetString("CloudServiceDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Communication could not be established. This could be due to an invalid subscription ID. Note that subscription IDs are case sensitive.. + /// + public static string CommunicationCouldNotBeEstablished + { + get + { + return ResourceManager.GetString("CommunicationCouldNotBeEstablished", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Complete. + /// + public static string CompleteMessage + { + get + { + return ResourceManager.GetString("CompleteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to OperationID : '{0}'. + /// + public static string ComputeCloudExceptionOperationIdMessage + { + get + { + return ResourceManager.GetString("ComputeCloudExceptionOperationIdMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to config.json. + /// + public static string ConfigurationFileName + { + get + { + return ResourceManager.GetString("ConfigurationFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to VirtualMachine creation failed.. + /// + public static string CreateFailedErrorMessage + { + get + { + return ResourceManager.GetString("CreateFailedErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creating the website failed. If this is the first website for this subscription, please create it using the management portal instead.. + /// + public static string CreateWebsiteFailed + { + get + { + return ResourceManager.GetString("CreateWebsiteFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core. + /// + public static string DataCacheClientsType + { + get + { + return ResourceManager.GetString("DataCacheClientsType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to //blobcontainer[@datacenter='{0}']. + /// + public static string DatacenterBlobQuery + { + get + { + return ResourceManager.GetString("DatacenterBlobQuery", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft Azure PowerShell Data Collection Confirmation. + /// + public static string DataCollectionActivity + { + get + { + return ResourceManager.GetString("DataCollectionActivity", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You choose not to participate in Microsoft Azure PowerShell data collection.. + /// + public static string DataCollectionConfirmNo + { + get + { + return ResourceManager.GetString("DataCollectionConfirmNo", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This confirmation message will be dismissed in '{0}' second(s).... + /// + public static string DataCollectionConfirmTime + { + get + { + return ResourceManager.GetString("DataCollectionConfirmTime", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You choose to participate in Microsoft Azure PowerShell data collection.. + /// + public static string DataCollectionConfirmYes + { + get + { + return ResourceManager.GetString("DataCollectionConfirmYes", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The setting profile has been saved to the following path '{0}'.. + /// + public static string DataCollectionSaveFileInformation + { + get + { + return ResourceManager.GetString("DataCollectionSaveFileInformation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Setting: {0} as the default and current subscription. To view other subscriptions use Get-AzureSubscription. + /// + public static string DefaultAndCurrentSubscription + { + get + { + return ResourceManager.GetString("DefaultAndCurrentSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to none. + /// + public static string DefaultFileVersion + { + get + { + return ResourceManager.GetString("DefaultFileVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There are no hostnames which could be used for validation.. + /// + public static string DefaultHostnamesValidation + { + get + { + return ResourceManager.GetString("DefaultHostnamesValidation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 8080. + /// + public static string DefaultPort + { + get + { + return ResourceManager.GetString("DefaultPort", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1000. + /// + public static string DefaultRoleCachingInMB + { + get + { + return ResourceManager.GetString("DefaultRoleCachingInMB", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Auto. + /// + public static string DefaultUpgradeMode + { + get + { + return ResourceManager.GetString("DefaultUpgradeMode", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 80. + /// + public static string DefaultWebPort + { + get + { + return ResourceManager.GetString("DefaultWebPort", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Delete. + /// + public static string Delete + { + get + { + return ResourceManager.GetString("Delete", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The {0} slot for service {1} is already in {2} state. + /// + public static string DeploymentAlreadyInState + { + get + { + return ResourceManager.GetString("DeploymentAlreadyInState", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The deployment in {0} slot for service {1} is removed. + /// + public static string DeploymentRemovedMessage + { + get + { + return ResourceManager.GetString("DeploymentRemovedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Plugins.Caching.DiagnosticLevel. + /// + public static string DiagnosticLevelName + { + get + { + return ResourceManager.GetString("DiagnosticLevelName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1. + /// + public static string DiagnosticLevelValue + { + get + { + return ResourceManager.GetString("DiagnosticLevelValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The key to add already exists in the dictionary.. + /// + public static string DictionaryAddAlreadyContainsKey + { + get + { + return ResourceManager.GetString("DictionaryAddAlreadyContainsKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The array index cannot be less than zero.. + /// + public static string DictionaryCopyToArrayIndexLessThanZero + { + get + { + return ResourceManager.GetString("DictionaryCopyToArrayIndexLessThanZero", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The supplied array does not have enough room to contain the copied elements.. + /// + public static string DictionaryCopyToArrayTooShort + { + get + { + return ResourceManager.GetString("DictionaryCopyToArrayTooShort", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided dns {0} doesn't exist. + /// + public static string DnsDoesNotExist + { + get + { + return ResourceManager.GetString("DnsDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft Azure Certificate. + /// + public static string EnableRemoteDesktop_FriendlyCertificateName + { + get + { + return ResourceManager.GetString("EnableRemoteDesktop_FriendlyCertificateName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Endpoint can't be retrieved for storage account. + /// + public static string EndPointNotFoundForBlobStorage + { + get + { + return ResourceManager.GetString("EndPointNotFoundForBlobStorage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} end processing.. + /// + public static string EndProcessingLog + { + get + { + return ResourceManager.GetString("EndProcessingLog", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to To use Active Directory authentication, you must configure the ActiveDirectoryEndpoint, ActiveDirectoryTenantId, and ActiveDirectorServiceEndpointResourceId for environment of '{0}'. You can configure these properties for this environment using the Set-AzureEnvironment cmdlet.. + /// + public static string EnvironmentDoesNotSupportActiveDirectory + { + get + { + return ResourceManager.GetString("EnvironmentDoesNotSupportActiveDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The environment '{0}' already exists.. + /// + public static string EnvironmentExists + { + get + { + return ResourceManager.GetString("EnvironmentExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Environment name doesn't match one in subscription.. + /// + public static string EnvironmentNameDoesntMatchSubscription + { + get + { + return ResourceManager.GetString("EnvironmentNameDoesntMatchSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Environment name needs to be specified.. + /// + public static string EnvironmentNameNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("EnvironmentNameNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Environment needs to be specified.. + /// + public static string EnvironmentNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("EnvironmentNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The environment name '{0}' is not found.. + /// + public static string EnvironmentNotFound + { + get + { + return ResourceManager.GetString("EnvironmentNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to environments.xml. + /// + public static string EnvironmentsFileName + { + get + { + return ResourceManager.GetString("EnvironmentsFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Error creating VirtualMachine. + /// + public static string ErrorCreatingVirtualMachine + { + get + { + return ResourceManager.GetString("ErrorCreatingVirtualMachine", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to download available runtimes for location '{0}'. + /// + public static string ErrorRetrievingRuntimesForLocation + { + get + { + return ResourceManager.GetString("ErrorRetrievingRuntimesForLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Error updating VirtualMachine. + /// + public static string ErrorUpdatingVirtualMachine + { + get + { + return ResourceManager.GetString("ErrorUpdatingVirtualMachine", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Job Id {0} failed. Error: {1}, ExceptionDetails: {2}. + /// + public static string FailedJobErrorMessage + { + get + { + return ResourceManager.GetString("FailedJobErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File path is not valid.. + /// + public static string FilePathIsNotValid + { + get + { + return ResourceManager.GetString("FilePathIsNotValid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The HTTP request was forbidden with client authentication scheme 'Anonymous'.. + /// + public static string FirstPurchaseErrorMessage + { + get + { + return ResourceManager.GetString("FirstPurchaseErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This add-on requires you to purchase the first instance through the Microsoft Azure Portal. Subsequent purchases can be performed through PowerShell.. + /// + public static string FirstPurchaseMessage + { + get + { + return ResourceManager.GetString("FirstPurchaseMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Operation Status:. + /// + public static string GatewayOperationStatus + { + get + { + return ResourceManager.GetString("GatewayOperationStatus", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resources\Scaffolding\General. + /// + public static string GeneralScaffolding + { + get + { + return ResourceManager.GetString("GeneralScaffolding", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Getting all available Microsoft Azure Add-Ons, this may take few minutes.... + /// + public static string GetAllAddOnsWaitMessage + { + get + { + return ResourceManager.GetString("GetAllAddOnsWaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Name{0}Primary Key{0}Seconday Key. + /// + public static string GetStorageKeysHeader + { + get + { + return ResourceManager.GetString("GetStorageKeysHeader", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Git not found. Please install git and place it in your command line path.. + /// + public static string GitNotFound + { + get + { + return ResourceManager.GetString("GitNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not find publish settings. Please run Import-AzurePublishSettingsFile.. + /// + public static string GlobalSettingsManager_Load_PublishSettingsNotFound + { + get + { + return ResourceManager.GetString("GlobalSettingsManager_Load_PublishSettingsNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find the WadCfg end element in the config.. + /// + public static string IaasDiagnosticsBadConfigNoEndWadCfg + { + get + { + return ResourceManager.GetString("IaasDiagnosticsBadConfigNoEndWadCfg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WadCfg start element in the config is not matching the end element.. + /// + public static string IaasDiagnosticsBadConfigNoMatchingWadCfg + { + get + { + return ResourceManager.GetString("IaasDiagnosticsBadConfigNoMatchingWadCfg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find the WadCfg element in the config.. + /// + public static string IaasDiagnosticsBadConfigNoWadCfg + { + get + { + return ResourceManager.GetString("IaasDiagnosticsBadConfigNoWadCfg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to iisnode.dll. + /// + public static string IISNodeDll + { + get + { + return ResourceManager.GetString("IISNodeDll", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to iisnode. + /// + public static string IISNodeEngineKey + { + get + { + return ResourceManager.GetString("IISNodeEngineKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to iisnode-dev\\release\\x64. + /// + public static string IISNodePath + { + get + { + return ResourceManager.GetString("IISNodePath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to iisnode. + /// + public static string IISNodeRuntimeValue + { + get + { + return ResourceManager.GetString("IISNodeRuntimeValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Installing IISNode version {0} in Azure for WebRole '{1}' (the version locally installed is: {2}). + /// + public static string IISNodeVersionWarningText + { + get + { + return ResourceManager.GetString("IISNodeVersionWarningText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Illegal characters in path.. + /// + public static string IllegalPath + { + get + { + return ResourceManager.GetString("IllegalPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Internal Server Error. + /// + public static string InternalServerErrorMessage + { + get + { + return ResourceManager.GetString("InternalServerErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot enable memcach protocol on a cache worker role {0}.. + /// + public static string InvalidCacheRoleName + { + get + { + return ResourceManager.GetString("InvalidCacheRoleName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid certificate format. Publish settings may be corrupted. Use Get-AzurePublishSettingsFile to download updated settings. + /// + public static string InvalidCertificate + { + get + { + return ResourceManager.GetString("InvalidCertificate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid certificate format.. + /// + public static string InvalidCertificateSingle + { + get + { + return ResourceManager.GetString("InvalidCertificateSingle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided configuration path is invalid or doesn't exist. + /// + public static string InvalidConfigPath + { + get + { + return ResourceManager.GetString("InvalidConfigPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The country name is invalid, please use a valid two character country code, as described in ISO 3166-1 alpha-2.. + /// + public static string InvalidCountryNameMessage + { + get + { + return ResourceManager.GetString("InvalidCountryNameMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName> to set the default subscription.. + /// + public static string InvalidDefaultSubscription + { + get + { + return ResourceManager.GetString("InvalidDefaultSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deployment with {0} does not exist. + /// + public static string InvalidDeployment + { + get + { + return ResourceManager.GetString("InvalidDeployment", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The deployment slot name {0} is invalid. Slot name must be either "Staging" or "Production".. + /// + public static string InvalidDeploymentSlot + { + get + { + return ResourceManager.GetString("InvalidDeploymentSlot", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to "{0}" is an invalid DNS name for {1}. + /// + public static string InvalidDnsName + { + get + { + return ResourceManager.GetString("InvalidDnsName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid service endpoint.. + /// + public static string InvalidEndpoint + { + get + { + return ResourceManager.GetString("InvalidEndpoint", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided file in {0} must be have {1} extension. + /// + public static string InvalidFileExtension + { + get + { + return ResourceManager.GetString("InvalidFileExtension", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File {0} has invalid characters. + /// + public static string InvalidFileName + { + get + { + return ResourceManager.GetString("InvalidFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You must create your git publishing credentials using the Microsoft Azure portal. + ///Please follow these steps in the portal: + ///1. On the left side open "Web Sites" + ///2. Click on any website + ///3. Choose "Setup Git Publishing" or "Reset deployment credentials" + ///4. Back in the PowerShell window, rerun this command by typing "New-AzureWebSite {site name} -Git -PublishingUsername {username}. + /// + public static string InvalidGitCredentials + { + get + { + return ResourceManager.GetString("InvalidGitCredentials", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The value {0} provided is not a valid GUID. Please provide a valid GUID.. + /// + public static string InvalidGuid + { + get + { + return ResourceManager.GetString("InvalidGuid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The specified hostname does not exist. Please specify a valid hostname for the site.. + /// + public static string InvalidHostnameValidation + { + get + { + return ResourceManager.GetString("InvalidHostnameValidation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role {0} instances must be greater than or equal 0 and less than or equal 20. + /// + public static string InvalidInstancesCount + { + get + { + return ResourceManager.GetString("InvalidInstancesCount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There was an error creating your webjob. Please make sure that the script is in the root folder of the zip file.. + /// + public static string InvalidJobFile + { + get + { + return ResourceManager.GetString("InvalidJobFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not download a valid runtime manifest, Please check your internet connection and try again.. + /// + public static string InvalidManifestError + { + get + { + return ResourceManager.GetString("InvalidManifestError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The account {0} was not found. Please specify a valid account name.. + /// + public static string InvalidMediaServicesAccount + { + get + { + return ResourceManager.GetString("InvalidMediaServicesAccount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided name "{0}" does not match the service bus namespace naming rules.. + /// + public static string InvalidNamespaceName + { + get + { + return ResourceManager.GetString("InvalidNamespaceName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path must specify a valid path to an Azure profile.. + /// + public static string InvalidNewProfilePath + { + get + { + return ResourceManager.GetString("InvalidNewProfilePath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Value cannot be null. Parameter name: '{0}'. + /// + public static string InvalidNullArgument + { + get + { + return ResourceManager.GetString("InvalidNullArgument", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} is invalid or empty. + /// + public static string InvalidOrEmptyArgumentMessage + { + get + { + return ResourceManager.GetString("InvalidOrEmptyArgumentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided package path is invalid or doesn't exist. + /// + public static string InvalidPackagePath + { + get + { + return ResourceManager.GetString("InvalidPackagePath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to '{0}' is an invalid parameter set name.. + /// + public static string InvalidParameterSetName + { + get + { + return ResourceManager.GetString("InvalidParameterSetName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} doesn't exist in {1} or you've not passed valid value for it. + /// + public static string InvalidPath + { + get + { + return ResourceManager.GetString("InvalidPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path {0} has invalid characters. + /// + public static string InvalidPathName + { + get + { + return ResourceManager.GetString("InvalidPathName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Property bag Hashtable must contain one of the following sets of properties: {SubscriptionId, Certificate}, {SubscriptionId, Username, Password}, {SubscriptionId, ServicePrincipal, Password, Tenant}, {SubscriptionId, AccountId, Token}. + /// + public static string InvalidProfileProperties + { + get + { + return ResourceManager.GetString("InvalidProfileProperties", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided publish settings file {0} has invalid content. Please get valid by running cmdlet Get-AzurePublishSettingsFile. + /// + public static string InvalidPublishSettingsSchema + { + get + { + return ResourceManager.GetString("InvalidPublishSettingsSchema", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided role name "{0}" has invalid characters. + /// + public static string InvalidRoleNameMessage + { + get + { + return ResourceManager.GetString("InvalidRoleNameMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A valid name for the service root folder is required. + /// + public static string InvalidRootNameMessage + { + get + { + return ResourceManager.GetString("InvalidRootNameMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} is not a recognized runtime type. + /// + public static string InvalidRuntimeError + { + get + { + return ResourceManager.GetString("InvalidRuntimeError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A valid language is required. + /// + public static string InvalidScaffoldingLanguageArg + { + get + { + return ResourceManager.GetString("InvalidScaffoldingLanguageArg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No subscription is currently selected. Use Select-Subscription to activate a subscription.. + /// + public static string InvalidSelectedSubscription + { + get + { + return ResourceManager.GetString("InvalidSelectedSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided location "{0}" does not exist in the available locations use Get-AzureSBLocation for listing available locations.. + /// + public static string InvalidServiceBusLocation + { + get + { + return ResourceManager.GetString("InvalidServiceBusLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please provide a service name or run this command from inside a service project directory.. + /// + public static string InvalidServiceName + { + get + { + return ResourceManager.GetString("InvalidServiceName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You must provide valid value for {0}. + /// + public static string InvalidServiceSettingElement + { + get + { + return ResourceManager.GetString("InvalidServiceSettingElement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to settings.json is invalid or doesn't exist. + /// + public static string InvalidServiceSettingMessage + { + get + { + return ResourceManager.GetString("InvalidServiceSettingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription named '{0}' cannot be found. Use Set-AzureSubscription to initialize the subscription data.. + /// + public static string InvalidSubscription + { + get + { + return ResourceManager.GetString("InvalidSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided subscription id {0} is not valid. + /// + public static string InvalidSubscriptionId + { + get + { + return ResourceManager.GetString("InvalidSubscriptionId", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Must specify a non-null subscription name.. + /// + public static string InvalidSubscriptionName + { + get + { + return ResourceManager.GetString("InvalidSubscriptionName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A valid subscription name is required. This can be provided using the -Subscription parameter or by setting the subscription via the Set-AzureSubscription cmdlet. + /// + public static string InvalidSubscriptionNameMessage + { + get + { + return ResourceManager.GetString("InvalidSubscriptionNameMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided subscriptions file {0} has invalid content.. + /// + public static string InvalidSubscriptionsDataSchema + { + get + { + return ResourceManager.GetString("InvalidSubscriptionsDataSchema", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role {0} VM size should be ExtraSmall, Small, Medium, Large or ExtraLarge.. + /// + public static string InvalidVMSize + { + get + { + return ResourceManager.GetString("InvalidVMSize", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The web job file must have *.zip extension. + /// + public static string InvalidWebJobFile + { + get + { + return ResourceManager.GetString("InvalidWebJobFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Singleton option works for continuous jobs only.. + /// + public static string InvalidWebJobSingleton + { + get + { + return ResourceManager.GetString("InvalidWebJobSingleton", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The website {0} was not found. Please specify a valid website name.. + /// + public static string InvalidWebsite + { + get + { + return ResourceManager.GetString("InvalidWebsite", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No job for id: {0} was found.. + /// + public static string JobNotFound + { + get + { + return ResourceManager.GetString("JobNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to engines. + /// + public static string JsonEnginesSectionName + { + get + { + return ResourceManager.GetString("JsonEnginesSectionName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Scaffolding for this language is not yet supported. + /// + public static string LanguageScaffoldingIsNotSupported + { + get + { + return ResourceManager.GetString("LanguageScaffoldingIsNotSupported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Link already established. + /// + public static string LinkAlreadyEstablished + { + get + { + return ResourceManager.GetString("LinkAlreadyEstablished", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to local_package.csx. + /// + public static string LocalPackageFileName + { + get + { + return ResourceManager.GetString("LocalPackageFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ServiceConfiguration.Local.cscfg. + /// + public static string LocalServiceConfigurationFileName + { + get + { + return ResourceManager.GetString("LocalServiceConfigurationFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Looking for {0} deployment for {1} cloud service.... + /// + public static string LookingForDeploymentMessage + { + get + { + return ResourceManager.GetString("LookingForDeploymentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Looking for cloud service {0}.... + /// + public static string LookingForServiceMessage + { + get + { + return ResourceManager.GetString("LookingForServiceMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure Long-Running Job. + /// + public static string LROJobName + { + get + { + return ResourceManager.GetString("LROJobName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The cmdlet failed in background execution. The returned error was '{0}'. Please execute the cmdlet again. You may need to execute this cmdlet synchronously, by omitting the '-AsJob' parameter.. + /// + public static string LROTaskExceptionMessage + { + get + { + return ResourceManager.GetString("LROTaskExceptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to managementCertificate.pem. + /// + public static string ManagementCertificateFileName + { + get + { + return ResourceManager.GetString("ManagementCertificateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ?whr={0}. + /// + public static string ManagementPortalRealmFormat + { + get + { + return ResourceManager.GetString("ManagementPortalRealmFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to //baseuri. + /// + public static string ManifestBaseUriQuery + { + get + { + return ResourceManager.GetString("ManifestBaseUriQuery", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to uri. + /// + public static string ManifestBlobUriKey + { + get + { + return ResourceManager.GetString("ManifestBlobUriKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to http://az413943.vo.msecnd.net/node/runtimemanifest_0.7.5.2.xml. + /// + public static string ManifestUri + { + get + { + return ResourceManager.GetString("ManifestUri", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Property bag Hashtable must contain a 'Certificate' of type 'X509Certificate2'.. + /// + public static string MissingCertificateInProfileProperties + { + get + { + return ResourceManager.GetString("MissingCertificateInProfileProperties", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Property bag Hashtable must contain a 'Password' with an associated 'Username' or 'ServicePrincipal'.. + /// + public static string MissingPasswordInProfileProperties + { + get + { + return ResourceManager.GetString("MissingPasswordInProfileProperties", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Property bag Hashtable must contain a 'SubscriptionId'.. + /// + public static string MissingSubscriptionInProfileProperties + { + get + { + return ResourceManager.GetString("MissingSubscriptionInProfileProperties", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Multiple Add-Ons found holding name {0}. + /// + public static string MultipleAddOnsFoundMessage + { + get + { + return ResourceManager.GetString("MultipleAddOnsFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Multiple possible publishing users. Please go to the Portal and use the listed deployment user, or click 'set/reset deployment credentials' to set up a new user account, then reurn this cmdlet and specify PublishingUsername.. + /// + public static string MultiplePublishingUsernames + { + get + { + return ResourceManager.GetString("MultiplePublishingUsernames", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The first publish settings file "{0}" is used. If you want to use another file specify the file name.. + /// + public static string MultiplePublishSettingsFilesFoundMessage + { + get + { + return ResourceManager.GetString("MultiplePublishSettingsFilesFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Plugins.Caching.NamedCaches. + /// + public static string NamedCacheSettingName + { + get + { + return ResourceManager.GetString("NamedCacheSettingName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"caches":[{"name":"default","policy":{"eviction":{"type":0},"expiration":{"defaultTTL":10,"isExpirable":true,"type":1},"serverNotification":{"isEnabled":false}},"secondaries":0}]}. + /// + public static string NamedCacheSettingValue + { + get + { + return ResourceManager.GetString("NamedCacheSettingValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A publishing username is required. Please specify one using the argument PublishingUsername.. + /// + public static string NeedPublishingUsernames + { + get + { + return ResourceManager.GetString("NeedPublishingUsernames", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to New Add-On Confirmation. + /// + public static string NewAddOnConformation + { + get + { + return ResourceManager.GetString("NewAddOnConformation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis + ///for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) + ///agree to the {2}'s terms of user and privacy statement at {0} and (c) agree to sharing my + ///contact information with {2}.. + /// + public static string NewMicrosoftAddOnMessage + { + get + { + return ResourceManager.GetString("NewMicrosoftAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Internal Server Error. This could happen because the namespace name is already used or due to an incorrect location name. Use Get-AzureSBLocation cmdlet to list valid names.. + /// + public static string NewNamespaceErrorMessage + { + get + { + return ResourceManager.GetString("NewNamespaceErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis + ///for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) + ///acknowledge the offering is provided by {2}, not Microsoft, and agree to {2}'s terms of + ///use and privacy statement at {0} and (c) agree to sharing my contact information with {2}.. + /// + public static string NewNonMicrosoftAddOnMessage + { + get + { + return ResourceManager.GetString("NewNonMicrosoftAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service has been created at {0}. + /// + public static string NewServiceCreatedMessage + { + get + { + return ResourceManager.GetString("NewServiceCreatedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No. + /// + public static string No + { + get + { + return ResourceManager.GetString("No", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There is no access token cached for subscription {0}, user id {1}. Use the Add-AzureAccount cmdlet to log in again and get a token for this subscription.. + /// + public static string NoCachedToken + { + get + { + return ResourceManager.GetString("NoCachedToken", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The service does not have any cache worker roles, add one first by running cmdlet Add-AzureCacheWorkerRole.. + /// + public static string NoCacheWorkerRoles + { + get + { + return ResourceManager.GetString("NoCacheWorkerRoles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No clouds available. + /// + public static string NoCloudsAvailable + { + get + { + return ResourceManager.GetString("NoCloudsAvailable", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to "There is no current context, please log in using Connect-AzAccount.". + /// + public static string NoCurrentContextForDataCmdlet + { + get + { + return ResourceManager.GetString("NoCurrentContextForDataCmdlet", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to nodejs. + /// + public static string NodeDirectory + { + get + { + return ResourceManager.GetString("NodeDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to node. + /// + public static string NodeEngineKey + { + get + { + return ResourceManager.GetString("NodeEngineKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to node.exe. + /// + public static string NodeExe + { + get + { + return ResourceManager.GetString("NodeExe", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There is no default subscription set, please set a default subscription by running Set-AzureSubscription -Default <subscription name>. + /// + public static string NoDefaultSubscriptionMessage + { + get + { + return ResourceManager.GetString("NoDefaultSubscriptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft SDKs\Azure\Nodejs\Nov2011. + /// + public static string NodeModulesPath + { + get + { + return ResourceManager.GetString("NodeModulesPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to nodejs. + /// + public static string NodeProgramFilesFolderName + { + get + { + return ResourceManager.GetString("NodeProgramFilesFolderName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to node. + /// + public static string NodeRuntimeValue + { + get + { + return ResourceManager.GetString("NodeRuntimeValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resources\Scaffolding\Node. + /// + public static string NodeScaffolding + { + get + { + return ResourceManager.GetString("NodeScaffolding", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Commands.CloudService.ScaffoldingResources.Node. + /// + public static string NodeScaffoldingResources + { + get + { + return ResourceManager.GetString("NodeScaffoldingResources", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Installing Node version {0} in Azure for Role '{1}' (the Node version locally installed is: {2}). + /// + public static string NodeVersionWarningText + { + get + { + return ResourceManager.GetString("NodeVersionWarningText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No, I do not agree. + /// + public static string NoHint + { + get + { + return ResourceManager.GetString("NoHint", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please connect to internet before executing this cmdlet. + /// + public static string NoInternetConnection + { + get + { + return ResourceManager.GetString("NoInternetConnection", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <NONE>. + /// + public static string None + { + get + { + return ResourceManager.GetString("None", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No publish settings files with extension *.publishsettings are found in the directory "{0}".. + /// + public static string NoPublishSettingsFilesFoundMessage + { + get + { + return ResourceManager.GetString("NoPublishSettingsFilesFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There is no subscription associated with account {0}.. + /// + public static string NoSubscriptionAddedMessage + { + get + { + return ResourceManager.GetString("NoSubscriptionAddedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No subscriptions are associated with the logged in account in Azure Service Management (RDFE). This means that the logged in user is not an administrator or co-administrator for any account.\r\nDid you mean to execute Connect-AzAccount?. + /// + public static string NoSubscriptionFoundForTenant + { + get + { + return ResourceManager.GetString("NoSubscriptionFoundForTenant", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to '{0}' must be a cache worker role. Verify that it has proper cache worker role configuration.. + /// + public static string NotCacheWorkerRole + { + get + { + return ResourceManager.GetString("NotCacheWorkerRole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Certificate can't be null.. + /// + public static string NullCertificateMessage + { + get + { + return ResourceManager.GetString("NullCertificateMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} could not be null or empty. + /// + public static string NullObjectMessage + { + get + { + return ResourceManager.GetString("NullObjectMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to add a null RoleSettings to {0}. + /// + public static string NullRoleSettingsMessage + { + get + { + return ResourceManager.GetString("NullRoleSettingsMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to add new role to null service definition. + /// + public static string NullServiceDefinitionMessage + { + get + { + return ResourceManager.GetString("NullServiceDefinitionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The request offer '{0}' is not found.. + /// + public static string OfferNotFoundMessage + { + get + { + return ResourceManager.GetString("OfferNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Operation "{0}" failed on VM with ID: {1}. + /// + public static string OperationFailedErrorMessage + { + get + { + return ResourceManager.GetString("OperationFailedErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The REST operation failed with message '{0}' and error code '{1}'. + /// + public static string OperationFailedMessage + { + get + { + return ResourceManager.GetString("OperationFailedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Job Id {0} did not complete within expected time or it is in Failed/Canceled/Invalid state.. + /// + public static string OperationTimedOutOrError + { + get + { + return ResourceManager.GetString("OperationTimedOutOrError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to package. + /// + public static string Package + { + get + { + return ResourceManager.GetString("Package", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Package is created at service root path {0}.. + /// + public static string PackageCreated + { + get + { + return ResourceManager.GetString("PackageCreated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {{ + /// "author": "", + /// + /// "name": "{0}", + /// "version": "0.0.0", + /// "dependencies":{{}}, + /// "devDependencies":{{}}, + /// "optionalDependencies": {{}}, + /// "engines": {{ + /// "node": "*", + /// "iisnode": "*" + /// }} + /// + ///}} + ///. + /// + public static string PackageJsonDefaultFile + { + get + { + return ResourceManager.GetString("PackageJsonDefaultFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to package.json. + /// + public static string PackageJsonFileName + { + get + { + return ResourceManager.GetString("PackageJsonFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path {0} doesn't exist.. + /// + public static string PathDoesNotExist + { + get + { + return ResourceManager.GetString("PathDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path for {0} doesn't exist in {1}.. + /// + public static string PathDoesNotExistForElement + { + get + { + return ResourceManager.GetString("PathDoesNotExistForElement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A value for the Peer Asn has to be provided.. + /// + public static string PeerAsnRequired + { + get + { + return ResourceManager.GetString("PeerAsnRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 5.4.0. + /// + public static string PHPDefaultRuntimeVersion + { + get + { + return ResourceManager.GetString("PHPDefaultRuntimeVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to php. + /// + public static string PhpRuntimeValue + { + get + { + return ResourceManager.GetString("PhpRuntimeValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resources\Scaffolding\PHP. + /// + public static string PHPScaffolding + { + get + { + return ResourceManager.GetString("PHPScaffolding", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Commands.CloudService.ScaffoldingResources.PHP. + /// + public static string PHPScaffoldingResources + { + get + { + return ResourceManager.GetString("PHPScaffoldingResources", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Installing PHP version {0} for Role '{1}' (the PHP version locally installed is: {2}). + /// + public static string PHPVersionWarningText + { + get + { + return ResourceManager.GetString("PHPVersionWarningText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You must create your first web site using the Microsoft Azure portal. + ///Please follow these steps in the portal: + ///1. At the bottom of the page, click on New > Web Site > Quick Create + ///2. Type {0} in the URL field + ///3. Click on "Create Web Site" + ///4. Once the site has been created, click on the site name + ///5. Click on "Set up Git publishing" or "Reset deployment credentials" and setup a publishing username and password. Use those credentials for all new websites you create.. + /// + public static string PortalInstructions + { + get + { + return ResourceManager.GetString("PortalInstructions", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 6. Back in the console window, rerun this command by typing "New-AzureWebsite <site name> -Git". + /// + public static string PortalInstructionsGit + { + get + { + return ResourceManager.GetString("PortalInstructionsGit", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The estimated generally available date is '{0}'.. + /// + public static string PreviewCmdletETAMessage { + get { + return ResourceManager.GetString("PreviewCmdletETAMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This cmdlet is in preview. Its behavior is subject to change based on customer feedback.. + /// + public static string PreviewCmdletMessage + { + get + { + return ResourceManager.GetString("PreviewCmdletMessage", resourceCulture); + } + } + + + /// + /// Looks up a localized string similar to A value for the Primary Peer Subnet has to be provided.. + /// + public static string PrimaryPeerSubnetRequired + { + get + { + return ResourceManager.GetString("PrimaryPeerSubnetRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Promotion code can be used only when updating to a new plan.. + /// + public static string PromotionCodeWithCurrentPlanMessage + { + get + { + return ResourceManager.GetString("PromotionCodeWithCurrentPlanMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service not published at user request.. + /// + public static string PublishAbortedAtUserRequest + { + get + { + return ResourceManager.GetString("PublishAbortedAtUserRequest", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Complete.. + /// + public static string PublishCompleteMessage + { + get + { + return ResourceManager.GetString("PublishCompleteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Connecting.... + /// + public static string PublishConnectingMessage + { + get + { + return ResourceManager.GetString("PublishConnectingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Created Deployment ID: {0}.. + /// + public static string PublishCreatedDeploymentMessage + { + get + { + return ResourceManager.GetString("PublishCreatedDeploymentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Created hosted service '{0}'.. + /// + public static string PublishCreatedServiceMessage + { + get + { + return ResourceManager.GetString("PublishCreatedServiceMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Created Website URL: {0}.. + /// + public static string PublishCreatedWebsiteMessage + { + get + { + return ResourceManager.GetString("PublishCreatedWebsiteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creating.... + /// + public static string PublishCreatingServiceMessage + { + get + { + return ResourceManager.GetString("PublishCreatingServiceMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Initializing.... + /// + public static string PublishInitializingMessage + { + get + { + return ResourceManager.GetString("PublishInitializingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to busy. + /// + public static string PublishInstanceStatusBusy + { + get + { + return ResourceManager.GetString("PublishInstanceStatusBusy", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to creating the virtual machine. + /// + public static string PublishInstanceStatusCreating + { + get + { + return ResourceManager.GetString("PublishInstanceStatusCreating", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Instance {0} of role {1} is {2}.. + /// + public static string PublishInstanceStatusMessage + { + get + { + return ResourceManager.GetString("PublishInstanceStatusMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ready. + /// + public static string PublishInstanceStatusReady + { + get + { + return ResourceManager.GetString("PublishInstanceStatusReady", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Preparing deployment for {0} with Subscription ID: {1}.... + /// + public static string PublishPreparingDeploymentMessage + { + get + { + return ResourceManager.GetString("PublishPreparingDeploymentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Publishing {0} to Microsoft Azure. This may take several minutes.... + /// + public static string PublishServiceStartMessage + { + get + { + return ResourceManager.GetString("PublishServiceStartMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to publish settings. + /// + public static string PublishSettings + { + get + { + return ResourceManager.GetString("PublishSettings", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure. + /// + public static string PublishSettingsElementName + { + get + { + return ResourceManager.GetString("PublishSettingsElementName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to .PublishSettings. + /// + public static string PublishSettingsFileExtention + { + get + { + return ResourceManager.GetString("PublishSettingsFileExtention", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to publishSettings.xml. + /// + public static string PublishSettingsFileName + { + get + { + return ResourceManager.GetString("PublishSettingsFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to &whr={0}. + /// + public static string PublishSettingsFileRealmFormat + { + get + { + return ResourceManager.GetString("PublishSettingsFileRealmFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Publish settings imported. + /// + public static string PublishSettingsSetSuccessfully + { + get + { + return ResourceManager.GetString("PublishSettingsSetSuccessfully", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AZURE_PUBLISHINGPROFILE_URL. + /// + public static string PublishSettingsUrlEnv + { + get + { + return ResourceManager.GetString("PublishSettingsUrlEnv", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Starting.... + /// + public static string PublishStartingMessage + { + get + { + return ResourceManager.GetString("PublishStartingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Upgrading.... + /// + public static string PublishUpgradingMessage + { + get + { + return ResourceManager.GetString("PublishUpgradingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Uploading Package to storage service {0}.... + /// + public static string PublishUploadingPackageMessage + { + get + { + return ResourceManager.GetString("PublishUploadingPackageMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Verifying storage account '{0}'.... + /// + public static string PublishVerifyingStorageMessage + { + get + { + return ResourceManager.GetString("PublishVerifyingStorageMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path '{0}' not found.. + /// + public static string PublishVMDscExtensionAdditionalContentPathNotExist + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionAdditionalContentPathNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Configuration published to {0}. + /// + public static string PublishVMDscExtensionArchiveUploadedMessage + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionArchiveUploadedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Copy '{0}' to '{1}'.. + /// + public static string PublishVMDscExtensionCopyFileVerbose + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionCopyFileVerbose", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Copy the module '{0}' to '{1}'.. + /// + public static string PublishVMDscExtensionCopyModuleVerbose + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionCopyModuleVerbose", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid configuration file: {0}. + ///The file needs to be a PowerShell script (.ps1 or .psm1).. + /// + public static string PublishVMDscExtensionCreateArchiveConfigFileInvalidExtension + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionCreateArchiveConfigFileInvalidExtension", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deleted '{0}'. + /// + public static string PublishVMDscExtensionDeletedFileMessage + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionDeletedFileMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot delete '{0}': {1}. + /// + public static string PublishVMDscExtensionDeleteErrorMessage + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionDeleteErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path '{0}' not found.. + /// + public static string PublishVMDscExtensionDirectoryNotExist + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionDirectoryNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot get module for DscResource '{0}'. Possible solutions: + ///1) Specify -ModuleName for Import-DscResource in your configuration. + ///2) Unblock module that contains resource. + ///3) Move Import-DscResource inside Node block. + ///. + /// + public static string PublishVMDscExtensionGetDscResourceFailed + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionGetDscResourceFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to List of required modules: [{0}].. + /// + public static string PublishVMDscExtensionRequiredModulesVerbose + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionRequiredModulesVerbose", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Your current PowerShell version {1} is less then required by this cmdlet {0}. Consider download and install latest PowerShell version.. + /// + public static string PublishVMDscExtensionRequiredPsVersion + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionRequiredPsVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Configuration script '{0}' contained parse errors: + ///{1}. + /// + public static string PublishVMDscExtensionStorageParserErrors + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionStorageParserErrors", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Temp folder '{0}' created.. + /// + public static string PublishVMDscExtensionTempFolderVerbose + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionTempFolderVerbose", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid configuration file: {0}. + ///The file needs to be a PowerShell script (.ps1 or .psm1) or a ZIP archive (.zip).. + /// + public static string PublishVMDscExtensionUploadArchiveConfigFileInvalidExtension + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionUploadArchiveConfigFileInvalidExtension", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Configuration file '{0}' not found.. + /// + public static string PublishVMDscExtensionUploadArchiveConfigFileNotExist + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionUploadArchiveConfigFileNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure PowerShell collects usage data in order to improve your experience. + ///The data is anonymous and does not include commandline argument values. + ///The data is collected by Microsoft. + /// + ///Use the Disable-AzureDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the Azure module. To disable data collection: PS > Disable-AzureDataCollection. + ///Use the Enable-AzureDataCollection cmdlet to turn the feature On. The cmdlet can be found in the Azure module. To enable data collection: PS > Enab [rest of string was truncated]";. + /// + public static string RDFEDataCollectionMessage + { + get + { + return ResourceManager.GetString("RDFEDataCollectionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Replace current deployment with '{0}' Id ?. + /// + public static string RedeployCommit + { + get + { + return ResourceManager.GetString("RedeployCommit", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to regenerate key?. + /// + public static string RegenerateKeyWarning + { + get + { + return ResourceManager.GetString("RegenerateKeyWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Generate new key.. + /// + public static string RegenerateKeyWhatIfMessage + { + get + { + return ResourceManager.GetString("RegenerateKeyWhatIfMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove account '{0}'?. + /// + public static string RemoveAccountConfirmation + { + get + { + return ResourceManager.GetString("RemoveAccountConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing account. + /// + public static string RemoveAccountMessage + { + get + { + return ResourceManager.GetString("RemoveAccountMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove Add-On Confirmation. + /// + public static string RemoveAddOnConformation + { + get + { + return ResourceManager.GetString("RemoveAddOnConformation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to If you delete this add-on, your data may be deleted and the operation may not be undone. You may have to purchase it again from the Microsoft Azure Store to use it. The price of the add-on may not be refunded. Are you sure you want to delete this add-on? Enter “Yes” to confirm.. + /// + public static string RemoveAddOnMessage + { + get + { + return ResourceManager.GetString("RemoveAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove-AzureBGPPeering Operation failed.. + /// + public static string RemoveAzureBGPPeeringFailed + { + get + { + return ResourceManager.GetString("RemoveAzureBGPPeeringFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing Bgp Peering. + /// + public static string RemoveAzureBGPPeeringMessage + { + get + { + return ResourceManager.GetString("RemoveAzureBGPPeeringMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully removed Azure Bgp Peering with Service Key {0}.. + /// + public static string RemoveAzureBGPPeeringSucceeded + { + get + { + return ResourceManager.GetString("RemoveAzureBGPPeeringSucceeded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the Bgp Peering with service key '{0}'?. + /// + public static string RemoveAzureBGPPeeringWarning + { + get + { + return ResourceManager.GetString("RemoveAzureBGPPeeringWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the Dedicated Circuit with service key '{0}'?. + /// + public static string RemoveAzureDedicatdCircuitWarning + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatdCircuitWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove-AzureDedicatedCircuit Operation failed.. + /// + public static string RemoveAzureDedicatedCircuitFailed + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove-AzureDedicatedCircuitLink Operation failed.. + /// + public static string RemoveAzureDedicatedCircuitLinkFailed + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitLinkFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing Dedicated Circui Link. + /// + public static string RemoveAzureDedicatedCircuitLinkMessage + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitLinkMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully removed Azure Dedicated Circuit Link with Service Key {0} and Vnet Name {1}. + /// + public static string RemoveAzureDedicatedCircuitLinkSucceeded + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitLinkSucceeded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the Dedicated Circuit Link with service key '{0}' and virtual network name '{1}'?. + /// + public static string RemoveAzureDedicatedCircuitLinkWarning + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitLinkWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing Dedicated Circuit. + /// + public static string RemoveAzureDedicatedCircuitMessage + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully removed Azure Dedicated Circuit with Service Key {0}.. + /// + public static string RemoveAzureDedicatedCircuitSucceeded + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitSucceeded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing cloud service {0}.... + /// + public static string RemoveAzureServiceWaitMessage + { + get + { + return ResourceManager.GetString("RemoveAzureServiceWaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The default subscription is being removed. Use Select-AzureSubscription -Default <subscriptionName> to select a new default subscription.. + /// + public static string RemoveDefaultSubscription + { + get + { + return ResourceManager.GetString("RemoveDefaultSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing {0} deployment for {1} service. + /// + public static string RemoveDeploymentWaitMessage + { + get + { + return ResourceManager.GetString("RemoveDeploymentWaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing an environment will remove all associated subscriptions and accounts. Are you sure you want to remove an environment '{0}'?. + /// + public static string RemoveEnvironmentConfirmation + { + get + { + return ResourceManager.GetString("RemoveEnvironmentConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing environment. + /// + public static string RemoveEnvironmentMessage + { + get + { + return ResourceManager.GetString("RemoveEnvironmentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing job collection. + /// + public static string RemoveJobCollectionMessage + { + get + { + return ResourceManager.GetString("RemoveJobCollectionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the job collection "{0}". + /// + public static string RemoveJobCollectionWarning + { + get + { + return ResourceManager.GetString("RemoveJobCollectionWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing job. + /// + public static string RemoveJobMessage + { + get + { + return ResourceManager.GetString("RemoveJobMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the job "{0}". + /// + public static string RemoveJobWarning + { + get + { + return ResourceManager.GetString("RemoveJobWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the account?. + /// + public static string RemoveMediaAccountWarning + { + get + { + return ResourceManager.GetString("RemoveMediaAccountWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account removed.. + /// + public static string RemoveMediaAccountWhatIfMessage + { + get + { + return ResourceManager.GetString("RemoveMediaAccountWhatIfMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Internal Server Error. This could happen because the namespace does not exist or it does not exist under your subscription.. + /// + public static string RemoveNamespaceErrorMessage + { + get + { + return ResourceManager.GetString("RemoveNamespaceErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing old package {0}.... + /// + public static string RemovePackage + { + get + { + return ResourceManager.GetString("RemovePackage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing the Azure profile will remove all associated environments, subscriptions, and accounts. Are you sure you want to remove the Azure profile?. + /// + public static string RemoveProfileConfirmation + { + get + { + return ResourceManager.GetString("RemoveProfileConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing the Azure profile. + /// + public static string RemoveProfileMessage + { + get + { + return ResourceManager.GetString("RemoveProfileMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to delete the namespace '{0}'?. + /// + public static string RemoveServiceBusNamespaceConfirmation + { + get + { + return ResourceManager.GetString("RemoveServiceBusNamespaceConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove cloud service?. + /// + public static string RemoveServiceWarning + { + get + { + return ResourceManager.GetString("RemoveServiceWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove cloud service and all it's deployments. + /// + public static string RemoveServiceWhatIfMessage + { + get + { + return ResourceManager.GetString("RemoveServiceWhatIfMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove subscription '{0}'?. + /// + public static string RemoveSubscriptionConfirmation + { + get + { + return ResourceManager.GetString("RemoveSubscriptionConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing subscription. + /// + public static string RemoveSubscriptionMessage + { + get + { + return ResourceManager.GetString("RemoveSubscriptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The endpoint {0} cannot be removed from profile {1} because it's not in the profile.. + /// + public static string RemoveTrafficManagerEndpointMissing + { + get + { + return ResourceManager.GetString("RemoveTrafficManagerEndpointMissing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove-AzureTrafficManagerProfile Operation failed.. + /// + public static string RemoveTrafficManagerProfileFailed + { + get + { + return ResourceManager.GetString("RemoveTrafficManagerProfileFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully removed Traffic Manager profile with name {0}.. + /// + public static string RemoveTrafficManagerProfileSucceeded + { + get + { + return ResourceManager.GetString("RemoveTrafficManagerProfileSucceeded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the Traffic Manager profile "{0}"?. + /// + public static string RemoveTrafficManagerProfileWarning + { + get + { + return ResourceManager.GetString("RemoveTrafficManagerProfileWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to delete the VM '{0}'?. + /// + public static string RemoveVMConfirmationMessage + { + get + { + return ResourceManager.GetString("RemoveVMConfirmationMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deleting VM.. + /// + public static string RemoveVMMessage + { + get + { + return ResourceManager.GetString("RemoveVMMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing WebJob.... + /// + public static string RemoveWebJobMessage + { + get + { + return ResourceManager.GetString("RemoveWebJobMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove job '{0}'?. + /// + public static string RemoveWebJobWarning + { + get + { + return ResourceManager.GetString("RemoveWebJobWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing website. + /// + public static string RemoveWebsiteMessage + { + get + { + return ResourceManager.GetString("RemoveWebsiteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the website "{0}". + /// + public static string RemoveWebsiteWarning + { + get + { + return ResourceManager.GetString("RemoveWebsiteWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing public environment is not supported.. + /// + public static string RemovingDefaultEnvironmentsNotSupported + { + get + { + return ResourceManager.GetString("RemovingDefaultEnvironmentsNotSupported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deleting namespace. + /// + public static string RemovingNamespaceMessage + { + get + { + return ResourceManager.GetString("RemovingNamespaceMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Repository is not setup. You need to pass a valid site name.. + /// + public static string RepositoryNotSetup + { + get + { + return ResourceManager.GetString("RepositoryNotSetup", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Reserved IP with the Name:'{0}' will no longer be in use after the deployment is deleted, and it is still reserved for later use.. + /// + public static string ReservedIPNameNoLongerInUseButStillBeingReserved + { + get + { + return ResourceManager.GetString("ReservedIPNameNoLongerInUseButStillBeingReserved", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resource with ID : {0} does not exist.. + /// + public static string ResourceNotFound + { + get + { + return ResourceManager.GetString("ResourceNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Restart. + /// + public static string Restart + { + get + { + return ResourceManager.GetString("Restart", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resume. + /// + public static string Resume + { + get + { + return ResourceManager.GetString("Resume", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to /role:{0};"{1}/{0}" . + /// + public static string RoleArgTemplate + { + get + { + return ResourceManager.GetString("RoleArgTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to bin. + /// + public static string RoleBinFolderName + { + get + { + return ResourceManager.GetString("RoleBinFolderName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role {0} is {1}. + /// + public static string RoleInstanceWaitMsg + { + get + { + return ResourceManager.GetString("RoleInstanceWaitMsg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 20. + /// + public static string RoleMaxInstances + { + get + { + return ResourceManager.GetString("RoleMaxInstances", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to role name. + /// + public static string RoleName + { + get + { + return ResourceManager.GetString("RoleName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided role name {0} doesn't exist. + /// + public static string RoleNotFoundMessage + { + get + { + return ResourceManager.GetString("RoleNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RoleSettings.xml. + /// + public static string RoleSettingsTemplateFileName + { + get + { + return ResourceManager.GetString("RoleSettingsTemplateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role type {0} doesn't exist. + /// + public static string RoleTypeDoesNotExist + { + get + { + return ResourceManager.GetString("RoleTypeDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to public static Dictionary<string, Location> ReverseLocations { get; private set; }. + /// + public static string RuntimeDeploymentLocationError + { + get + { + return ResourceManager.GetString("RuntimeDeploymentLocationError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Preparing runtime deployment for service '{0}'. + /// + public static string RuntimeDeploymentStart + { + get + { + return ResourceManager.GetString("RuntimeDeploymentStart", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WARNING Runtime Mismatch: Are you sure that you want to publish service '{0}' using an Azure runtime version that does not match your local runtime version?. + /// + public static string RuntimeMismatchWarning + { + get + { + return ResourceManager.GetString("RuntimeMismatchWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RUNTIMEOVERRIDEURL. + /// + public static string RuntimeOverrideKey + { + get + { + return ResourceManager.GetString("RuntimeOverrideKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to /runtimemanifest/runtimes/runtime. + /// + public static string RuntimeQuery + { + get + { + return ResourceManager.GetString("RuntimeQuery", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RUNTIMEID. + /// + public static string RuntimeTypeKey + { + get + { + return ResourceManager.GetString("RuntimeTypeKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RUNTIMEURL. + /// + public static string RuntimeUrlKey + { + get + { + return ResourceManager.GetString("RuntimeUrlKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RUNTIMEVERSIONPRIMARYKEY. + /// + public static string RuntimeVersionPrimaryKey + { + get + { + return ResourceManager.GetString("RuntimeVersionPrimaryKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to scaffold.xml. + /// + public static string ScaffoldXml + { + get + { + return ResourceManager.GetString("ScaffoldXml", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid location entered. Pick one of the locations from Get-AzureSchedulerLocation. + /// + public static string SchedulerInvalidLocation + { + get + { + return ResourceManager.GetString("SchedulerInvalidLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A value for the Secondary Peer Subnet has to be provided.. + /// + public static string SecondaryPeerSubnetRequired + { + get + { + return ResourceManager.GetString("SecondaryPeerSubnetRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service {0} already exists on disk in location {1}. + /// + public static string ServiceAlreadyExistsOnDisk + { + get + { + return ResourceManager.GetString("ServiceAlreadyExistsOnDisk", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No ServiceBus authorization rule with the given characteristics was found. + /// + public static string ServiceBusAuthorizationRuleNotFound + { + get + { + return ResourceManager.GetString("ServiceBusAuthorizationRuleNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The service bus entity '{0}' is not found.. + /// + public static string ServiceBusEntityTypeNotFound + { + get + { + return ResourceManager.GetString("ServiceBusEntityTypeNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Internal Server Error. This could happen due to an incorrect/missing namespace. + /// + public static string ServiceBusNamespaceMissingMessage + { + get + { + return ResourceManager.GetString("ServiceBusNamespaceMissingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service configuration. + /// + public static string ServiceConfiguration + { + get + { + return ResourceManager.GetString("ServiceConfiguration", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service definition. + /// + public static string ServiceDefinition + { + get + { + return ResourceManager.GetString("ServiceDefinition", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ServiceDefinition.csdef. + /// + public static string ServiceDefinitionFileName + { + get + { + return ResourceManager.GetString("ServiceDefinitionFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0}Deploy. + /// + public static string ServiceDeploymentName + { + get + { + return ResourceManager.GetString("ServiceDeploymentName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The specified cloud service "{0}" does not exist.. + /// + public static string ServiceDoesNotExist + { + get + { + return ResourceManager.GetString("ServiceDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} slot for service {1} is in {2} state, please wait until it finish and update it's status. + /// + public static string ServiceIsInTransitionState + { + get + { + return ResourceManager.GetString("ServiceIsInTransitionState", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to "An exception occurred when calling the ServiceManagement API. HTTP Status Code: {0}. Service Management Error Code: {1}. Message: {2}. Operation Tracking ID: {3}.". + /// + public static string ServiceManagementClientExceptionStringFormat + { + get + { + return ResourceManager.GetString("ServiceManagementClientExceptionStringFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Begin Operation: {0}. + /// + public static string ServiceManagementExecuteClientActionBeginOperation + { + get + { + return ResourceManager.GetString("ServiceManagementExecuteClientActionBeginOperation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Completed Operation: {0}. + /// + public static string ServiceManagementExecuteClientActionCompletedOperation + { + get + { + return ResourceManager.GetString("ServiceManagementExecuteClientActionCompletedOperation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Begin Operation: {0}. + /// + public static string ServiceManagementExecuteClientActionInOCSBeginOperation + { + get + { + return ResourceManager.GetString("ServiceManagementExecuteClientActionInOCSBeginOperation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Completed Operation: {0}. + /// + public static string ServiceManagementExecuteClientActionInOCSCompletedOperation + { + get + { + return ResourceManager.GetString("ServiceManagementExecuteClientActionInOCSCompletedOperation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service name. + /// + public static string ServiceName + { + get + { + return ResourceManager.GetString("ServiceName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided service name {0} already exists, please pick another name. + /// + public static string ServiceNameExists + { + get + { + return ResourceManager.GetString("ServiceNameExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please provide name for the hosted service. + /// + public static string ServiceNameMissingMessage + { + get + { + return ResourceManager.GetString("ServiceNameMissingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service parent directory. + /// + public static string ServiceParentDirectory + { + get + { + return ResourceManager.GetString("ServiceParentDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service {0} removed successfully. + /// + public static string ServiceRemovedMessage + { + get + { + return ResourceManager.GetString("ServiceRemovedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service directory. + /// + public static string ServiceRoot + { + get + { + return ResourceManager.GetString("ServiceRoot", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service settings. + /// + public static string ServiceSettings + { + get + { + return ResourceManager.GetString("ServiceSettings", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The storage account name '{0}' is invalid. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.. + /// + public static string ServiceSettings_ValidateStorageAccountName_InvalidName + { + get + { + return ResourceManager.GetString("ServiceSettings_ValidateStorageAccountName_InvalidName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The {0} slot for cloud service {1} doesn't exist.. + /// + public static string ServiceSlotDoesNotExist + { + get + { + return ResourceManager.GetString("ServiceSlotDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} slot for service {1} is {2}. + /// + public static string ServiceStatusChanged + { + get + { + return ResourceManager.GetString("ServiceStatusChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Set Add-On Confirmation. + /// + public static string SetAddOnConformation + { + get + { + return ResourceManager.GetString("SetAddOnConformation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Profile {0} does not contain endpoint {1}. Adding it.. + /// + public static string SetInexistentTrafficManagerEndpointMessage + { + get + { + return ResourceManager.GetString("SetInexistentTrafficManagerEndpointMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note - You will be charged the amount for the new plan, without being refunded for time remaining + ///in the existing plan. + ///By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis + ///for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) + ///agree to the {2}'s terms of user and privacy statement at {0} and (c) agree to sharing my + ///contact information with {2}.. + /// + public static string SetMicrosoftAddOnMessage + { + get + { + return ResourceManager.GetString("SetMicrosoftAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note - You will be charged the amount for the new plan, without being refunded for time remaining + ///in the existing plan. + ///By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis + ///for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) + ///acknowledge the offering is provided by {2}, not Microsoft, and agree to {2}'s terms of + ///use and privacy statement at <url> and (c) agree to sharing my contact information with {2}.. + /// + public static string SetNonMicrosoftAddOnMessage + { + get + { + return ResourceManager.GetString("SetNonMicrosoftAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role {0} instances are set to {1}. + /// + public static string SetRoleInstancesMessage + { + get + { + return ResourceManager.GetString("SetRoleInstancesMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"Slot":"","Location":"","Subscription":"","StorageAccountName":""}. + /// + public static string SettingsFileEmptyContent + { + get + { + return ResourceManager.GetString("SettingsFileEmptyContent", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to deploymentSettings.json. + /// + public static string SettingsFileName + { + get + { + return ResourceManager.GetString("SettingsFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Insufficient parameters passed to create a new endpoint.. + /// + public static string SetTrafficManagerEndpointNeedsParameters + { + get + { + return ResourceManager.GetString("SetTrafficManagerEndpointNeedsParameters", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Ambiguous operation: the profile name specified doesn't match the name of the profile object.. + /// + public static string SetTrafficManagerProfileAmbiguous + { + get + { + return ResourceManager.GetString("SetTrafficManagerProfileAmbiguous", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please execute the cmdlet again and include the 'Force' parameter, if available, to avoid unnecessary prompts.. + /// + public static string ShouldContinueFail + { + get + { + return ResourceManager.GetString("ShouldContinueFail", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Confirm. + /// + public static string ShouldProcessCaption + { + get + { + return ResourceManager.GetString("ShouldProcessCaption", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please execute the cmdlet again and omit the 'Confirm' parameter when using the 'AsJob' parameter.. + /// + public static string ShouldProcessFailConfirm + { + get + { + return ResourceManager.GetString("ShouldProcessFailConfirm", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please increase the user $ConfirmPreference setting, or include turn off confirmation using '-Confirm:$false' when using the 'AsJob' parameter and execute the cmdet again.. + /// + public static string ShouldProcessFailImpact + { + get + { + return ResourceManager.GetString("ShouldProcessFailImpact", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please execute the cmdlet again and omit the 'WhatIf' parameter when using the 'AsJob' parameter.. + /// + public static string ShouldProcessFailWhatIf + { + get + { + return ResourceManager.GetString("ShouldProcessFailWhatIf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Shutdown. + /// + public static string Shutdown + { + get + { + return ResourceManager.GetString("Shutdown", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to /sites:{0};{1};"{2}/{0}" . + /// + public static string SitesArgTemplate + { + get + { + return ResourceManager.GetString("SitesArgTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1000. + /// + public static string StandardRetryDelayInMs + { + get + { + return ResourceManager.GetString("StandardRetryDelayInMs", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Start. + /// + public static string Start + { + get + { + return ResourceManager.GetString("Start", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Started. + /// + public static string StartedEmulator + { + get + { + return ResourceManager.GetString("StartedEmulator", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Starting Emulator.... + /// + public static string StartingEmulator + { + get + { + return ResourceManager.GetString("StartingEmulator", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to start. + /// + public static string StartStorageEmulatorCommandArgument + { + get + { + return ResourceManager.GetString("StartStorageEmulatorCommandArgument", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Stop. + /// + public static string Stop + { + get + { + return ResourceManager.GetString("Stop", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Stopping emulator.... + /// + public static string StopEmulatorMessage + { + get + { + return ResourceManager.GetString("StopEmulatorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Stopped. + /// + public static string StoppedEmulatorMessage + { + get + { + return ResourceManager.GetString("StoppedEmulatorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to stop. + /// + public static string StopStorageEmulatorCommandArgument + { + get + { + return ResourceManager.GetString("StopStorageEmulatorCommandArgument", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account Name:. + /// + public static string StorageAccountName + { + get + { + return ResourceManager.GetString("StorageAccountName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find storage account '{0}' please type the name of an existing storage account.. + /// + public static string StorageAccountNotFound + { + get + { + return ResourceManager.GetString("StorageAccountNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AzureStorageEmulator.exe. + /// + public static string StorageEmulatorExe + { + get + { + return ResourceManager.GetString("StorageEmulatorExe", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to InstallPath. + /// + public static string StorageEmulatorInstallPathRegistryKeyValue + { + get + { + return ResourceManager.GetString("StorageEmulatorInstallPathRegistryKeyValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SOFTWARE\Microsoft\Windows Azure Storage Emulator. + /// + public static string StorageEmulatorRegistryKey + { + get + { + return ResourceManager.GetString("StorageEmulatorRegistryKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Primary Key:. + /// + public static string StoragePrimaryKey + { + get + { + return ResourceManager.GetString("StoragePrimaryKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Secondary Key:. + /// + public static string StorageSecondaryKey + { + get + { + return ResourceManager.GetString("StorageSecondaryKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription named {0} already exists.. + /// + public static string SubscriptionAlreadyExists + { + get + { + return ResourceManager.GetString("SubscriptionAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The SubscriptionDataFile parameter is deprecated. This parameter will be removed in a future release. See https://github.com/Azure/azure-powershell/wiki/Proposed-Design-Stateless-Azure-Profile for a description of the upcoming mechanism for providing alternate sources of subscription information.. + /// + public static string SubscriptionDataFileDeprecated + { + get + { + return ResourceManager.GetString("SubscriptionDataFileDeprecated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to DefaultSubscriptionData.xml. + /// + public static string SubscriptionDataFileName + { + get + { + return ResourceManager.GetString("SubscriptionDataFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription data file {0} does not exist.. + /// + public static string SubscriptionDataFileNotFound + { + get + { + return ResourceManager.GetString("SubscriptionDataFileNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription id {0} doesn't exist.. + /// + public static string SubscriptionIdNotFoundMessage + { + get + { + return ResourceManager.GetString("SubscriptionIdNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription must not be null. + /// + public static string SubscriptionMustNotBeNull + { + get + { + return ResourceManager.GetString("SubscriptionMustNotBeNull", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription name needs to be specified.. + /// + public static string SubscriptionNameNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("SubscriptionNameNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription name {0} doesn't exist.. + /// + public static string SubscriptionNameNotFoundMessage + { + get + { + return ResourceManager.GetString("SubscriptionNameNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription needs to be specified.. + /// + public static string SubscriptionNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("SubscriptionNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Suspend. + /// + public static string Suspend + { + get + { + return ResourceManager.GetString("Suspend", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Swapping website production slot .... + /// + public static string SwappingWebsite + { + get + { + return ResourceManager.GetString("SwappingWebsite", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to swap the website '{0}' production slot with slot '{1}'?. + /// + public static string SwapWebsiteSlotWarning + { + get + { + return ResourceManager.GetString("SwapWebsiteSlotWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The Switch-AzureMode cmdlet is deprecated and will be removed in a future release.. + /// + public static string SwitchAzureModeDeprecated + { + get + { + return ResourceManager.GetString("SwitchAzureModeDeprecated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Starting cmdlet execution, setting for cmdlet confirmation required: '{0}'. + /// + public static string TraceBeginLROJob + { + get + { + return ResourceManager.GetString("TraceBeginLROJob", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Blocking job for ShouldMethod '{0}'. + /// + public static string TraceBlockLROThread + { + get + { + return ResourceManager.GetString("TraceBlockLROThread", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Completing cmdlet execution in RunJob. + /// + public static string TraceEndLROJob + { + get + { + return ResourceManager.GetString("TraceEndLROJob", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: State change from '{0}' to '{1}' because '{2}'. + /// + public static string TraceHandleLROStateChange + { + get + { + return ResourceManager.GetString("TraceHandleLROStateChange", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Unblocking job due to stoppage or failure. + /// + public static string TraceHandlerCancelJob + { + get + { + return ResourceManager.GetString("TraceHandlerCancelJob", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Unblocking job that was previously blocked.. + /// + public static string TraceHandlerUnblockJob + { + get + { + return ResourceManager.GetString("TraceHandlerUnblockJob", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Error in cmdlet execution. + /// + public static string TraceLROJobException + { + get + { + return ResourceManager.GetString("TraceLROJobException", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Removing state changed event handler, exception '{0}'. + /// + public static string TraceRemoveLROEventHandler + { + get + { + return ResourceManager.GetString("TraceRemoveLROEventHandler", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: ShouldMethod '{0}' unblocked.. + /// + public static string TraceUnblockLROThread + { + get + { + return ResourceManager.GetString("TraceUnblockLROThread", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to decode string from base 64. Please make sure the string is correctly encoded: {0}.. + /// + public static string UnableToDecodeBase64String + { + get + { + return ResourceManager.GetString("UnableToDecodeBase64String", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to update mismatching Json structured: {0} {1}.. + /// + public static string UnableToPatchJson + { + get + { + return ResourceManager.GetString("UnableToPatchJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provider {0} is unknown.. + /// + public static string UnknownProviderMessage + { + get + { + return ResourceManager.GetString("UnknownProviderMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Update. + /// + public static string Update + { + get + { + return ResourceManager.GetString("Update", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Updated settings for subscription '{0}'. Current subscription is '{1}'.. + /// + public static string UpdatedSettings + { + get + { + return ResourceManager.GetString("UpdatedSettings", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to User name is not valid.. + /// + public static string UserNameIsNotValid + { + get + { + return ResourceManager.GetString("UserNameIsNotValid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to User name needs to be specified.. + /// + public static string UserNameNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("UserNameNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A value for the VLan Id has to be provided.. + /// + public static string VlanIdRequired + { + get + { + return ResourceManager.GetString("VlanIdRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please wait.... + /// + public static string WaitMessage + { + get + { + return ResourceManager.GetString("WaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The azure storage emulator is not installed, skip launching.... + /// + public static string WarningWhenStorageEmulatorIsMissing + { + get + { + return ResourceManager.GetString("WarningWhenStorageEmulatorIsMissing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Web.cloud.config. + /// + public static string WebCloudConfig + { + get + { + return ResourceManager.GetString("WebCloudConfig", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to web.config. + /// + public static string WebConfigTemplateFileName + { + get + { + return ResourceManager.GetString("WebConfigTemplateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MSDeploy. + /// + public static string WebDeployKeywordInWebSitePublishProfile + { + get + { + return ResourceManager.GetString("WebDeployKeywordInWebSitePublishProfile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot build the project successfully. Please see logs in {0}.. + /// + public static string WebProjectBuildFailTemplate + { + get + { + return ResourceManager.GetString("WebProjectBuildFailTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WebRole. + /// + public static string WebRole + { + get + { + return ResourceManager.GetString("WebRole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to setup_web.cmd > log.txt. + /// + public static string WebRoleStartupTaskCommandLine + { + get + { + return ResourceManager.GetString("WebRoleStartupTaskCommandLine", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WebRole.xml. + /// + public static string WebRoleTemplateFileName + { + get + { + return ResourceManager.GetString("WebRoleTemplateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WebSite with given name {0} already exists in the specified Subscription and Webspace.. + /// + public static string WebsiteAlreadyExists + { + get + { + return ResourceManager.GetString("WebsiteAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WebSite with given name {0} already exists in the specified Subscription and Location.. + /// + public static string WebsiteAlreadyExistsReplacement + { + get + { + return ResourceManager.GetString("WebsiteAlreadyExistsReplacement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Site {0} already has repository created for it.. + /// + public static string WebsiteRepositoryAlreadyExists + { + get + { + return ResourceManager.GetString("WebsiteRepositoryAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Workspaces/WebsiteExtension/Website/{0}/dashboard/. + /// + public static string WebsiteSufixUrl + { + get + { + return ResourceManager.GetString("WebsiteSufixUrl", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to https://{0}/msdeploy.axd?site={1}. + /// + public static string WebSiteWebDeployUriTemplate + { + get + { + return ResourceManager.GetString("WebSiteWebDeployUriTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WorkerRole. + /// + public static string WorkerRole + { + get + { + return ResourceManager.GetString("WorkerRole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to setup_worker.cmd > log.txt. + /// + public static string WorkerRoleStartupTaskCommandLine + { + get + { + return ResourceManager.GetString("WorkerRoleStartupTaskCommandLine", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WorkerRole.xml. + /// + public static string WorkerRoleTemplateFileName + { + get + { + return ResourceManager.GetString("WorkerRoleTemplateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to (x86). + /// + public static string x86InProgramFiles + { + get + { + return ResourceManager.GetString("x86InProgramFiles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Yes. + /// + public static string Yes + { + get + { + return ResourceManager.GetString("Yes", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Yes, I agree. + /// + public static string YesHint + { + get + { + return ResourceManager.GetString("YesHint", resourceCulture); + } + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Properties/Resources.resx b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Properties/Resources.resx new file mode 100644 index 000000000000..a08a2e50172b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Properties/Resources.resx @@ -0,0 +1,1747 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + The remote server returned an error: (401) Unauthorized. + + + Account "{0}" has been added. + + + To switch to a different subscription, please use Select-AzureSubscription. + + + Subscription "{0}" is selected as the default subscription. + + + To view all the subscriptions, please use Get-AzureSubscription. + + + Add-On {0} is created successfully. + + + Add-on name {0} is already used. + + + Add-On {0} not found. + + + Add-on {0} is removed successfully. + + + Add-On {0} is updated successfully. + + + Role has been created at {0}\{1}. + + + Role has been created at {0}\{1}. For easy access to Microsoft Azure services from your application code, install the Microsoft Azure client library for Node.js by running ‘npm install azure’. + + + Role has been created at {0}\{1}. For easy access to Microsoft Azure services from your application code, install the Microsoft Azure client library for PHP by running "pear WindowsAzure/WindowsAzure". + + + Unable to set role permissions. Please give the 'Network Service' user 'Read & execute' and 'Modify' permissions to the role folder, or run PowerShell as an Administrator + + + A role name '{0}' already exists + + + Windows Azure Powershell\ + + + https://manage.windowsazure.com + + + AZURE_PORTAL_URL + + + Azure SDK\{0}\ + + + Base Uri was empty. + WAPackIaaS + + + {0} begin processing without ParameterSet. + + + {0} begin processing with ParameterSet '{1}'. + + + Blob with the name {0} already exists in the account. + + + https://{0}.blob.core.windows.net/ + + + AZURE_BLOBSTORAGE_TEMPLATE + + + CACHERUNTIMEURL + + + cache + + + CacheRuntimeVersion + + + Installing caching version {0} for Role '{1}' (the caching version locally installed is: {2}) + + + Cannot find {0} with name {1}. + + + Deployment for service {0} with {1} slot doesn't exist + + + Can't find valid Microsoft Azure role in current directory {0} + + + service {0} configuration file (ServiceConfiguration.Cloud.cscfg) is either null or doesn't exist + + + Invalid service path! Cannot locate ServiceDefinition.csdef in current folder or parent folders. + + + The subscription named {0} with id {1} is not currently imported. You must import this subscription before it can be updated. + + + ManagementCertificate + + + certificate.pfx + + + Certificate imported into CurrentUser\My\{0} + + + Your account does not have access to the private key for certificate {0} + + + {0} {1} deployment for {2} service + + + Cloud service {0} is in {1} state. + + + Changing/Removing public environment '{0}' is not allowed. + + + Service {0} is set to value {1} + + + Choose which publish settings file to use: + + + Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel + + + 1 + + + cloud_package.cspkg + + + ServiceConfiguration.Cloud.cscfg + + + Add-ons for {0} + + + Communication could not be established. This could be due to an invalid subscription ID. Note that subscription IDs are case sensitive. + + + Complete + + + config.json + + + VirtualMachine creation failed. + WAPackIaaS + + + Creating the website failed. If this is the first website for this subscription, please create it using the management portal instead. + + + Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core + + + //blobcontainer[@datacenter='{0}'] + + + Setting: {0} as the default and current subscription. To view other subscriptions use Get-AzureSubscription + + + none + + + There are no hostnames which could be used for validation. + + + 8080 + + + 1000 + + + Auto + + + 80 + + + Delete + WAPackIaaS + + + The {0} slot for service {1} is already in {2} state + + + The deployment in {0} slot for service {1} is removed + + + Microsoft.WindowsAzure.Plugins.Caching.DiagnosticLevel + + + 1 + + + The key to add already exists in the dictionary. + + + The array index cannot be less than zero. + + + The supplied array does not have enough room to contain the copied elements. + + + The provided dns {0} doesn't exist + + + Microsoft Azure Certificate + + + Endpoint can't be retrieved for storage account + + + {0} end processing. + + + To use Active Directory authentication, you must configure the ActiveDirectoryEndpoint, ActiveDirectoryTenantId, and ActiveDirectorServiceEndpointResourceId for environment of '{0}'. You can configure these properties for this environment using the Set-AzureEnvironment cmdlet. + + + The environment '{0}' already exists. + + + environments.xml + + + Error creating VirtualMachine + WAPackIaaS + + + Unable to download available runtimes for location '{0}' + + + Error updating VirtualMachine + WAPackIaaS + + + Job Id {0} failed. Error: {1}, ExceptionDetails: {2} + WAPackIaaS + + + The HTTP request was forbidden with client authentication scheme 'Anonymous'. + + + This add-on requires you to purchase the first instance through the Microsoft Azure Portal. Subsequent purchases can be performed through PowerShell. + + + Operation Status: + + + Resources\Scaffolding\General + + + Getting all available Microsoft Azure Add-Ons, this may take few minutes... + + + Name{0}Primary Key{0}Seconday Key + + + Git not found. Please install git and place it in your command line path. + + + Could not find publish settings. Please run Import-AzurePublishSettingsFile. + + + iisnode.dll + + + iisnode + + + iisnode-dev\\release\\x64 + + + iisnode + + + Installing IISNode version {0} in Azure for WebRole '{1}' (the version locally installed is: {2}) + + + Internal Server Error + + + Cannot enable memcach protocol on a cache worker role {0}. + + + Invalid certificate format. + + + The provided configuration path is invalid or doesn't exist + + + The country name is invalid, please use a valid two character country code, as described in ISO 3166-1 alpha-2. + + + Deployment with {0} does not exist + + + The deployment slot name {0} is invalid. Slot name must be either "Staging" or "Production". + + + Invalid service endpoint. + + + File {0} has invalid characters + + + You must create your git publishing credentials using the Microsoft Azure portal. +Please follow these steps in the portal: +1. On the left side open "Web Sites" +2. Click on any website +3. Choose "Setup Git Publishing" or "Reset deployment credentials" +4. Back in the PowerShell window, rerun this command by typing "New-AzureWebSite {site name} -Git -PublishingUsername {username} + + + The value {0} provided is not a valid GUID. Please provide a valid GUID. + + + The specified hostname does not exist. Please specify a valid hostname for the site. + + + Role {0} instances must be greater than or equal 0 and less than or equal 20 + + + There was an error creating your webjob. Please make sure that the script is in the root folder of the zip file. + + + Could not download a valid runtime manifest, Please check your internet connection and try again. + + + The account {0} was not found. Please specify a valid account name. + + + The provided name "{0}" does not match the service bus namespace naming rules. + + + Value cannot be null. Parameter name: '{0}' + + + The provided package path is invalid or doesn't exist + + + '{0}' is an invalid parameter set name. + + + {0} doesn't exist in {1} or you've not passed valid value for it + + + Path {0} has invalid characters + + + The provided publish settings file {0} has invalid content. Please get valid by running cmdlet Get-AzurePublishSettingsFile + + + The provided role name "{0}" has invalid characters + + + A valid name for the service root folder is required + + + {0} is not a recognized runtime type + + + A valid language is required + + + No subscription is currently selected. Use Select-Subscription to activate a subscription. + + + The provided location "{0}" does not exist in the available locations use Get-AzureSBLocation for listing available locations. + + + Please provide a service name or run this command from inside a service project directory. + + + You must provide valid value for {0} + + + settings.json is invalid or doesn't exist + + + The subscription named '{0}' cannot be found. Use Set-AzureSubscription to initialize the subscription data. + + + The provided subscription id {0} is not valid + + + A valid subscription name is required. This can be provided using the -Subscription parameter or by setting the subscription via the Set-AzureSubscription cmdlet + + + The provided subscriptions file {0} has invalid content. + + + Role {0} VM size should be ExtraSmall, Small, Medium, Large or ExtraLarge. + + + The web job file must have *.zip extension + + + Singleton option works for continuous jobs only. + + + The website {0} was not found. Please specify a valid website name. + + + No job for id: {0} was found. + WAPackIaaS + + + engines + + + Scaffolding for this language is not yet supported + + + Link already established + + + local_package.csx + + + ServiceConfiguration.Local.cscfg + + + Looking for {0} deployment for {1} cloud service... + + + Looking for cloud service {0}... + + + managementCertificate.pem + + + ?whr={0} + + + //baseuri + + + uri + + + http://az413943.vo.msecnd.net/node/runtimemanifest_0.7.5.2.xml + + + Multiple Add-Ons found holding name {0} + + + Multiple possible publishing users. Please go to the Portal and use the listed deployment user, or click 'set/reset deployment credentials' to set up a new user account, then reurn this cmdlet and specify PublishingUsername. + + + The first publish settings file "{0}" is used. If you want to use another file specify the file name. + + + Microsoft.WindowsAzure.Plugins.Caching.NamedCaches + + + {"caches":[{"name":"default","policy":{"eviction":{"type":0},"expiration":{"defaultTTL":10,"isExpirable":true,"type":1},"serverNotification":{"isEnabled":false}},"secondaries":0}]} + + + A publishing username is required. Please specify one using the argument PublishingUsername. + + + New Add-On Confirmation + + + By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis +for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) +agree to the {2}'s terms of user and privacy statement at {0} and (c) agree to sharing my +contact information with {2}. + + + Internal Server Error. This could happen because the namespace name is already used or due to an incorrect location name. Use Get-AzureSBLocation cmdlet to list valid names. + + + By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis +for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) +acknowledge the offering is provided by {2}, not Microsoft, and agree to {2}'s terms of +use and privacy statement at {0} and (c) agree to sharing my contact information with {2}. + + + Service has been created at {0} + + + No + + + There is no access token cached for subscription {0}, user id {1}. Use the Add-AzureAccount cmdlet to log in again and get a token for this subscription. + + + The service does not have any cache worker roles, add one first by running cmdlet Add-AzureCacheWorkerRole. + + + No clouds available + WAPackIaaS + + + nodejs + + + node + + + node.exe + + + There is no default subscription set, please set a default subscription by running Set-AzureSubscription -Default <subscription name> + + + Microsoft SDKs\Azure\Nodejs\Nov2011 + + + nodejs + + + node + + + Resources\Scaffolding\Node + + + Microsoft.WindowsAzure.Commands.CloudService.ScaffoldingResources.Node + + + Installing Node version {0} in Azure for Role '{1}' (the Node version locally installed is: {2}) + + + No, I do not agree + + + No publish settings files with extension *.publishsettings are found in the directory "{0}". + + + '{0}' must be a cache worker role. Verify that it has proper cache worker role configuration. + + + Certificate can't be null. + + + {0} could not be null or empty + + + Unable to add a null RoleSettings to {0} + + + Unable to add new role to null service definition + + + The request offer '{0}' is not found. + + + Operation "{0}" failed on VM with ID: {1} + WAPackIaaS + + + The REST operation failed with message '{0}' and error code '{1}' + + + Job Id {0} did not complete within expected time or it is in Failed/Canceled/Invalid state. + WAPackIaaS + + + package + + + Package is created at service root path {0}. + + + {{ + "author": "", + + "name": "{0}", + "version": "0.0.0", + "dependencies":{{}}, + "devDependencies":{{}}, + "optionalDependencies": {{}}, + "engines": {{ + "node": "*", + "iisnode": "*" + }} + +}} + + + + package.json + + + A value for the Peer Asn has to be provided. + + + 5.4.0 + + + php + + + Resources\Scaffolding\PHP + + + Microsoft.WindowsAzure.Commands.CloudService.ScaffoldingResources.PHP + + + Installing PHP version {0} for Role '{1}' (the PHP version locally installed is: {2}) + + + You must create your first web site using the Microsoft Azure portal. +Please follow these steps in the portal: +1. At the bottom of the page, click on New > Web Site > Quick Create +2. Type {0} in the URL field +3. Click on "Create Web Site" +4. Once the site has been created, click on the site name +5. Click on "Set up Git publishing" or "Reset deployment credentials" and setup a publishing username and password. Use those credentials for all new websites you create. + + + 6. Back in the console window, rerun this command by typing "New-AzureWebsite <site name> -Git" + + + A value for the Primary Peer Subnet has to be provided. + + + Promotion code can be used only when updating to a new plan. + + + Service not published at user request. + + + Complete. + + + Connecting... + + + Created Deployment ID: {0}. + + + Created hosted service '{0}'. + + + Created Website URL: {0}. + + + Creating... + + + Initializing... + + + busy + + + creating the virtual machine + + + Instance {0} of role {1} is {2}. + + + ready + + + Preparing deployment for {0} with Subscription ID: {1}... + + + Publishing {0} to Microsoft Azure. This may take several minutes... + + + publish settings + + + Azure + + + .PublishSettings + + + publishSettings.xml + + + Publish settings imported + + + AZURE_PUBLISHINGPROFILE_URL + + + Starting... + + + Upgrading... + + + Uploading Package to storage service {0}... + + + Verifying storage account '{0}'... + + + Replace current deployment with '{0}' Id ? + + + Are you sure you want to regenerate key? + + + Generate new key. + + + Are you sure you want to remove account '{0}'? + + + Removing account + + + Remove Add-On Confirmation + + + If you delete this add-on, your data may be deleted and the operation may not be undone. You may have to purchase it again from the Microsoft Azure Store to use it. The price of the add-on may not be refunded. Are you sure you want to delete this add-on? Enter “Yes” to confirm. + + + Remove-AzureBGPPeering Operation failed. + + + Removing Bgp Peering + + + Successfully removed Azure Bgp Peering with Service Key {0}. + + + Are you sure you want to remove the Bgp Peering with service key '{0}'? + + + Are you sure you want to remove the Dedicated Circuit with service key '{0}'? + + + Remove-AzureDedicatedCircuit Operation failed. + + + Remove-AzureDedicatedCircuitLink Operation failed. + + + Removing Dedicated Circui Link + + + Successfully removed Azure Dedicated Circuit Link with Service Key {0} and Vnet Name {1} + + + Are you sure you want to remove the Dedicated Circuit Link with service key '{0}' and virtual network name '{1}'? + + + Removing Dedicated Circuit + + + Successfully removed Azure Dedicated Circuit with Service Key {0}. + + + Removing cloud service {0}... + + + Removing {0} deployment for {1} service + + + Removing job collection + + + Are you sure you want to remove the job collection "{0}" + + + Removing job + + + Are you sure you want to remove the job "{0}" + + + Are you sure you want to remove the account? + + + Account removed. + + + Internal Server Error. This could happen because the namespace does not exist or it does not exist under your subscription. + + + Removing old package {0}... + + + Are you sure you want to delete the namespace '{0}'? + + + Are you sure you want to remove cloud service? + + + Remove cloud service and all it's deployments + + + Are you sure you want to remove subscription '{0}'? + + + Removing subscription + + + Are you sure you want to delete the VM '{0}'? + + + Deleting VM. + + + Removing WebJob... + + + Are you sure you want to remove job '{0}'? + + + Removing website + + + Are you sure you want to remove the website "{0}" + + + Deleting namespace + + + Repository is not setup. You need to pass a valid site name. + + + Reserved IP with the Name:'{0}' will no longer be in use after the deployment is deleted, and it is still reserved for later use. + + + Resource with ID : {0} does not exist. + WAPackIaaS + + + Restart + WAPackIaaS + + + Resume + WAPackIaaS + + + /role:{0};"{1}/{0}" + + + bin + + + Role {0} is {1} + + + 20 + + + role name + + + The provided role name {0} doesn't exist + + + RoleSettings.xml + + + Role type {0} doesn't exist + + + public static Dictionary<string, Location> ReverseLocations { get; private set; } + + + Preparing runtime deployment for service '{0}' + + + WARNING Runtime Mismatch: Are you sure that you want to publish service '{0}' using an Azure runtime version that does not match your local runtime version? + + + RUNTIMEOVERRIDEURL + + + /runtimemanifest/runtimes/runtime + + + RUNTIMEID + + + RUNTIMEURL + + + RUNTIMEVERSIONPRIMARYKEY + + + scaffold.xml + + + Invalid location entered. Pick one of the locations from Get-AzureSchedulerLocation + + + A value for the Secondary Peer Subnet has to be provided. + + + Service {0} already exists on disk in location {1} + + + No ServiceBus authorization rule with the given characteristics was found + + + The service bus entity '{0}' is not found. + + + Internal Server Error. This could happen due to an incorrect/missing namespace + + + service configuration + + + service definition + + + ServiceDefinition.csdef + + + {0}Deploy + + + The specified cloud service "{0}" does not exist. + + + {0} slot for service {1} is in {2} state, please wait until it finish and update it's status + + + Begin Operation: {0} + + + Completed Operation: {0} + + + Begin Operation: {0} + + + Completed Operation: {0} + + + service name + + + Please provide name for the hosted service + + + service parent directory + + + Service {0} removed successfully + + + service directory + + + service settings + + + The storage account name '{0}' is invalid. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + + + The {0} slot for cloud service {1} doesn't exist. + + + {0} slot for service {1} is {2} + + + Set Add-On Confirmation + + + Note - You will be charged the amount for the new plan, without being refunded for time remaining +in the existing plan. +By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis +for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) +agree to the {2}'s terms of user and privacy statement at {0} and (c) agree to sharing my +contact information with {2}. + + + Note - You will be charged the amount for the new plan, without being refunded for time remaining +in the existing plan. +By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis +for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) +acknowledge the offering is provided by {2}, not Microsoft, and agree to {2}'s terms of +use and privacy statement at <url> and (c) agree to sharing my contact information with {2}. + + + Role {0} instances are set to {1} + + + {"Slot":"","Location":"","Subscription":"","StorageAccountName":""} + + + deploymentSettings.json + + + Confirm + + + Shutdown + WAPackIaaS + + + /sites:{0};{1};"{2}/{0}" + + + 1000 + + + Start + WAPackIaaS + + + Started + + + Starting Emulator... + + + start + + + Stop + WAPackIaaS + + + Stopping emulator... + + + Stopped + + + stop + + + Account Name: + + + Cannot find storage account '{0}' please type the name of an existing storage account. + + + AzureStorageEmulator.exe + + + InstallPath + + + SOFTWARE\Microsoft\Windows Azure Storage Emulator + + + Primary Key: + + + Secondary Key: + + + The subscription named {0} already exists. + + + DefaultSubscriptionData.xml + + + The subscription data file {0} does not exist. + + + Subscription must not be null + WAPackIaaS + + + Suspend + WAPackIaaS + + + Swapping website production slot ... + + + Are you sure you want to swap the website '{0}' production slot with slot '{1}'? + + + The provider {0} is unknown. + + + Update + WAPackIaaS + + + Updated settings for subscription '{0}'. Current subscription is '{1}'. + + + A value for the VLan Id has to be provided. + + + Please wait... + + + The azure storage emulator is not installed, skip launching... + + + Web.cloud.config + + + web.config + + + MSDeploy + + + Cannot build the project successfully. Please see logs in {0}. + + + WebRole + + + setup_web.cmd > log.txt + + + WebRole.xml + + + WebSite with given name {0} already exists in the specified Subscription and Webspace. + + + WebSite with given name {0} already exists in the specified Subscription and Location. + + + Site {0} already has repository created for it. + + + Workspaces/WebsiteExtension/Website/{0}/dashboard/ + + + https://{0}/msdeploy.axd?site={1} + + + WorkerRole + + + setup_worker.cmd > log.txt + + + WorkerRole.xml + + + Yes + + + Yes, I agree + + + Remove-AzureTrafficManagerProfile Operation failed. + + + Successfully removed Traffic Manager profile with name {0}. + + + Are you sure you want to remove the Traffic Manager profile "{0}"? + + + Profile {0} already has an endpoint with name {1} + + + Profile {0} does not contain endpoint {1}. Adding it. + + + The endpoint {0} cannot be removed from profile {1} because it's not in the profile. + + + Insufficient parameters passed to create a new endpoint. + + + Ambiguous operation: the profile name specified doesn't match the name of the profile object. + + + <NONE> + + + "An exception occurred when calling the ServiceManagement API. HTTP Status Code: {0}. Service Management Error Code: {1}. Message: {2}. Operation Tracking ID: {3}." + {0} is the HTTP status code. {1} is the Service Management Error Code. {2} is the Service Management Error message. {3} is the operation tracking ID. + + + Unable to decode string from base 64. Please make sure the string is correctly encoded: {0}. + {0} is the string that is not in a valid base 64 format. + + + Skipping external tenant {0}, because you are using a guest or a foreign principal object identity. In order to access this tenant, please run Add-AzureAccount without "-Credential". + + + Removing an environment will remove all associated subscriptions and accounts. Are you sure you want to remove an environment '{0}'? + + + Removing environment + + + There is no subscription associated with account {0}. + + + Account id doesn't match one in subscription. + + + Environment name doesn't match one in subscription. + + + Removing the Azure profile will remove all associated environments, subscriptions, and accounts. Are you sure you want to remove the Azure profile? + + + Removing the Azure profile + + + The SubscriptionDataFile parameter is deprecated. This parameter will be removed in a future release. See https://github.com/Azure/azure-powershell/wiki/Proposed-Design-Stateless-Azure-Profile for a description of the upcoming mechanism for providing alternate sources of subscription information. + + + Account needs to be specified + + + No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName> to set the default subscription. + + + Path must specify a valid path to an Azure profile. + + + Property bag Hashtable must contain one of the following sets of properties: {SubscriptionId, Certificate}, {SubscriptionId, Username, Password}, {SubscriptionId, ServicePrincipal, Password, Tenant}, {SubscriptionId, AccountId, Token} + + + Property bag Hashtable must contain a 'Certificate' of type 'X509Certificate2'. + + + Property bag Hashtable must contain a 'Password' with an associated 'Username' or 'ServicePrincipal'. + + + Property bag Hashtable must contain a 'SubscriptionId'. + + + Selected profile must not be null. + + + The Switch-AzureMode cmdlet is deprecated and will be removed in a future release. + + + OperationID : '{0}' + + + Cannot get module for DscResource '{0}'. Possible solutions: +1) Specify -ModuleName for Import-DscResource in your configuration. +2) Unblock module that contains resource. +3) Move Import-DscResource inside Node block. + + 0 = name of DscResource + + + Your current PowerShell version {1} is less then required by this cmdlet {0}. Consider download and install latest PowerShell version. + {0} = minimal required PS version, {1} = current PS version + + + Parsing configuration script: {0} + {0} is the path to a script file + + + Configuration script '{0}' contained parse errors: +{1} + 0 = path to the configuration script, 1 = parser errors + + + List of required modules: [{0}]. + {0} = list of modules + + + Temp folder '{0}' created. + {0} = temp folder path + + + Copy '{0}' to '{1}'. + {0} = source, {1} = destination + + + Copy the module '{0}' to '{1}'. + {0} = source, {1} = destination + + + File '{0}' already exists. Use the -Force parameter to overwrite it. + {0} is the path to a file + + + Configuration file '{0}' not found. + 0 = path to the configuration file + + + Path '{0}' not found. + 0 = path to the additional content file/directory + + + Path '{0}' not found. + 0 = path to the additional content file/directory + + + Invalid configuration file: {0}. +The file needs to be a PowerShell script (.ps1 or .psm1) or a ZIP archive (.zip). + 0 = path to the configuration file + + + Invalid configuration file: {0}. +The file needs to be a PowerShell script (.ps1 or .psm1). + 0 = path to the configuration file + + + Create Archive + + + Upload '{0}' + {0} is the name of an storage blob + + + Storage Blob '{0}' already exists. Use the -Force parameter to overwrite it. + {0} is the name of an storage blob + + + Configuration published to {0} + {0} is an URI + + + Deleted '{0}' + {0} is the path of a file + + + Cannot delete '{0}': {1} + {0} is the path of a file, {1} is an error message + + + Cannot find the WadCfg end element in the config. + + + WadCfg start element in the config is not matching the end element. + + + Cannot find the WadCfg element in the config. + + + Cannot find configuration data file: {0} + + + The configuration data must be a .psd1 file + + + Cannot change built-in environment {0}. + + + Azure PowerShell collects usage data in order to improve your experience. +The data is anonymous and does not include commandline argument values. +The data is collected by Microsoft. + +Use the Disable-AzDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the Az.Accounts module. To disable data collection: PS > Disable-AzDataCollection. +Use the Enable-AzDataCollection cmdlet to turn the feature On. The cmdlet can be found in the Az.Accounts module. To enable data collection: PS > Enable-AzDataCollection. + + + Microsoft Azure PowerShell Data Collection Confirmation + + + You choose not to participate in Microsoft Azure PowerShell data collection. + + + This confirmation message will be dismissed in '{0}' second(s)... + + + You choose to participate in Microsoft Azure PowerShell data collection. + + + The setting profile has been saved to the following path '{0}'. + + + [Common.Authentication]: Authenticating for account {0} with single tenant {1}. + + + Changing public environment is not supported. + + + Environment name needs to be specified. + + + Environment needs to be specified. + + + The environment name '{0}' is not found. + + + File path is not valid. + + + Must specify a non-null subscription name. + + + The default subscription is being removed. Use Select-AzureSubscription -Default <subscriptionName> to select a new default subscription. + + + Removing public environment is not supported. + + + The subscription id {0} doesn't exist. + + + Subscription name needs to be specified. + + + The subscription name {0} doesn't exist. + + + Subscription needs to be specified. + + + User name is not valid. + + + User name needs to be specified. + + + "There is no current context, please log in using Connect-AzAccount." + + + No subscriptions are associated with the logged in account in Azure Service Management (RDFE). This means that the logged in user is not an administrator or co-administrator for any account.\r\nDid you mean to execute Connect-AzAccount? + + + No certificate was found in the certificate store with thumbprint {0} + + + Illegal characters in path. + + + Invalid certificate format. Publish settings may be corrupted. Use Get-AzurePublishSettingsFile to download updated settings + + + "{0}" is an invalid DNS name for {1} + + + The provided file in {0} must be have {1} extension + + + {0} is invalid or empty + + + Please connect to internet before executing this cmdlet + + + Path {0} doesn't exist. + + + Path for {0} doesn't exist in {1}. + + + &whr={0} + + + The provided service name {0} already exists, please pick another name + + + Unable to update mismatching Json structured: {0} {1}. + + + (x86) + + + Azure PowerShell collects usage data in order to improve your experience. +The data is anonymous and does not include commandline argument values. +The data is collected by Microsoft. + +Use the Disable-AzureDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the Azure module. To disable data collection: PS > Disable-AzureDataCollection. +Use the Enable-AzureDataCollection cmdlet to turn the feature On. The cmdlet can be found in the Azure module. To enable data collection: PS > Enable-AzureDataCollection. + + + Execution failed because a background thread could not prompt the user. + + + Azure Long-Running Job + + + The cmdlet failed in background execution. The returned error was '{0}'. Please execute the cmdlet again. You may need to execute this cmdlet synchronously, by omitting the '-AsJob' parameter. + 0(string): exception message in background task + + + Please execute the cmdlet again and include the 'Force' parameter, if available, to avoid unnecessary prompts. + + + Please execute the cmdlet again and omit the 'Confirm' parameter when using the 'AsJob' parameter. + + + Please increase the user $ConfirmPreference setting, or include turn off confirmation using '-Confirm:$false' when using the 'AsJob' parameter and execute the cmdet again. + + + Please execute the cmdlet again and omit the 'WhatIf' parameter when using the 'AsJob' parameter. + + + [AzureLongRunningJob]: Starting cmdlet execution, setting for cmdlet confirmation required: '{0}' + 0(bool): whether cmdlet confirmation is required + + + [AzureLongRunningJob]: Blocking job for ShouldMethod '{0}' + 0(string): method type + + + [AzureLongRunningJob]: Completing cmdlet execution in RunJob + + + [AzureLongRunningJob]: State change from '{0}' to '{1}' because '{2}' + 0(string): last state, 1(string): new state, 2(string): state change reason + + + [AzureLongRunningJob]: Unblocking job due to stoppage or failure + + + [AzureLongRunningJob]: Unblocking job that was previously blocked. + + + [AzureLongRunningJob]: Error in cmdlet execution + + + [AzureLongRunningJob]: Removing state changed event handler, exception '{0}' + 0(string): exception message + + + [AzureLongRunningJob]: ShouldMethod '{0}' unblocked. + 0(string): methodType + + + +- The parameter : '{0}' is changing. + + + +- The parameter : '{0}' is becoming mandatory. + + + +- The parameter : '{0}' is being replaced by parameter : '{1}'. + + + +- The parameter : '{0}' is being replaced by mandatory parameter : '{1}'. + + + +- Change description : {0} + + + The cmdlet is being deprecated. There will be no replacement for it. + + + The cmdlet parameter set is being deprecated. There will be no replacement for it. + + + The cmdlet '{0}' is replacing this cmdlet. + + + +- The output type is changing from the existing type :'{0}' to the new type :'{1}' + + + +- The output type '{0}' is changing + + + +- The following properties are being added to the output type : + + + +- The following properties in the output type are being deprecated : + + + {0} + + + +- Cmdlet : '{0}' + - {1} + + + Upcoming breaking changes in the cmdlet '{0}' : + + + +- This change will take effect on '{0}' + + + +- The change is expected to take effect from version : '{0}' + + + ```powershell +# Old +{0} + +# New +{1} +``` + + + + +Cmdlet invocation changes : + Old Way : {0} + New Way : {1} + + + +The output type '{0}' is being deprecated without a replacement. + + + +The type of the parameter is changing from '{0}' to '{1}'. + + + +Note : Go to {0} for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell. + + + This cmdlet is in preview. Its behavior is subject to change based on customer feedback. + + + The estimated generally available date is '{0}'. + + + - The change is expected to take effect from Az version : '{0}' + + \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Response.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Response.cs new file mode 100644 index 000000000000..ccb4f9dfd7fd --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Response.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + using System; + using System.Threading.Tasks; + public class Response : EventData + { + public Response() : base() + { + } + } + + public class Response : Response + { + private Func> _resultDelegate; + private Task _resultValue; + + public Response(T value) : base() => _resultValue = Task.FromResult(value); + public Response(Func value) : base() => _resultDelegate = () => Task.FromResult(value()); + public Response(Func> value) : base() => _resultDelegate = value; + public Task Result => _resultValue ?? (_resultValue = this._resultDelegate()); + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Serialization/JsonSerializer.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Serialization/JsonSerializer.cs new file mode 100644 index 000000000000..b6c01a5134ea --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Serialization/JsonSerializer.cs @@ -0,0 +1,350 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal class JsonSerializer + { + private int depth = 0; + + private SerializationOptions options = new SerializationOptions(); + + #region Deserialization + + internal T Deseralize(JsonObject json) + where T : new() + { + var contract = JsonModelCache.Get(typeof(T)); + + return (T)DeserializeObject(contract, json); + } + + internal object DeserializeObject(JsonModel contract, JsonObject json) + { + var instance = Activator.CreateInstance(contract.Type); + + depth++; + + // Ensure we don't recurse forever + if (depth > 5) throw new Exception("Depth greater than 5"); + + foreach (var field in json) + { + var member = contract[field.Key]; + + if (member != null) + { + var value = DeserializeValue(member, field.Value); + + member.SetValue(instance, value); + } + } + + depth--; + + return instance; + } + + private object DeserializeValue(JsonMember member, JsonNode value) + { + if (value.Type == JsonType.Null) return null; + + var type = member.Type; + + if (member.IsStringLike && value.Type != JsonType.String) + { + // Take the long path... + return DeserializeObject(JsonModelCache.Get(type), (JsonObject)value); + } + else if (member.Converter != null) + { + return member.Converter.FromJson(value); + } + else if (type.IsArray) + { + return DeserializeArray(type, (JsonArray)value); + } + else if (member.IsList) + { + return DeserializeList(type, (JsonArray)value); + } + else + { + var contract = JsonModelCache.Get(type); + + return DeserializeObject(contract, (JsonObject)value); + } + } + + private object DeserializeValue(Type type, JsonNode value) + { + if (type == null) throw new ArgumentNullException(nameof(type)); + + if (value.Type == JsonType.Null) return null; + + var typeDetails = TypeDetails.Get(type); + + if (typeDetails.JsonConverter != null) + { + return typeDetails.JsonConverter.FromJson(value); + } + else if (typeDetails.IsEnum) + { + return Enum.Parse(type, value.ToString(), ignoreCase: true); + } + else if (type.IsArray) + { + return DeserializeArray(type, (JsonArray)value); + } + else if (typeDetails.IsList) + { + return DeserializeList(type, (JsonArray)value); + } + else + { + var contract = JsonModelCache.Get(type); + + return DeserializeObject(contract, (JsonObject)value); + } + } + + internal Array DeserializeArray(Type type, JsonArray elements) + { + var elementType = type.GetElementType(); + + var elementTypeDetails = TypeDetails.Get(elementType); + + var array = Array.CreateInstance(elementType, elements.Count); + + int i = 0; + + if (elementTypeDetails.JsonConverter != null) + { + foreach (var value in elements) + { + array.SetValue(elementTypeDetails.JsonConverter.FromJson(value), i); + + i++; + } + } + else + { + foreach (var value in elements) + { + array.SetValue(DeserializeValue(elementType, value), i); + + i++; + } + } + + return array; + } + + internal IList DeserializeList(Type type, JsonArray jsonArray) + { + // TODO: Handle non-generic types + if (!type.IsGenericType) + throw new ArgumentException("Must be a generic type", nameof(type)); + + var elementType = type.GetGenericArguments()[0]; + + IList list; + + if (type.IsInterface) + { + // Create a concrete generic list + list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(elementType)); + } + else + { + list = (IList)Activator.CreateInstance(type); + } + + foreach (var value in jsonArray) + { + list.Add(DeserializeValue(elementType, value)); + } + + return list; + } + + #endregion + + #region Serialization + + internal JsonNode Serialize(object instance) => + Serialize(instance, SerializationOptions.Default); + + internal JsonNode Serialize(object instance, string[] include) => + Serialize(instance, new SerializationOptions { Include = include }); + + internal JsonNode Serialize(object instance, SerializationOptions options) + { + this.options = options; + + if (instance == null) + { + return XNull.Instance; + } + + return ReadValue(instance.GetType(), instance); + } + + #region Readers + + internal JsonArray ReadArray(IEnumerable collection) + { + var array = new XNodeArray(); + + foreach (var item in collection) + { + array.Add(ReadValue(item.GetType(), item)); + } + + return array; + } + + internal IEnumerable> ReadProperties(object instance) + { + var contract = JsonModelCache.Get(instance.GetType()); + + foreach (var member in contract.Members) + { + string name = member.Name; + + if (options.PropertyNameTransformer != null) + { + name = options.PropertyNameTransformer.Invoke(name); + } + + // Skip the field if it's not included + if ((depth == 1 && !options.IsIncluded(name))) + { + continue; + } + + var value = member.GetValue(instance); + + if (!member.EmitDefaultValue && (value == null || (member.IsList && ((IList)value).Count == 0) || value.Equals(member.DefaultValue))) + { + continue; + } + else if (options.IgnoreNullValues && value == null) // Ignore null values + { + continue; + } + + // Transform the value if there is one + if (options.Transformations != null) + { + var transform = options.GetTransformation(name); + + if (transform != null) + { + value = transform.Transformer(value); + } + } + + yield return new KeyValuePair(name, ReadValue(member.TypeDetails, value)); + } + } + + private JsonObject ReadObject(object instance) + { + depth++; + + // TODO: Guard against a self referencing graph + if (depth > options.MaxDepth) + { + depth--; + + return new JsonObject(); + } + + var node = new JsonObject(ReadProperties(instance)); + + depth--; + + return node; + } + + private JsonNode ReadValue(Type type, object value) + { + if (value == null) + { + return XNull.Instance; + } + + var member = TypeDetails.Get(type); + + return ReadValue(member, value); + } + + private JsonNode ReadValue(TypeDetails type, object value) + { + if (value == null) + { + return XNull.Instance; + } + + if (type.JsonConverter != null) + { + return type.JsonConverter.ToJson(value); + } + else if (type.IsArray) + { + switch (Type.GetTypeCode(type.ElementType)) + { + case TypeCode.String: return CreateArray((string[])value); + case TypeCode.UInt16: return CreateArray((ushort[])value); + case TypeCode.UInt32: return CreateArray((uint[])value); + case TypeCode.UInt64: return CreateArray((ulong[])value); + case TypeCode.Int16: return CreateArray((short[])value); + case TypeCode.Int32: return CreateArray((int[])value); + case TypeCode.Int64: return CreateArray((long[])value); + case TypeCode.Single: return CreateArray((float[])value); + case TypeCode.Double: return CreateArray((double[])value); + default: return ReadArray((IEnumerable)value); + } + } + else if (value is IEnumerable) + { + if (type.IsList && type.ElementType != null) + { + switch (Type.GetTypeCode(type.ElementType)) + { + case TypeCode.String: return CreateList(value); + case TypeCode.UInt16: return CreateList(value); + case TypeCode.UInt32: return CreateList(value); + case TypeCode.UInt64: return CreateList(value); + case TypeCode.Int16: return CreateList(value); + case TypeCode.Int32: return CreateList(value); + case TypeCode.Int64: return CreateList(value); + case TypeCode.Single: return CreateList(value); + case TypeCode.Double: return CreateList(value); + } + } + + return ReadArray((IEnumerable)value); + } + else + { + // Complex object + return ReadObject(value); + } + } + + private XList CreateList(object value) => new XList((IList)value); + + private XImmutableArray CreateArray(T[] array) => new XImmutableArray(array); + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Serialization/PropertyTransformation.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Serialization/PropertyTransformation.cs new file mode 100644 index 000000000000..90c07a283afd --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Serialization/PropertyTransformation.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal class PropertyTransformation + { + internal PropertyTransformation(string name, Func transformer) + { + Name = name ?? throw new ArgumentNullException(nameof(name)); + Transformer = transformer ?? throw new ArgumentNullException(nameof(transformer)); + } + + internal string Name { get; } + + internal Func Transformer { get; } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Serialization/SerializationOptions.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Serialization/SerializationOptions.cs new file mode 100644 index 000000000000..285178377152 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Serialization/SerializationOptions.cs @@ -0,0 +1,65 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal class SerializationOptions + { + internal static readonly SerializationOptions Default = new SerializationOptions(); + + internal SerializationOptions() { } + + internal SerializationOptions( + string[] include = null, + bool ingoreNullValues = false) + { + Include = include; + IgnoreNullValues = ingoreNullValues; + } + + internal string[] Include { get; set; } + + internal string[] Exclude { get; set; } + + internal bool IgnoreNullValues { get; set; } + + internal PropertyTransformation[] Transformations { get; set; } + + internal Func PropertyNameTransformer { get; set; } + + internal int MaxDepth { get; set; } = 5; + + internal bool IsIncluded(string name) + { + if (Exclude != null) + { + return !Exclude.Any(exclude => exclude.Equals(name, StringComparison.OrdinalIgnoreCase)); + } + else if (Include != null) + { + return Include.Any(exclude => exclude.Equals(name, StringComparison.OrdinalIgnoreCase)); + } + + return true; + } + + internal PropertyTransformation GetTransformation(string propertyName) + { + if (Transformations == null) return null; + + foreach (var t in Transformations) + { + if (t.Name.Equals(propertyName, StringComparison.OrdinalIgnoreCase)) + { + return t; + } + } + + return null; + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/SerializationMode.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/SerializationMode.cs new file mode 100644 index 000000000000..fa332dafb189 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/SerializationMode.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + [System.Flags] + public enum SerializationMode + { + None = 0, + IncludeHeaders = 1 << 0, + IncludeReadOnly = 1 << 1, + + IncludeAll = IncludeHeaders | IncludeReadOnly + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/TypeConverterExtensions.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/TypeConverterExtensions.cs new file mode 100644 index 000000000000..6d06051aa5b5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/TypeConverterExtensions.cs @@ -0,0 +1,211 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.IO; +using System.Linq; +using System.Xml; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.PowerShell +{ + internal static class TypeConverterExtensions + { + internal static T[] SelectToArray(object source, System.Func converter) + { + // null begets null + if (source == null) + { + return null; + } + + // single values and strings are just encapsulated in the array. + if (source is string || !(source is System.Collections.IEnumerable)) + { + try + { + return new T[] { (T)converter(source) }; + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // silent conversion fail + } +#endif + return new T[0]; // empty result if couldn't convert. + } + + var result = new System.Collections.Generic.List(); + foreach (var each in (System.Collections.IEnumerable)source) + { + try + { + result.Add((T)converter(each)); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // silent conversion fail + } +#endif + } + return result.ToArray(); + } + + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Collections.Generic.IDictionary dictionary) + { + if (null != dictionary) + { + foreach (var each in dictionary.Keys) + { + yield return each; + } + } + } + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Collections.IDictionary dictionary) + { + if (null != dictionary) + { + foreach (var each in dictionary.Keys) + { + yield return each; + } + } + } + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Management.Automation.PSObject instance) + { + if (null != instance) + { + foreach (var each in instance.Properties) + { + yield return each; + } + } + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Collections.Generic.IDictionary instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + return (null == instance || instance.Count == 0) ? + Enumerable.Empty>() : + instance.Keys + .Where(key => + !(true == exclusions?.Contains(key?.ToString())) + && (false != inclusions?.Contains(key?.ToString()))) + .Select(key => new System.Collections.Generic.KeyValuePair(key, instance[key])); + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Collections.IDictionary instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + return (null == instance || instance.Count == 0) ? + Enumerable.Empty>() : + instance.Keys.OfType() + .Where(key => + !(true == exclusions?.Contains(key?.ToString())) + && (false != inclusions?.Contains(key?.ToString()))) + .Select(key => new System.Collections.Generic.KeyValuePair(key, instance[key])); + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Management.Automation.PSObject instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + // new global::System.Collections.Generic.HashSet(System.StringComparer.InvariantCultureIgnoreCase) + return (null == instance || !instance.Properties.Any()) ? + Enumerable.Empty>() : + instance.Properties + .Where(property => + !(true == exclusions?.Contains(property.Name)) + && (false != inclusions?.Contains(property.Name))) + .Select(property => new System.Collections.Generic.KeyValuePair(property.Name, property.Value)); + } + + + internal static T GetValueForProperty(this System.Collections.Generic.IDictionary dictionary, string propertyName, T defaultValue, System.Func converter) + { + try + { + var key = System.Linq.Enumerable.FirstOrDefault(dictionary.Keys, each => System.String.Equals(each.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return key == null ? defaultValue : (T)converter(dictionary[key]); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + internal static T GetValueForProperty(this System.Collections.IDictionary dictionary, string propertyName, T defaultValue, System.Func converter) + { + try + { + var key = System.Linq.Enumerable.FirstOrDefault(dictionary.Keys.OfType(), each => System.String.Equals(each.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return key == null ? defaultValue : (T)converter(dictionary[key]); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + + internal static T GetValueForProperty(this System.Management.Automation.PSObject psObject, string propertyName, T defaultValue, System.Func converter) + { + try + { + var property = System.Linq.Enumerable.FirstOrDefault(psObject.Properties, each => System.String.Equals(each.Name.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return property == null ? defaultValue : (T)converter(property.Value); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + + internal static bool Contains(this System.Management.Automation.PSObject psObject, string propertyName) + { + bool result = false; + try + { + var property = System.Linq.Enumerable.FirstOrDefault(psObject.Properties, each => System.String.Equals(each.Name.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + result = property == null ? false : true; + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return result; + } + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/UndeclaredResponseException.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/UndeclaredResponseException.cs new file mode 100644 index 000000000000..52c2a2694943 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/UndeclaredResponseException.cs @@ -0,0 +1,112 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + using System; + using System.Net.Http; + using System.Net.Http.Headers; + using static Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Extensions; + + public class RestException : Exception, IDisposable + { + public System.Net.HttpStatusCode StatusCode { get; set; } + public string Code { get; protected set; } + protected string message; + public HttpRequestMessage RequestMessage { get; protected set; } + public HttpResponseHeaders ResponseHeaders { get; protected set; } + + public string ResponseBody { get; protected set; } + public string ClientRequestId { get; protected set; } + public string RequestId { get; protected set; } + + public override string Message => message; + public string Action { get; protected set; } + + public RestException(System.Net.Http.HttpResponseMessage response) + { + StatusCode = response.StatusCode; + //CloneWithContent will not work here since the content is disposed after sendAsync + //Besides, it seems there is no need for the request content cloned here. + RequestMessage = response.RequestMessage.Clone(); + ResponseBody = response.Content.ReadAsStringAsync().Result; + ResponseHeaders = response.Headers; + + RequestId = response.GetFirstHeader("x-ms-request-id"); + ClientRequestId = response.GetFirstHeader("x-ms-client-request-id"); + + try + { + // try to parse the body as JSON, and see if a code and message are in there. + var json = Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonNode.Parse(ResponseBody) as Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json.JsonObject; + + // error message could be in properties.statusMessage + { message = If(json?.Property("properties"), out var p) + && If(p?.PropertyT("statusMessage"), out var sm) + ? (string)sm : (string)Message; } + + // see if there is an error block in the body + json = json?.Property("error") ?? json; + + { Code = If(json?.PropertyT("code"), out var c) ? (string)c : (string)StatusCode.ToString(); } + { message = If(json?.PropertyT("message"), out var m) ? (string)m : (string)Message; } + { Action = If(json?.PropertyT("action"), out var a) ? (string)a : (string)Action; } + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // couldn't get the code/message from the body response. + // In this case, we will assume the response is the expected error message + if(!string.IsNullOrEmpty(ResponseBody)) { + message = ResponseBody; + } + } +#endif + if (string.IsNullOrEmpty(message)) + { + if (StatusCode >= System.Net.HttpStatusCode.BadRequest && StatusCode < System.Net.HttpStatusCode.InternalServerError) + { + message = $"The server responded with a Request Error, Status: {StatusCode}"; + } + else if (StatusCode >= System.Net.HttpStatusCode.InternalServerError) + { + message = $"The server responded with a Server Error, Status: {StatusCode}"; + } + else + { + message = $"The server responded with an unrecognized response, Status: {StatusCode}"; + } + } + } + + public void Dispose() + { + ((IDisposable)RequestMessage).Dispose(); + } + } + + public class RestException : RestException + { + public T Error { get; protected set; } + public RestException(System.Net.Http.HttpResponseMessage response, T error) : base(response) + { + Error = error; + } + } + + + public class UndeclaredResponseException : RestException + { + public UndeclaredResponseException(System.Net.Http.HttpResponseMessage response) : base(response) + { + + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Writers/JsonWriter.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Writers/JsonWriter.cs new file mode 100644 index 000000000000..e363d78a8c74 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/Writers/JsonWriter.cs @@ -0,0 +1,223 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Web; + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Json +{ + internal class JsonWriter + { + const string indentation = " "; // 2 spaces + + private readonly bool pretty; + private readonly TextWriter writer; + + protected int currentLevel = 0; + + internal JsonWriter(TextWriter writer, bool pretty = true) + { + this.writer = writer ?? throw new ArgumentNullException(nameof(writer)); + this.pretty = pretty; + } + + internal void WriteNode(JsonNode node) + { + switch (node.Type) + { + case JsonType.Array: WriteArray((IEnumerable)node); break; + case JsonType.Object: WriteObject((JsonObject)node); break; + + // Primitives + case JsonType.Binary: WriteBinary((XBinary)node); break; + case JsonType.Boolean: WriteBoolean((bool)node); break; + case JsonType.Date: WriteDate((JsonDate)node); break; + case JsonType.Null: WriteNull(); break; + case JsonType.Number: WriteNumber((JsonNumber)node); break; + case JsonType.String: WriteString(node); break; + } + } + + internal void WriteArray(IEnumerable array) + { + currentLevel++; + + writer.Write('['); + + bool doIndentation = false; + + if (pretty) + { + foreach (var node in array) + { + if (node.Type == JsonType.Object || node.Type == JsonType.Array) + { + doIndentation = true; + + break; + } + } + } + + bool isFirst = true; + + foreach (JsonNode node in array) + { + if (!isFirst) writer.Write(','); + + if (doIndentation) + { + WriteIndent(); + } + else if (pretty) + { + writer.Write(' '); + } + + WriteNode(node); + + isFirst = false; + } + + currentLevel--; + + if (doIndentation) + { + WriteIndent(); + } + else if (pretty) + { + writer.Write(' '); + } + + writer.Write(']'); + } + + internal void WriteIndent() + { + if (pretty) + { + writer.Write(Environment.NewLine); + + for (int level = 0; level < currentLevel; level++) + { + writer.Write(indentation); + } + } + } + + internal void WriteObject(JsonObject obj) + { + currentLevel++; + + writer.Write('{'); + + bool isFirst = true; + + foreach (var field in obj) + { + if (!isFirst) writer.Write(','); + + WriteIndent(); + + WriteFieldName(field.Key); + + writer.Write(':'); + + if (pretty) + { + writer.Write(' '); + } + + // Write the field value + WriteNode(field.Value); + + isFirst = false; + } + + currentLevel--; + + WriteIndent(); + + writer.Write('}'); + } + + internal void WriteFieldName(string fieldName) + { + writer.Write('"'); + writer.Write(HttpUtility.JavaScriptStringEncode(fieldName)); + writer.Write('"'); + } + + #region Primitives + + internal void WriteBinary(XBinary value) + { + writer.Write('"'); + writer.Write(value.ToString()); + writer.Write('"'); + } + + internal void WriteBoolean(bool value) + { + writer.Write(value ? "true" : "false"); + } + + internal void WriteDate(JsonDate date) + { + if (date.ToDateTime().Year == 1) + { + WriteNull(); + } + else + { + writer.Write('"'); + writer.Write(date.ToIsoString()); + writer.Write('"'); + } + } + + internal void WriteNull() + { + writer.Write("null"); + } + + internal void WriteNumber(JsonNumber number) + { + if (number.Overflows) + { + writer.Write('"'); + writer.Write(number.Value); + writer.Write('"'); + } + else + { + writer.Write(number.Value); + } + } + + internal void WriteString(string text) + { + if (text == null) + { + WriteNull(); + } + else + { + writer.Write('"'); + + writer.Write(HttpUtility.JavaScriptStringEncode(text)); + + writer.Write('"'); + } + } + + #endregion + } +} + + +// TODO: Replace with System.Text.Json when available diff --git a/src/StackHCI/StackHCIVm.Autorest/generated/runtime/delegates.cs b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/delegates.cs new file mode 100644 index 000000000000..cbe605421e12 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/generated/runtime/delegates.cs @@ -0,0 +1,23 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime +{ + using System; + using System.Collections; + using System.Collections.Generic; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using GetEventData=System.Func; + + public delegate Task SendAsync(HttpRequestMessage request, IEventListener callback); + public delegate Task SendAsyncStep(HttpRequestMessage request, IEventListener callback, ISendAsync next); + public delegate Task SignalEvent(string id, CancellationToken token, GetEventData getEventData); + public delegate Task Event(EventData message); + public delegate void SynchEvent(EventData message); + public delegate Task OnResponse(Response message); + public delegate Task OnResponse(Response message); +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/how-to.md b/src/StackHCI/StackHCIVm.Autorest/how-to.md new file mode 100644 index 000000000000..2a2fcf97c928 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/how-to.md @@ -0,0 +1,58 @@ +# How-To +This document describes how to develop for `Az.StackHCIVm`. + +## Building `Az.StackHCIVm` +To build, run the `build-module.ps1` at the root of the module directory. This will generate the proxy script cmdlets that are the cmdlets being exported by this module. After the build completes, the proxy script cmdlets will be output to the `exports` folder. To read more about the proxy script cmdlets, look at the [README.md](exports/README.md) in the `exports` folder. + +## Creating custom cmdlets +To add cmdlets that were not generated by the REST specification, use the `custom` folder. This folder allows you to add handwritten `.ps1` and `.cs` files. Currently, we support using `.ps1` scripts as new cmdlets or as additional low-level variants (via `ParameterSet`), and `.cs` files as low-level (variants) cmdlets that the exported script cmdlets call. We do not support exporting any `.cs` (dll) cmdlets directly. To read more about custom cmdlets, look at the [README.md](custom/README.md) in the `custom` folder. + +## Generating documentation +To generate documentation, the process is now integrated into the `build-module.ps1` script. If you don't want to run this process as part of `build-module.ps1`, you can provide the `-NoDocs` switch. If you want to run documentation generation after the build process, you may still run the `generate-help.ps1` script. Overall, the process will look at the documentation comments in the generated and custom cmdlets and types, and create `.md` files into the `docs` folder. Additionally, this pulls in any examples from the `examples` folder and adds them to the generated help markdown documents. To read more about examples, look at the [README.md](examples/README.md) in the `examples` folder. To read more about documentation, look at the [README.md](docs/README.md) in the `docs` folder. + +## Testing `Az.StackHCIVm` +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. + +## Packing `Az.StackHCIVm` +To pack `Az.StackHCIVm` 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. + +## Module Script Details +There are multiple scripts created for performing different actions for developing `Az.StackHCIVm`. +- `build-module.ps1` + - Builds the module DLL (`./bin/Az.StackHCIVm.private.dll`), creates the exported cmdlets and documentation, generates custom cmdlet test stubs and exported cmdlet example stubs, and updates `./Az.StackHCIVm.psd1` with Azure profile information. + - **Parameters**: [`Switch` parameters] + - `-Run`: After building, creates an isolated PowerShell session and loads `Az.StackHCIVm`. + - `-Test`: After building, runs the `Pester` tests defined in the `test` folder. + - `-Docs`: After building, generates the Markdown documents for the modules into the `docs` folder. + - `-Pack`: After building, packages the module into a `.nupkg`. + - `-Code`: After building, opens a VSCode window with the module's directory and runs (see `-Run`) the module. + - `-Release`: Builds the module in `Release` configuration (as opposed to `Debug` configuration). + - `-NoDocs`: Supresses writing the documentation markdown files as part of the cmdlet exporting process. + - `-Debugger`: Used when attaching the debugger in Visual Studio to the PowerShell session, and running the build process without recompiling the DLL. This suppresses running the script as an isolated process. +- `run-module.ps1` + - Creates an isolated PowerShell session and loads `Az.StackHCIVm` into the session. + - Same as `-Run` in `build-module.ps1`. + - **Parameters**: [`Switch` parameters] + - `-Code`: Opens a VSCode window with the module's directory. + - Same as `-Code` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. +- `test-module.ps1` + - Runs the `Pester` tests defined in the `test` folder. + - Same as `-Test` in `build-module.ps1`. +- `pack-module.ps1` + - Packages the module into a `.nupkg` for distribution. + - Same as `-Pack` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. + - This process is now integrated into `build-module.ps1` automatically. To disable, use `-NoDocs` when running `build-module.ps1`. +- `export-surface.ps1` + - Generates Markdown documents for both the cmdlet surface and the model (class) surface of the module. + - These files are placed into the `resources` folder. + - Used for investigating the surface of your module. These are *not* documentation for distribution. +- `check-dependencies.ps1` + - Used in `run-module.ps1` and `test-module.ps1` to verify dependent modules are available to run those tasks. + - It will download local (within the module's directory structure) versions of those modules as needed. + - This script *does not* need to be ran by-hand. \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Az.StackHCIVm.internal.psm1 b/src/StackHCI/StackHCIVm.Autorest/internal/Az.StackHCIVm.internal.psm1 new file mode 100644 index 000000000000..eb6509dab4f2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Az.StackHCIVm.internal.psm1 @@ -0,0 +1,38 @@ +# region Generated + # Load the private module dll + $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.StackHCIVm.private.dll') + + # Get the private module's instance + $instance = [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Module]::Instance + + # Export nothing to clear implicit exports + Export-ModuleMember + + # Export proxy cmdlet scripts + $exportsPath = $PSScriptRoot + $directories = Get-ChildItem -Directory -Path $exportsPath + $profileDirectory = $null + if($instance.ProfileName) { + if(($directories | ForEach-Object { $_.Name }) -contains $instance.ProfileName) { + $profileDirectory = $directories | Where-Object { $_.Name -eq $instance.ProfileName } + } else { + # Don't export anything if the profile doesn't exist for the module + $exportsPath = $null + Write-Warning "Selected Azure profile '$($instance.ProfileName)' does not exist for module '$($instance.Name)'. No cmdlets were loaded." + } + } elseif(($directories | Measure-Object).Count -gt 0) { + # 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 + Export-ModuleMember -Function $cmdletNames -Alias (Get-ScriptCmdlet -ScriptFolder $exportsPath -AsAlias) + } +# endregion diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmAgentVersion.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmAgentVersion.ps1 new file mode 100644 index 000000000000..38d03aa6d405 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmAgentVersion.ps1 @@ -0,0 +1,141 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets an Agent Version along with the download link currently present. +.Description +Gets an Agent Version along with the download link currently present. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsList +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmagentversion +#> +function Get-AzStackHCIVmAgentVersion { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion], [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsList])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Defines the os type + ${OSType}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Defines the agent version. + # To get latest, use latest or else a specific agent version. + ${Version}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmAgentVersion_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmAgentVersion_List'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmExtensionMetadata.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmExtensionMetadata.ps1 new file mode 100644 index 000000000000..ff9e03c69a71 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmExtensionMetadata.ps1 @@ -0,0 +1,160 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets an Extension Metadata based on location, publisher, extensionType and version +.Description +Gets an Extension Metadata based on location, publisher, extensionType and version +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmextensionmetadata +#> +function Get-AzStackHCIVmExtensionMetadata { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The extensionType of the Extension being received. + ${ExtensionType}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The location of the Extension being received. + ${Location}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The publisher of the Extension being received. + ${Publisher}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The version of the Extension being received. + ${Version}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmExtensionMetadata_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmExtensionMetadata_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmGalleryImage.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmGalleryImage.ps1 new file mode 100644 index 000000000000..a40692cf8953 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmGalleryImage.ps1 @@ -0,0 +1,152 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets a gallery image +.Description +Gets a gallery image +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmgalleryimage +#> +function Get-AzStackHCIVmGalleryImage { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('GalleryImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the gallery image + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmGalleryImage_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmGalleryImage_List'; + List1 = 'Az.StackHCIVm.private\Get-AzStackHCIVmGalleryImage_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmGuestAgent.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmGuestAgent.ps1 new file mode 100644 index 000000000000..d1c53690949e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmGuestAgent.ps1 @@ -0,0 +1,132 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Implements GuestAgent GET method. +.Description +Implements GuestAgent GET method. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmguestagent +#> +function Get-AzStackHCIVmGuestAgent { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent])] +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmGuestAgent_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmGuestAgent_List'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmHybridIdentityMetadata.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmHybridIdentityMetadata.ps1 new file mode 100644 index 000000000000..2f633a7871a4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmHybridIdentityMetadata.ps1 @@ -0,0 +1,203 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Implements HybridIdentityMetadata GET method. +.Description +Implements HybridIdentityMetadata GET method. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmhybrididentitymetadata +#> +function Get-AzStackHCIVmHybridIdentityMetadata { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata], [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated])] +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter(ParameterSetName='Get1', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the hybrid machine. + ${MachineName}, + + [Parameter(ParameterSetName='Get1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the HybridIdentityMetadata. + ${MetadataName}, + + [Parameter(ParameterSetName='Get1', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get1')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity1', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmHybridIdentityMetadata_Get'; + Get1 = 'Az.StackHCIVm.private\Get-AzStackHCIVmHybridIdentityMetadata_Get1'; + GetViaIdentity1 = 'Az.StackHCIVm.private\Get-AzStackHCIVmHybridIdentityMetadata_GetViaIdentity1'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmHybridIdentityMetadata_List'; + List1 = 'Az.StackHCIVm.private\Get-AzStackHCIVmHybridIdentityMetadata_List1'; + } + if (('Get1', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmMachine.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmMachine.ps1 new file mode 100644 index 000000000000..1b8064b07521 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmMachine.ps1 @@ -0,0 +1,159 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Retrieves information about the model view or the instance view of a hybrid machine. +.Description +Retrieves information about the model view or the instance view of a hybrid machine. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmmachine +#> +function Get-AzStackHCIVmMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('MachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the hybrid machine. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Get')] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.InstanceViewTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Query')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.InstanceViewTypes] + # The expand expression to apply on the operation. + ${Expand}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmMachine_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmMachine_List'; + List1 = 'Az.StackHCIVm.private\Get-AzStackHCIVmMachine_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmMachineExtension.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmMachineExtension.ps1 new file mode 100644 index 000000000000..dddebc782f38 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmMachineExtension.ps1 @@ -0,0 +1,161 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to get the extension. +.Description +The operation to get the extension. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmmachineextension +#> +function Get-AzStackHCIVmMachineExtension { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the machine containing the extension. + ${MachineName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the machine extension. + ${ExtensionName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Query')] + [System.String] + # The expand expression to apply on the operation. + ${Expand}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmMachineExtension_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmMachineExtension_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmMarketplaceGalleryImage.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmMarketplaceGalleryImage.ps1 new file mode 100644 index 000000000000..961ce5b774bc --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmMarketplaceGalleryImage.ps1 @@ -0,0 +1,152 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets a marketplace gallery image +.Description +Gets a marketplace gallery image +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmmarketplacegalleryimage +#> +function Get-AzStackHCIVmMarketplaceGalleryImage { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('MarketplaceGalleryImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the marketplace gallery image + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmMarketplaceGalleryImage_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmMarketplaceGalleryImage_List'; + List1 = 'Az.StackHCIVm.private\Get-AzStackHCIVmMarketplaceGalleryImage_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmNetworkProfile.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmNetworkProfile.ps1 new file mode 100644 index 000000000000..f513d042e2cf --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmNetworkProfile.ps1 @@ -0,0 +1,148 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to get network information of hybrid machine +.Description +The operation to get network information of hybrid machine +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmnetworkprofile +#> +function Get-AzStackHCIVmNetworkProfile { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface])] +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the hybrid machine. + ${MachineName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmNetworkProfile_Get'; + } + if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmOperation.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmOperation.ps1 new file mode 100644 index 000000000000..737a18bf7af7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmOperation.ps1 @@ -0,0 +1,128 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +List all the supported operations. +.Description +List all the supported operations. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmoperation +#> +function Get-AzStackHCIVmOperation { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation], [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmOperation_List'; + List1 = 'Az.StackHCIVm.private\Get-AzStackHCIVmOperation_List1'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmVirtualMachine.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmVirtualMachine.ps1 new file mode 100644 index 000000000000..643dfc71aa37 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Get-AzStackHCIVmVirtualMachine.ps1 @@ -0,0 +1,132 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets a virtual machine instance +.Description +Gets a virtual machine instance +.Example +Get-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" +.Example +Get-AzStackHCIVmVirtualMachine -ResourceGroupName "test-rg" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmvirtualmachine +#> +function Get-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmVirtualMachine_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmVirtualMachine_List'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmGalleryImage.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmGalleryImage.ps1 new file mode 100644 index 000000000000..6d2d89e230d0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmGalleryImage.ps1 @@ -0,0 +1,242 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a gallery image. +Please note some properties can be set only during gallery image creation. +.Description +The operation to create or update a gallery image. +Please note some properties can be set only during gallery image creation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmgalleryimage +#> +function New-AzStackHCIVmGalleryImage { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('GalleryImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the gallery image + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource] + # Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + ${CloudInitDataSource}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration] + # The hypervisor generation of the Virtual Machine [V1, V2] + ${HyperVGeneration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # location of the image the gallery image should be created from + ${ImagePath}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes] + # Operating system type that the gallery image uses [Windows, Linux] + ${OSType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition offer. + ${Offer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition publisher. + ${Publisher}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition SKU. + ${Sku}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage ContainerID of the storage container to be used for gallery image + ${StoragePathId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # This is the version of the gallery image. + ${Version}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + CreateExpanded = 'Az.StackHCIVm.private\New-AzStackHCIVmGalleryImage_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('ExtendedLocationType')) { + $PSBoundParameters['ExtendedLocationType'] = "CustomLocation" + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmGuestAgent.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmGuestAgent.ps1 new file mode 100644 index 000000000000..f36cff467f70 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmGuestAgent.ps1 @@ -0,0 +1,162 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create Or Update GuestAgent. +.Description +Create Or Update GuestAgent. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmguestagent +#> +function New-AzStackHCIVmGuestAgent { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The password to connect with the guest. + ${CredentialsPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The username to connect with the guest. + ${CredentialsUsername}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction] + # The guest agent provisioning action. + ${ProvisioningAction}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + CreateExpanded = 'Az.StackHCIVm.private\New-AzStackHCIVmGuestAgent_CreateExpanded'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmLogicalNetwork.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmLogicalNetwork.ps1 new file mode 100644 index 000000000000..85a0592dbe1f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmLogicalNetwork.ps1 @@ -0,0 +1,226 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a logical network. +Please note some properties can be set only during logical network creation. +.Description +The operation to create or update a logical network. +Please note some properties can be set only during logical network creation. +.Example +New-AzStackHCIVmLogicalNetwork -Name "testLnet" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -VmSwitchName "testswitch" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +SUBNET : Subnet - list of subnets under the logical network + [AddressPrefix ]: The address prefix for the subnet: Cidr for this subnet - IPv4, IPv6. + [AddressPrefixes ]: List of address prefixes for the subnet. + [IPAllocationMethod ]: IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic' + [IPConfigurationReference ]: IPConfigurationReferences - list of IPConfigurationReferences + [Id ]: IPConfigurationID + [IPPool ]: network associated pool of IP Addresses + [End ]: End of the IP address pool + [Name ]: Name of the IP-Pool + [Start ]: Start of the IP address pool + [Type ]: Type of the IP Pool [vm, vippool] + [Name ]: Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + [Route ]: Collection of routes contained within a route table. + [AddressPrefix ]: The destination CIDR to which the route applies. + [Name ]: Name - name of the subnet + [NextHopIPAddress ]: The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance. + [Vlan ]: Vlan to use for the subnet +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmlogicalnetwork +#> +function New-AzStackHCIVmLogicalNetwork { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('LogicalNetworkName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the logical network + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # The list of DNS servers IP addresses. + ${DnsServer}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet[]] + # Subnet - list of subnets under the logical network + # To construct, see NOTES section for SUBNET properties and create a hash table. + ${Subnet}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # name of the network switch to be used for VMs + ${VMSwitchName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + CreateExpanded = 'Az.StackHCIVm.private\New-AzStackHCIVmLogicalNetwork_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('ExtendedLocationType')) { + $PSBoundParameters['ExtendedLocationType'] = "CustomLocation" + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmMachine.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmMachine.ps1 new file mode 100644 index 000000000000..994966ef6e33 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmMachine.ps1 @@ -0,0 +1,330 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a hybrid machine. +Please note some properties can be set only during machine creation. +.Description +The operation to create or update a hybrid machine. +Please note some properties can be set only during machine creation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +EXTENSION : Machine Extensions information (deprecated field) + [Name ]: The machine extension name. + [StatusCode ]: The status code. + [StatusDisplayStatus ]: The short localizable label for the status. + [StatusLevel ]: The level code. + [StatusMessage ]: The detailed status message, including for alerts and error messages. + [StatusTime ]: The time of the status. + [Type ]: Specifies the type of the extension; an example is "CustomScriptExtension". + [TypeHandlerVersion ]: Specifies the version of the script handler. +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmmachine +#> +function New-AzStackHCIVmMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('MachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the hybrid machine. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The correlation ID passed in from RSM per upgrade. + ${AgentUpgradeCorrelationId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the version info w.r.t AgentUpgrade for the machine. + ${AgentUpgradeDesiredVersion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Specifies if RSM should try to upgrade this machine + ${AgentUpgradeEnableAutomaticUpgrade}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Public Key that the client provides to be used during initial resource onboarding + ${ClientPublicKey}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView[]] + # Machine Extensions information (deprecated field) + # To construct, see NOTES section for EXTENSION properties and create a hash table. + ${Extension}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The behavior of the service when the Arc-enabled machine starts up. + ${ExtensionServiceStartupType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The current status of the service. + ${ExtensionServiceStatus}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The behavior of the service when the Arc-enabled machine starts up. + ${GuestConfigurationServiceStartupType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The current status of the service. + ${GuestConfigurationServiceStatus}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType] + # The identity type. + ${IdentityType}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind] + # Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc. + ${Kind}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes] + # Specifies the assessment mode. + ${LinuxConfigurationPatchSettingsAssessmentMode}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes] + # Specifies the patch mode. + ${LinuxConfigurationPatchSettingsPatchMode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The city or locality where the resource is located. + ${LocationDataCity}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The country or region where the resource is located + ${LocationDataCountryOrRegion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The district, state, or province where the resource is located. + ${LocationDataDistrict}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # A canonical name for the geographic or physical location. + ${LocationDataName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies whether any MS SQL instance is discovered on the machine. + ${MssqlDiscovered}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The type of Operating System (windows/linux). + ${OSType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + ${ParentClusterResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The resource id of the private link scope this machine is assigned to, if any. + ${PrivateLinkScopeResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the hybrid machine unique ID. + ${VMId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes] + # Specifies the assessment mode. + ${WindowsConfigurationPatchSettingsAssessmentMode}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes] + # Specifies the patch mode. + ${WindowsConfigurationPatchSettingsPatchMode}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + CreateExpanded = 'Az.StackHCIVm.private\New-AzStackHCIVmMachine_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmMachineExtension.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmMachineExtension.ps1 new file mode 100644 index 000000000000..8a51949d91aa --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmMachineExtension.ps1 @@ -0,0 +1,279 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update the extension. +.Description +The operation to create or update the extension. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmmachineextension +#> +function New-AzStackHCIVmMachineExtension { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the machine extension. + ${ExtensionName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the machine where the extension should be created or updated. + ${MachineName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether the extension should use a newer minor version if one is available at deployment time. + # Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + ${AutoUpgradeMinorVersion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + ${EnableAutomaticUpgrade}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # How the extension handler should be forced to update even if the extension configuration has not changed. + ${ForceUpdateTag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The machine extension name. + ${InstanceViewName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the type of the extension; an example is "CustomScriptExtension". + ${InstanceViewType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the version of the script handler. + ${InstanceViewTypeHandlerVersion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the type of the extension; an example is "CustomScriptExtension". + ${PropertiesType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings]))] + [System.Collections.Hashtable] + # The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ${ProtectedSetting}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extension handler publisher. + ${Publisher}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings]))] + [System.Collections.Hashtable] + # Json formatted public settings for the extension. + ${Setting}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The status code. + ${StatusCode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The short localizable label for the status. + ${StatusDisplayStatus}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes] + # The level code. + ${StatusLevel}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The detailed status message, including for alerts and error messages. + ${StatusMessage}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.DateTime] + # The time of the status. + ${StatusTime}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the version of the script handler. + ${TypeHandlerVersion}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + CreateExpanded = 'Az.StackHCIVm.private\New-AzStackHCIVmMachineExtension_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmMarketplaceGalleryImage.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmMarketplaceGalleryImage.ps1 new file mode 100644 index 000000000000..928768b1895e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmMarketplaceGalleryImage.ps1 @@ -0,0 +1,236 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a marketplace gallery image. +Please note some properties can be set only during marketplace gallery image creation. +.Description +The operation to create or update a marketplace gallery image. +Please note some properties can be set only during marketplace gallery image creation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmmarketplacegalleryimage +#> +function New-AzStackHCIVmMarketplaceGalleryImage { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('MarketplaceGalleryImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the marketplace gallery image + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource] + # Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + ${CloudInitDataSource}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration] + # The hypervisor generation of the Virtual Machine [V1, V2] + ${HyperVGeneration}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes] + # Operating system type that the gallery image uses [Windows, Linux] + ${OSType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition offer. + ${Offer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition publisher. + ${Publisher}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition SKU. + ${Sku}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage ContainerID of the storage container to be used for marketplace gallery image + ${StoragePathId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # This is the version of the gallery image. + ${Version}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + CreateExpanded = 'Az.StackHCIVm.private\New-AzStackHCIVmMarketplaceGalleryImage_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('ExtendedLocationType')) { + $PSBoundParameters['ExtendedLocationType'] = "CustomLocation" + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmNetworkInterface.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmNetworkInterface.ps1 new file mode 100644 index 000000000000..392fbe0f5438 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmNetworkInterface.ps1 @@ -0,0 +1,213 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a network interface. +Please note some properties can be set only during network interface creation. +.Description +The operation to create or update a network interface. +Please note some properties can be set only during network interface creation. +.Example +New-AzStackHCIVmNetworkInterface -Name "testNic" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -SubnetName "testLnet" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +IPCONFIGURATION : IPConfigurations - A list of IPConfigurations of the network interface. + [IPAddress ]: PrivateIPAddress - Private IP address of the IP configuration. + [Name ]: Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + [SubnetId ]: ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmnetworkinterface +#> +function New-AzStackHCIVmNetworkInterface { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('NetworkInterfaceName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the network interface + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # List of DNS server IP Addresses for the interface + ${DnsServer}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration[]] + # IPConfigurations - A list of IPConfigurations of the network interface. + # To construct, see NOTES section for IPCONFIGURATION properties and create a hash table. + ${IPConfiguration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # MacAddress - The MAC address of the network interface. + ${MacAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + CreateExpanded = 'Az.StackHCIVm.private\New-AzStackHCIVmNetworkInterface_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('ExtendedLocationType')) { + $PSBoundParameters['ExtendedLocationType'] = "CustomLocation" + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmStoragePath.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmStoragePath.ps1 new file mode 100644 index 000000000000..5cdc48182e30 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmStoragePath.ps1 @@ -0,0 +1,189 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a storage container. +Please note some properties can be set only during storage container creation. +.Description +The operation to create or update a storage container. +Please note some properties can be set only during storage container creation. +.Example +New-AzStackHCIVmStoragePath -Name "testStoragePath" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}"-Location "eastus" -Path "C:\ClusterStorage\Volume1\testpath" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmstoragepath +#> +function New-AzStackHCIVmStoragePath { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('StorageContainerName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the storage container + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Path of the storage container on the disk + ${Path}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + CreateExpanded = 'Az.StackHCIVm.private\New-AzStackHCIVmStoragePath_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('ExtendedLocationType')) { + $PSBoundParameters['ExtendedLocationType'] = "CustomLocation" + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmVirtualHardDisk.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmVirtualHardDisk.ps1 new file mode 100644 index 000000000000..5b05bc495d9c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmVirtualHardDisk.ps1 @@ -0,0 +1,233 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a virtual hard disk. +Please note some properties can be set only during virtual hard disk creation. +.Description +The operation to create or update a virtual hard disk. +Please note some properties can be set only during virtual hard disk creation. +.Example +New-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -SizeGb 2 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmvirtualharddisk +#> +function New-AzStackHCIVmVirtualHardDisk { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('VirtualHardDiskName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual hard disk + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # . + ${BlockSizeByte}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat] + # The format of the actual VHD file [vhd, vhdx] + ${DiskFileFormat}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Boolean for enabling dynamic sizing on the virtual hard disk + ${Dynamic}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration] + # The hypervisor generation of the Virtual Machine [V1, V2] + ${HyperVGeneration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # . + ${LogicalSectorByte}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # . + ${PhysicalSectorByte}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # Size of the disk in GB + ${SizeGb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage ContainerID of the storage container to be used for VHD + ${StoragePathId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + CreateExpanded = 'Az.StackHCIVm.private\New-AzStackHCIVmVirtualHardDisk_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('ExtendedLocationType')) { + $PSBoundParameters['ExtendedLocationType'] = "CustomLocation" + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmVirtualMachine.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmVirtualMachine.ps1 new file mode 100644 index 000000000000..d4d46a9a33ff --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/New-AzStackHCIVmVirtualMachine.ps1 @@ -0,0 +1,387 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a virtual machine instance. +Please note some properties can be set only during virtual machine instance creation. +.Description +The operation to create or update a virtual machine instance. +Please note some properties can be set only during virtual machine instance creation. +.Example +New-AzStackHCIVmVirtualMachine -Name "testVm" -OsType "Linux" -ImageName "testImage" -VmSize "Standard_K8S_v1" -AdminUsername "localadmin" -ComputerName "testVm" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" +.Example +New-AzStackHCIVmVirtualMachine -Name "testVm" -OsType "Linux" -OsDiskName "testOsDisk" -VmSize "Standard_K8S_v1" -AdminUsername "localadmin" -ComputerName "testVm" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +LINUXCONFIGURATIONSSHPUBLICKEY : The list of SSH public keys used to authenticate with linux based VMs. + [KeyData ]: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + [Path ]: Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file. Example: /home/user/.ssh/authorized_keys + +NETWORKPROFILENETWORKINTERFACE : NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + [Id ]: ID - Resource Id of the network interface + +STORAGEPROFILEDATADISK : adds data disks to the virtual machine instance + [Id ]: Resource ID of the data disk + +WINDOWSCONFIGURATIONSSHPUBLICKEY : The list of SSH public keys used to authenticate with linux based VMs. + [KeyData ]: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + [Path ]: Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file. Example: /home/user/.ssh/authorized_keys +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmvirtualmachine +#> +function New-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # AdminPassword - admin password + ${AdminPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # AdminUsername - admin username + ${AdminUsername}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # ComputerName - name of the compute + ${ComputerName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # DisablePasswordAuthentication - whether password authentication should be disabled + ${DisablePasswordAuthentication}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # . + ${DynamicMemoryMaximumMemoryInMb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # . + ${DynamicMemoryMinimumMemoryInMb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage of the total memory that the virtual machine instance is thought to need. + # This only applies to virtual systems with dynamic memory enabled. + # This property can be in the range of 5 to 2000. + ${DynamicMemoryTargetBuffer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Whether to EnableAutomaticUpdates on the machine + ${EnableAutomaticUpdate}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # . + ${EnableTpm}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The HTTP proxy server endpoint to use. + ${HttpProxyConfigHttpProxy}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The HTTPS proxy server endpoint to use. + ${HttpProxyConfigHttpsProxy}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # The endpoints that should not go through proxy. + ${HttpProxyConfigNoProxy}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Alternative CA cert to use for connecting to proxy servers. + ${HttpProxyConfigTrustedCa}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType] + # The identity type. + ${IdentityType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource ID of the image + ${ImageId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process. + ${LinuxConfigurationProvisionVMAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + ${LinuxConfigurationProvisionVMConfigAgent}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]] + # The list of SSH public keys used to authenticate with linux based VMs. + # To construct, see NOTES section for LINUXCONFIGURATIONSSHPUBLICKEY properties and create a hash table. + ${LinuxConfigurationSshPublicKey}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem[]] + # NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + # To construct, see NOTES section for NETWORKPROFILENETWORKINTERFACE properties and create a hash table. + ${NetworkProfileNetworkInterface}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource ID of the OS disk + ${OSDiskId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes] + # This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. + # Possible values are: **Windows,** **Linux.** + ${OSDiskOstype}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Unique identifier defined by ARC to identify the guest of the VM. + ${ResourceUid}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Specifies whether secure boot should be enabled on the virtual machine instance. + ${SecureBootEnabled}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes] + # Specifies the SecurityType of the virtual machine. + # EnableTPM and SecureBootEnabled must be set to true for SecurityType to function. + ${SecurityProfileSecurityType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Id of the storage container that hosts the VM configuration file + ${StoragePathId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem[]] + # adds data disks to the virtual machine instance + # To construct, see NOTES section for STORAGEPROFILEDATADISK properties and create a hash table. + ${StorageProfileDataDisk}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # TimeZone for the virtual machine instance + ${TimeZone}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # RAM in MB for the virtual machine instance + ${VmMemory}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # number of processors for the virtual machine instance + ${VmProcessor}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum] + # . + ${VmSize}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process. + ${WindowConfigurationProvisionVMAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + ${WindowConfigurationProvisionVMConfigAgent}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]] + # The list of SSH public keys used to authenticate with linux based VMs. + # To construct, see NOTES section for WINDOWSCONFIGURATIONSSHPUBLICKEY properties and create a hash table. + ${WindowsConfigurationSshPublicKey}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + CreateExpanded = 'Az.StackHCIVm.private\New-AzStackHCIVmVirtualMachine_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('ExtendedLocationType')) { + $PSBoundParameters['ExtendedLocationType'] = "CustomLocation" + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/ProxyCmdletDefinitions.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/ProxyCmdletDefinitions.ps1 new file mode 100644 index 000000000000..0b947dde883e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/ProxyCmdletDefinitions.ps1 @@ -0,0 +1,9733 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets an Agent Version along with the download link currently present. +.Description +Gets an Agent Version along with the download link currently present. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsList +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmagentversion +#> +function Get-AzStackHCIVmAgentVersion { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersion], [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IAgentVersionsList])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Defines the os type + ${OSType}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Defines the agent version. + # To get latest, use latest or else a specific agent version. + ${Version}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmAgentVersion_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmAgentVersion_List'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +Gets an Extension Metadata based on location, publisher, extensionType and version +.Description +Gets an Extension Metadata based on location, publisher, extensionType and version +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmextensionmetadata +#> +function Get-AzStackHCIVmExtensionMetadata { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionValue])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The extensionType of the Extension being received. + ${ExtensionType}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The location of the Extension being received. + ${Location}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The publisher of the Extension being received. + ${Publisher}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The version of the Extension being received. + ${Version}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmExtensionMetadata_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmExtensionMetadata_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +Gets a gallery image +.Description +Gets a gallery image +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmgalleryimage +#> +function Get-AzStackHCIVmGalleryImage { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('GalleryImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the gallery image + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmGalleryImage_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmGalleryImage_List'; + List1 = 'Az.StackHCIVm.private\Get-AzStackHCIVmGalleryImage_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +Implements GuestAgent GET method. +.Description +Implements GuestAgent GET method. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmguestagent +#> +function Get-AzStackHCIVmGuestAgent { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent])] +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmGuestAgent_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmGuestAgent_List'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +Implements HybridIdentityMetadata GET method. +.Description +Implements HybridIdentityMetadata GET method. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmhybrididentitymetadata +#> +function Get-AzStackHCIVmHybridIdentityMetadata { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IHybridIdentityMetadata], [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IHybridIdentityMetadataAutoGenerated])] +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter(ParameterSetName='Get1', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the hybrid machine. + ${MachineName}, + + [Parameter(ParameterSetName='Get1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the HybridIdentityMetadata. + ${MetadataName}, + + [Parameter(ParameterSetName='Get1', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get1')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity1', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmHybridIdentityMetadata_Get'; + Get1 = 'Az.StackHCIVm.private\Get-AzStackHCIVmHybridIdentityMetadata_Get1'; + GetViaIdentity1 = 'Az.StackHCIVm.private\Get-AzStackHCIVmHybridIdentityMetadata_GetViaIdentity1'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmHybridIdentityMetadata_List'; + List1 = 'Az.StackHCIVm.private\Get-AzStackHCIVmHybridIdentityMetadata_List1'; + } + if (('Get1', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to get the extension. +.Description +The operation to get the extension. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmmachineextension +#> +function Get-AzStackHCIVmMachineExtension { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the machine containing the extension. + ${MachineName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the machine extension. + ${ExtensionName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Query')] + [System.String] + # The expand expression to apply on the operation. + ${Expand}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmMachineExtension_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmMachineExtension_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +Retrieves information about the model view or the instance view of a hybrid machine. +.Description +Retrieves information about the model view or the instance view of a hybrid machine. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmmachine +#> +function Get-AzStackHCIVmMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('MachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the hybrid machine. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Get')] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.InstanceViewTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Query')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.InstanceViewTypes] + # The expand expression to apply on the operation. + ${Expand}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmMachine_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmMachine_List'; + List1 = 'Az.StackHCIVm.private\Get-AzStackHCIVmMachine_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +Gets a marketplace gallery image +.Description +Gets a marketplace gallery image +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmmarketplacegalleryimage +#> +function Get-AzStackHCIVmMarketplaceGalleryImage { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('MarketplaceGalleryImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the marketplace gallery image + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmMarketplaceGalleryImage_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmMarketplaceGalleryImage_List'; + List1 = 'Az.StackHCIVm.private\Get-AzStackHCIVmMarketplaceGalleryImage_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to get network information of hybrid machine +.Description +The operation to get network information of hybrid machine +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmnetworkprofile +#> +function Get-AzStackHCIVmNetworkProfile { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.INetworkInterface])] +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the hybrid machine. + ${MachineName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmNetworkProfile_Get'; + } + if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +List all the supported operations. +.Description +List all the supported operations. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmoperation +#> +function Get-AzStackHCIVmOperation { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.IOperation], [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IOperationValue])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmOperation_List'; + List1 = 'Az.StackHCIVm.private\Get-AzStackHCIVmOperation_List1'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +Gets a virtual machine instance +.Description +Gets a virtual machine instance +.Example +Get-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" +.Example +Get-AzStackHCIVmVirtualMachine -ResourceGroupName "test-rg" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/get-azstackhcivmvirtualmachine +#> +function Get-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Get = 'Az.StackHCIVm.private\Get-AzStackHCIVmVirtualMachine_Get'; + List = 'Az.StackHCIVm.private\Get-AzStackHCIVmVirtualMachine_List'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to create or update a gallery image. +Please note some properties can be set only during gallery image creation. +.Description +The operation to create or update a gallery image. +Please note some properties can be set only during gallery image creation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmgalleryimage +#> +function New-AzStackHCIVmGalleryImage { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('GalleryImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the gallery image + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource] + # Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + ${CloudInitDataSource}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration] + # The hypervisor generation of the Virtual Machine [V1, V2] + ${HyperVGeneration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # location of the image the gallery image should be created from + ${ImagePath}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes] + # Operating system type that the gallery image uses [Windows, Linux] + ${OSType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition offer. + ${Offer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition publisher. + ${Publisher}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition SKU. + ${Sku}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage ContainerID of the storage container to be used for gallery image + ${StoragePathId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # This is the version of the gallery image. + ${Version}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + CreateExpanded = 'Az.StackHCIVm.private\New-AzStackHCIVmGalleryImage_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('ExtendedLocationType')) { + $PSBoundParameters['ExtendedLocationType'] = "CustomLocation" + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +Create Or Update GuestAgent. +.Description +Create Or Update GuestAgent. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmguestagent +#> +function New-AzStackHCIVmGuestAgent { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGuestAgent])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The password to connect with the guest. + ${CredentialsPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The username to connect with the guest. + ${CredentialsUsername}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ProvisioningAction] + # The guest agent provisioning action. + ${ProvisioningAction}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + CreateExpanded = 'Az.StackHCIVm.private\New-AzStackHCIVmGuestAgent_CreateExpanded'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to create or update a logical network. +Please note some properties can be set only during logical network creation. +.Description +The operation to create or update a logical network. +Please note some properties can be set only during logical network creation. +.Example +New-AzStackHCIVmLogicalNetwork -Name "testLnet" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -VmSwitchName "testswitch" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +SUBNET : Subnet - list of subnets under the logical network + [AddressPrefix ]: The address prefix for the subnet: Cidr for this subnet - IPv4, IPv6. + [AddressPrefixes ]: List of address prefixes for the subnet. + [IPAllocationMethod ]: IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic' + [IPConfigurationReference ]: IPConfigurationReferences - list of IPConfigurationReferences + [Id ]: IPConfigurationID + [IPPool ]: network associated pool of IP Addresses + [End ]: End of the IP address pool + [Name ]: Name of the IP-Pool + [Start ]: Start of the IP address pool + [Type ]: Type of the IP Pool [vm, vippool] + [Name ]: Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + [Route ]: Collection of routes contained within a route table. + [AddressPrefix ]: The destination CIDR to which the route applies. + [Name ]: Name - name of the subnet + [NextHopIPAddress ]: The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance. + [Vlan ]: Vlan to use for the subnet +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmlogicalnetwork +#> +function New-AzStackHCIVmLogicalNetwork { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('LogicalNetworkName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the logical network + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # The list of DNS servers IP addresses. + ${DnsServer}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet[]] + # Subnet - list of subnets under the logical network + # To construct, see NOTES section for SUBNET properties and create a hash table. + ${Subnet}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # name of the network switch to be used for VMs + ${VMSwitchName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + CreateExpanded = 'Az.StackHCIVm.private\New-AzStackHCIVmLogicalNetwork_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('ExtendedLocationType')) { + $PSBoundParameters['ExtendedLocationType'] = "CustomLocation" + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to create or update the extension. +.Description +The operation to create or update the extension. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmmachineextension +#> +function New-AzStackHCIVmMachineExtension { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the machine extension. + ${ExtensionName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the machine where the extension should be created or updated. + ${MachineName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether the extension should use a newer minor version if one is available at deployment time. + # Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + ${AutoUpgradeMinorVersion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + ${EnableAutomaticUpgrade}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # How the extension handler should be forced to update even if the extension configuration has not changed. + ${ForceUpdateTag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The machine extension name. + ${InstanceViewName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the type of the extension; an example is "CustomScriptExtension". + ${InstanceViewType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the version of the script handler. + ${InstanceViewTypeHandlerVersion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the type of the extension; an example is "CustomScriptExtension". + ${PropertiesType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings]))] + [System.Collections.Hashtable] + # The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ${ProtectedSetting}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extension handler publisher. + ${Publisher}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings]))] + [System.Collections.Hashtable] + # Json formatted public settings for the extension. + ${Setting}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The status code. + ${StatusCode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The short localizable label for the status. + ${StatusDisplayStatus}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes] + # The level code. + ${StatusLevel}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The detailed status message, including for alerts and error messages. + ${StatusMessage}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.DateTime] + # The time of the status. + ${StatusTime}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the version of the script handler. + ${TypeHandlerVersion}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + CreateExpanded = 'Az.StackHCIVm.private\New-AzStackHCIVmMachineExtension_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to create or update a hybrid machine. +Please note some properties can be set only during machine creation. +.Description +The operation to create or update a hybrid machine. +Please note some properties can be set only during machine creation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +EXTENSION : Machine Extensions information (deprecated field) + [Name ]: The machine extension name. + [StatusCode ]: The status code. + [StatusDisplayStatus ]: The short localizable label for the status. + [StatusLevel ]: The level code. + [StatusMessage ]: The detailed status message, including for alerts and error messages. + [StatusTime ]: The time of the status. + [Type ]: Specifies the type of the extension; an example is "CustomScriptExtension". + [TypeHandlerVersion ]: Specifies the version of the script handler. +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmmachine +#> +function New-AzStackHCIVmMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('MachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the hybrid machine. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The correlation ID passed in from RSM per upgrade. + ${AgentUpgradeCorrelationId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the version info w.r.t AgentUpgrade for the machine. + ${AgentUpgradeDesiredVersion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Specifies if RSM should try to upgrade this machine + ${AgentUpgradeEnableAutomaticUpgrade}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Public Key that the client provides to be used during initial resource onboarding + ${ClientPublicKey}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView[]] + # Machine Extensions information (deprecated field) + # To construct, see NOTES section for EXTENSION properties and create a hash table. + ${Extension}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The behavior of the service when the Arc-enabled machine starts up. + ${ExtensionServiceStartupType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The current status of the service. + ${ExtensionServiceStatus}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The behavior of the service when the Arc-enabled machine starts up. + ${GuestConfigurationServiceStartupType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The current status of the service. + ${GuestConfigurationServiceStatus}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType] + # The identity type. + ${IdentityType}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind] + # Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc. + ${Kind}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes] + # Specifies the assessment mode. + ${LinuxConfigurationPatchSettingsAssessmentMode}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes] + # Specifies the patch mode. + ${LinuxConfigurationPatchSettingsPatchMode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The city or locality where the resource is located. + ${LocationDataCity}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The country or region where the resource is located + ${LocationDataCountryOrRegion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The district, state, or province where the resource is located. + ${LocationDataDistrict}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # A canonical name for the geographic or physical location. + ${LocationDataName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies whether any MS SQL instance is discovered on the machine. + ${MssqlDiscovered}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The type of Operating System (windows/linux). + ${OSType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + ${ParentClusterResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The resource id of the private link scope this machine is assigned to, if any. + ${PrivateLinkScopeResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the hybrid machine unique ID. + ${VMId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes] + # Specifies the assessment mode. + ${WindowsConfigurationPatchSettingsAssessmentMode}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes] + # Specifies the patch mode. + ${WindowsConfigurationPatchSettingsPatchMode}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + CreateExpanded = 'Az.StackHCIVm.private\New-AzStackHCIVmMachine_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to create or update a marketplace gallery image. +Please note some properties can be set only during marketplace gallery image creation. +.Description +The operation to create or update a marketplace gallery image. +Please note some properties can be set only during marketplace gallery image creation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmmarketplacegalleryimage +#> +function New-AzStackHCIVmMarketplaceGalleryImage { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('MarketplaceGalleryImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the marketplace gallery image + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource] + # Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + ${CloudInitDataSource}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration] + # The hypervisor generation of the Virtual Machine [V1, V2] + ${HyperVGeneration}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes] + # Operating system type that the gallery image uses [Windows, Linux] + ${OSType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition offer. + ${Offer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition publisher. + ${Publisher}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition SKU. + ${Sku}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage ContainerID of the storage container to be used for marketplace gallery image + ${StoragePathId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # This is the version of the gallery image. + ${Version}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + CreateExpanded = 'Az.StackHCIVm.private\New-AzStackHCIVmMarketplaceGalleryImage_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('ExtendedLocationType')) { + $PSBoundParameters['ExtendedLocationType'] = "CustomLocation" + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to create or update a network interface. +Please note some properties can be set only during network interface creation. +.Description +The operation to create or update a network interface. +Please note some properties can be set only during network interface creation. +.Example +New-AzStackHCIVmNetworkInterface -Name "testNic" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -SubnetName "testLnet" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +IPCONFIGURATION : IPConfigurations - A list of IPConfigurations of the network interface. + [IPAddress ]: PrivateIPAddress - Private IP address of the IP configuration. + [Name ]: Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + [SubnetId ]: ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmnetworkinterface +#> +function New-AzStackHCIVmNetworkInterface { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('NetworkInterfaceName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the network interface + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # List of DNS server IP Addresses for the interface + ${DnsServer}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration[]] + # IPConfigurations - A list of IPConfigurations of the network interface. + # To construct, see NOTES section for IPCONFIGURATION properties and create a hash table. + ${IPConfiguration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # MacAddress - The MAC address of the network interface. + ${MacAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + CreateExpanded = 'Az.StackHCIVm.private\New-AzStackHCIVmNetworkInterface_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('ExtendedLocationType')) { + $PSBoundParameters['ExtendedLocationType'] = "CustomLocation" + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to create or update a storage container. +Please note some properties can be set only during storage container creation. +.Description +The operation to create or update a storage container. +Please note some properties can be set only during storage container creation. +.Example +New-AzStackHCIVmStoragePath -Name "testStoragePath" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}"-Location "eastus" -Path "C:\ClusterStorage\Volume1\testpath" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmstoragepath +#> +function New-AzStackHCIVmStoragePath { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('StorageContainerName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the storage container + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Path of the storage container on the disk + ${Path}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + CreateExpanded = 'Az.StackHCIVm.private\New-AzStackHCIVmStoragePath_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('ExtendedLocationType')) { + $PSBoundParameters['ExtendedLocationType'] = "CustomLocation" + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to create or update a virtual hard disk. +Please note some properties can be set only during virtual hard disk creation. +.Description +The operation to create or update a virtual hard disk. +Please note some properties can be set only during virtual hard disk creation. +.Example +New-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" -SizeGb 2 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmvirtualharddisk +#> +function New-AzStackHCIVmVirtualHardDisk { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('VirtualHardDiskName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual hard disk + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # . + ${BlockSizeByte}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat] + # The format of the actual VHD file [vhd, vhdx] + ${DiskFileFormat}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Boolean for enabling dynamic sizing on the virtual hard disk + ${Dynamic}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration] + # The hypervisor generation of the Virtual Machine [V1, V2] + ${HyperVGeneration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # . + ${LogicalSectorByte}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # . + ${PhysicalSectorByte}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # Size of the disk in GB + ${SizeGb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage ContainerID of the storage container to be used for VHD + ${StoragePathId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + CreateExpanded = 'Az.StackHCIVm.private\New-AzStackHCIVmVirtualHardDisk_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('ExtendedLocationType')) { + $PSBoundParameters['ExtendedLocationType'] = "CustomLocation" + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to create or update a virtual machine instance. +Please note some properties can be set only during virtual machine instance creation. +.Description +The operation to create or update a virtual machine instance. +Please note some properties can be set only during virtual machine instance creation. +.Example +New-AzStackHCIVmVirtualMachine -Name "testVm" -OsType "Linux" -ImageName "testImage" -VmSize "Standard_K8S_v1" -AdminUsername "localadmin" -ComputerName "testVm" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" +.Example +New-AzStackHCIVmVirtualMachine -Name "testVm" -OsType "Linux" -OsDiskName "testOsDisk" -VmSize "Standard_K8S_v1" -AdminUsername "localadmin" -ComputerName "testVm" -ResourceGroupName "test-rg" -CustomLocationId "/subscriptions/{subscriptionID}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{customLocationName}" -Location "eastus" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +LINUXCONFIGURATIONSSHPUBLICKEY : The list of SSH public keys used to authenticate with linux based VMs. + [KeyData ]: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + [Path ]: Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file. Example: /home/user/.ssh/authorized_keys + +NETWORKPROFILENETWORKINTERFACE : NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + [Id ]: ID - Resource Id of the network interface + +STORAGEPROFILEDATADISK : adds data disks to the virtual machine instance + [Id ]: Resource ID of the data disk + +WINDOWSCONFIGURATIONSSHPUBLICKEY : The list of SSH public keys used to authenticate with linux based VMs. + [KeyData ]: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + [Path ]: Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file. Example: /home/user/.ssh/authorized_keys +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/new-azstackhcivmvirtualmachine +#> +function New-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # AdminPassword - admin password + ${AdminPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # AdminUsername - admin username + ${AdminUsername}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # ComputerName - name of the compute + ${ComputerName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${CustomLocationId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # DisablePasswordAuthentication - whether password authentication should be disabled + ${DisablePasswordAuthentication}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # . + ${DynamicMemoryMaximumMemoryInMb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # . + ${DynamicMemoryMinimumMemoryInMb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage of the total memory that the virtual machine instance is thought to need. + # This only applies to virtual systems with dynamic memory enabled. + # This property can be in the range of 5 to 2000. + ${DynamicMemoryTargetBuffer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Whether to EnableAutomaticUpdates on the machine + ${EnableAutomaticUpdate}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # . + ${EnableTpm}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The HTTP proxy server endpoint to use. + ${HttpProxyConfigHttpProxy}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The HTTPS proxy server endpoint to use. + ${HttpProxyConfigHttpsProxy}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # The endpoints that should not go through proxy. + ${HttpProxyConfigNoProxy}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Alternative CA cert to use for connecting to proxy servers. + ${HttpProxyConfigTrustedCa}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType] + # The identity type. + ${IdentityType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource ID of the image + ${ImageId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process. + ${LinuxConfigurationProvisionVMAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + ${LinuxConfigurationProvisionVMConfigAgent}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]] + # The list of SSH public keys used to authenticate with linux based VMs. + # To construct, see NOTES section for LINUXCONFIGURATIONSSHPUBLICKEY properties and create a hash table. + ${LinuxConfigurationSshPublicKey}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem[]] + # NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + # To construct, see NOTES section for NETWORKPROFILENETWORKINTERFACE properties and create a hash table. + ${NetworkProfileNetworkInterface}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource ID of the OS disk + ${OSDiskId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes] + # This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. + # Possible values are: **Windows,** **Linux.** + ${OSDiskOstype}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Unique identifier defined by ARC to identify the guest of the VM. + ${ResourceUid}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Specifies whether secure boot should be enabled on the virtual machine instance. + ${SecureBootEnabled}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes] + # Specifies the SecurityType of the virtual machine. + # EnableTPM and SecureBootEnabled must be set to true for SecurityType to function. + ${SecurityProfileSecurityType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Id of the storage container that hosts the VM configuration file + ${StoragePathId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem[]] + # adds data disks to the virtual machine instance + # To construct, see NOTES section for STORAGEPROFILEDATADISK properties and create a hash table. + ${StorageProfileDataDisk}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # TimeZone for the virtual machine instance + ${TimeZone}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # RAM in MB for the virtual machine instance + ${VmMemory}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # number of processors for the virtual machine instance + ${VmProcessor}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum] + # . + ${VmSize}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process. + ${WindowConfigurationProvisionVMAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + ${WindowConfigurationProvisionVMConfigAgent}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]] + # The list of SSH public keys used to authenticate with linux based VMs. + # To construct, see NOTES section for WINDOWSCONFIGURATIONSSHPUBLICKEY properties and create a hash table. + ${WindowsConfigurationSshPublicKey}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + CreateExpanded = 'Az.StackHCIVm.private\New-AzStackHCIVmVirtualMachine_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('ExtendedLocationType')) { + $PSBoundParameters['ExtendedLocationType'] = "CustomLocation" + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to delete a gallery image. +.Description +The operation to delete a gallery image. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmgalleryimage +#> +function Remove-AzStackHCIVmGalleryImage { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('GalleryImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the gallery image + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Delete = 'Az.StackHCIVm.private\Remove-AzStackHCIVmGalleryImage_Delete'; + DeleteViaIdentity = 'Az.StackHCIVm.private\Remove-AzStackHCIVmGalleryImage_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +Implements GuestAgent DELETE method. +.Description +Implements GuestAgent DELETE method. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmguestagent +#> +function Remove-AzStackHCIVmGuestAgent { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Delete = 'Az.StackHCIVm.private\Remove-AzStackHCIVmGuestAgent_Delete'; + DeleteViaIdentity = 'Az.StackHCIVm.private\Remove-AzStackHCIVmGuestAgent_DeleteViaIdentity'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to delete a logical network. +.Description +The operation to delete a logical network. +.Example +Remove-AzStackHCIVmLogicalNetwork -Name "testLnet" -ResourceGroupName "test-rg" + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmlogicalnetwork +#> +function Remove-AzStackHCIVmLogicalNetwork { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('LogicalNetworkName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the logical network + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Delete = 'Az.StackHCIVm.private\Remove-AzStackHCIVmLogicalNetwork_Delete'; + DeleteViaIdentity = 'Az.StackHCIVm.private\Remove-AzStackHCIVmLogicalNetwork_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to delete the extension. +.Description +The operation to delete the extension. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmmachineextension +#> +function Remove-AzStackHCIVmMachineExtension { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the machine extension. + ${ExtensionName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the machine where the extension should be deleted. + ${MachineName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Delete = 'Az.StackHCIVm.private\Remove-AzStackHCIVmMachineExtension_Delete'; + DeleteViaIdentity = 'Az.StackHCIVm.private\Remove-AzStackHCIVmMachineExtension_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to delete a hybrid machine. +.Description +The operation to delete a hybrid machine. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmmachine +#> +function Remove-AzStackHCIVmMachine { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('MachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the hybrid machine. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Delete = 'Az.StackHCIVm.private\Remove-AzStackHCIVmMachine_Delete'; + DeleteViaIdentity = 'Az.StackHCIVm.private\Remove-AzStackHCIVmMachine_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to delete a marketplace gallery image. +.Description +The operation to delete a marketplace gallery image. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmmarketplacegalleryimage +#> +function Remove-AzStackHCIVmMarketplaceGalleryImage { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('MarketplaceGalleryImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the marketplace gallery image + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Delete = 'Az.StackHCIVm.private\Remove-AzStackHCIVmMarketplaceGalleryImage_Delete'; + DeleteViaIdentity = 'Az.StackHCIVm.private\Remove-AzStackHCIVmMarketplaceGalleryImage_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to delete a network interface. +.Description +The operation to delete a network interface. +.Example +Remove-AzStackHCIVmLogicalNetwork -Name "testNic" -ResourceGroupName "test-rg" + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmnetworkinterface +#> +function Remove-AzStackHCIVmNetworkInterface { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('NetworkInterfaceName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the network interface + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Delete = 'Az.StackHCIVm.private\Remove-AzStackHCIVmNetworkInterface_Delete'; + DeleteViaIdentity = 'Az.StackHCIVm.private\Remove-AzStackHCIVmNetworkInterface_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to delete a storage container. +.Description +The operation to delete a storage container. +.Example + Remove-AzStackHCIVmStoragePath -Name "testStoragePath" -ResourceGroupName "test-rg" + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmstoragepath +#> +function Remove-AzStackHCIVmStoragePath { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('StorageContainerName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the storage container + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Delete = 'Az.StackHCIVm.private\Remove-AzStackHCIVmStoragePath_Delete'; + DeleteViaIdentity = 'Az.StackHCIVm.private\Remove-AzStackHCIVmStoragePath_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to delete a virtual hard disk. +.Description +The operation to delete a virtual hard disk. +.Example +Remove-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualharddisk +#> +function Remove-AzStackHCIVmVirtualHardDisk { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('VirtualHardDiskName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual hard disk + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Delete = 'Az.StackHCIVm.private\Remove-AzStackHCIVmVirtualHardDisk_Delete'; + DeleteViaIdentity = 'Az.StackHCIVm.private\Remove-AzStackHCIVmVirtualHardDisk_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to delete a virtual machine instance. +.Description +The operation to delete a virtual machine instance. +.Example +Remove-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualmachine +#> +function Remove-AzStackHCIVmVirtualMachine { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Delete = 'Az.StackHCIVm.private\Remove-AzStackHCIVmVirtualMachine_Delete'; + DeleteViaIdentity = 'Az.StackHCIVm.private\Remove-AzStackHCIVmVirtualMachine_DeleteViaIdentity'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to restart a virtual machine instance. +.Description +The operation to restart a virtual machine instance. +.Example +Restart-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/restart-azstackhcivmvirtualmachine +#> +function Restart-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='Restart', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Restart', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter(ParameterSetName='RestartViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Restart = 'Az.StackHCIVm.private\Restart-AzStackHCIVmVirtualMachine_Restart'; + RestartViaIdentity = 'Az.StackHCIVm.private\Restart-AzStackHCIVmVirtualMachine_RestartViaIdentity'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to create or update a gallery image. +Please note some properties can be set only during gallery image creation. +.Description +The operation to create or update a gallery image. +Please note some properties can be set only during gallery image creation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/set-azstackhcivmgalleryimage +#> +function Set-AzStackHCIVmGalleryImage { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('GalleryImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the gallery image + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource] + # Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + ${CloudInitDataSource}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage ContainerID of the storage container to be used for gallery image + ${ContainerId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${ExtendedLocationName}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes] + # The type of the extended location. + ${ExtendedLocationType}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration] + # The hypervisor generation of the Virtual Machine [V1, V2] + ${HyperVGeneration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition offer. + ${IdentifierOffer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition publisher. + ${IdentifierPublisher}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition SKU. + ${IdentifierSku}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # location of the image the gallery image should be created from + ${ImagePath}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes] + # Operating system type that the gallery image uses [Windows, Linux] + ${OSType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # This is the version of the gallery image. + ${VersionName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Set-AzStackHCIVmGalleryImage_UpdateExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to create or update a logical network. +Please note some properties can be set only during logical network creation. +.Description +The operation to create or update a logical network. +Please note some properties can be set only during logical network creation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +SUBNET : Subnet - list of subnets under the logical network + [AddressPrefix ]: The address prefix for the subnet: Cidr for this subnet - IPv4, IPv6. + [AddressPrefixes ]: List of address prefixes for the subnet. + [IPAllocationMethod ]: IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic' + [IPConfigurationReference ]: IPConfigurationReferences - list of IPConfigurationReferences + [Id ]: IPConfigurationID + [IPPool ]: network associated pool of IP Addresses + [End ]: End of the IP address pool + [Name ]: Name of the IP-Pool + [Start ]: Start of the IP address pool + [Type ]: Type of the IP Pool [vm, vippool] + [Name ]: Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + [Route ]: Collection of routes contained within a route table. + [AddressPrefix ]: The destination CIDR to which the route applies. + [Name ]: Name - name of the subnet + [NextHopIPAddress ]: The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance. + [Vlan ]: Vlan to use for the subnet +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/set-azstackhcivmlogicalnetwork +#> +function Set-AzStackHCIVmLogicalNetwork { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('LogicalNetworkName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the logical network + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # The list of DNS servers IP addresses. + ${DhcpOptionDnsServer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${ExtendedLocationName}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes] + # The type of the extended location. + ${ExtendedLocationType}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet[]] + # Subnet - list of subnets under the logical network + # To construct, see NOTES section for SUBNET properties and create a hash table. + ${Subnet}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # name of the network switch to be used for VMs + ${VMSwitchName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Set-AzStackHCIVmLogicalNetwork_UpdateExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to create or update the extension. +.Description +The operation to create or update the extension. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/set-azstackhcivmmachineextension +#> +function Set-AzStackHCIVmMachineExtension { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the machine extension. + ${ExtensionName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the machine where the extension should be created or updated. + ${MachineName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether the extension should use a newer minor version if one is available at deployment time. + # Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + ${AutoUpgradeMinorVersion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + ${EnableAutomaticUpgrade}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # How the extension handler should be forced to update even if the extension configuration has not changed. + ${ForceUpdateTag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The machine extension name. + ${InstanceViewName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the type of the extension; an example is "CustomScriptExtension". + ${InstanceViewType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the version of the script handler. + ${InstanceViewTypeHandlerVersion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the type of the extension; an example is "CustomScriptExtension". + ${PropertiesType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings]))] + [System.Collections.Hashtable] + # The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ${ProtectedSetting}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extension handler publisher. + ${Publisher}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings]))] + [System.Collections.Hashtable] + # Json formatted public settings for the extension. + ${Setting}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The status code. + ${StatusCode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The short localizable label for the status. + ${StatusDisplayStatus}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes] + # The level code. + ${StatusLevel}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The detailed status message, including for alerts and error messages. + ${StatusMessage}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.DateTime] + # The time of the status. + ${StatusTime}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the version of the script handler. + ${TypeHandlerVersion}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Set-AzStackHCIVmMachineExtension_UpdateExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to create or update a hybrid machine. +Please note some properties can be set only during machine creation. +.Description +The operation to create or update a hybrid machine. +Please note some properties can be set only during machine creation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +EXTENSION : Machine Extensions information (deprecated field) + [Name ]: The machine extension name. + [StatusCode ]: The status code. + [StatusDisplayStatus ]: The short localizable label for the status. + [StatusLevel ]: The level code. + [StatusMessage ]: The detailed status message, including for alerts and error messages. + [StatusTime ]: The time of the status. + [Type ]: Specifies the type of the extension; an example is "CustomScriptExtension". + [TypeHandlerVersion ]: Specifies the version of the script handler. +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/set-azstackhcivmmachine +#> +function Set-AzStackHCIVmMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('MachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the hybrid machine. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The correlation ID passed in from RSM per upgrade. + ${AgentUpgradeCorrelationId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the version info w.r.t AgentUpgrade for the machine. + ${AgentUpgradeDesiredVersion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Specifies if RSM should try to upgrade this machine + ${AgentUpgradeEnableAutomaticUpgrade}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Public Key that the client provides to be used during initial resource onboarding + ${ClientPublicKey}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView[]] + # Machine Extensions information (deprecated field) + # To construct, see NOTES section for EXTENSION properties and create a hash table. + ${Extension}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The behavior of the service when the Arc-enabled machine starts up. + ${ExtensionServiceStartupType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The current status of the service. + ${ExtensionServiceStatus}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The behavior of the service when the Arc-enabled machine starts up. + ${GuestConfigurationServiceStartupType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The current status of the service. + ${GuestConfigurationServiceStatus}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType] + # The identity type. + ${IdentityType}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind] + # Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc. + ${Kind}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes] + # Specifies the assessment mode. + ${LinuxConfigurationPatchSettingsAssessmentMode}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes] + # Specifies the patch mode. + ${LinuxConfigurationPatchSettingsPatchMode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The city or locality where the resource is located. + ${LocationDataCity}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The country or region where the resource is located + ${LocationDataCountryOrRegion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The district, state, or province where the resource is located. + ${LocationDataDistrict}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # A canonical name for the geographic or physical location. + ${LocationDataName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies whether any MS SQL instance is discovered on the machine. + ${MssqlDiscovered}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The type of Operating System (windows/linux). + ${OSType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + ${ParentClusterResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The resource id of the private link scope this machine is assigned to, if any. + ${PrivateLinkScopeResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the hybrid machine unique ID. + ${VMId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes] + # Specifies the assessment mode. + ${WindowsConfigurationPatchSettingsAssessmentMode}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes] + # Specifies the patch mode. + ${WindowsConfigurationPatchSettingsPatchMode}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Set-AzStackHCIVmMachine_UpdateExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to create or update a marketplace gallery image. +Please note some properties can be set only during marketplace gallery image creation. +.Description +The operation to create or update a marketplace gallery image. +Please note some properties can be set only during marketplace gallery image creation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/set-azstackhcivmmarketplacegalleryimage +#> +function Set-AzStackHCIVmMarketplaceGalleryImage { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('MarketplaceGalleryImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the marketplace gallery image + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource] + # Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + ${CloudInitDataSource}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage ContainerID of the storage container to be used for marketplace gallery image + ${ContainerId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${ExtendedLocationName}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes] + # The type of the extended location. + ${ExtendedLocationType}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration] + # The hypervisor generation of the Virtual Machine [V1, V2] + ${HyperVGeneration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition offer. + ${IdentifierOffer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition publisher. + ${IdentifierPublisher}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition SKU. + ${IdentifierSku}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes] + # Operating system type that the gallery image uses [Windows, Linux] + ${OSType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # This is the version of the gallery image. + ${VersionName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Set-AzStackHCIVmMarketplaceGalleryImage_UpdateExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to create or update a network interface. +Please note some properties can be set only during network interface creation. +.Description +The operation to create or update a network interface. +Please note some properties can be set only during network interface creation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +IPCONFIGURATION : IPConfigurations - A list of IPConfigurations of the network interface. + [IPAddress ]: PrivateIPAddress - Private IP address of the IP configuration. + [Name ]: Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + [SubnetId ]: ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/set-azstackhcivmnetworkinterface +#> +function Set-AzStackHCIVmNetworkInterface { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('NetworkInterfaceName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the network interface + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # List of DNS server IP Addresses for the interface + ${DnsSettingDnsServer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${ExtendedLocationName}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes] + # The type of the extended location. + ${ExtendedLocationType}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration[]] + # IPConfigurations - A list of IPConfigurations of the network interface. + # To construct, see NOTES section for IPCONFIGURATION properties and create a hash table. + ${IPConfiguration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # MacAddress - The MAC address of the network interface. + ${MacAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Set-AzStackHCIVmNetworkInterface_UpdateExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to create or update a storage container. +Please note some properties can be set only during storage container creation. +.Description +The operation to create or update a storage container. +Please note some properties can be set only during storage container creation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/set-azstackhcivmstoragecontainer +#> +function Set-AzStackHCIVmStorageContainer { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('StorageContainerName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the storage container + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${ExtendedLocationName}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes] + # The type of the extended location. + ${ExtendedLocationType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Path of the storage container on the disk + ${Path}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Set-AzStackHCIVmStorageContainer_UpdateExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to create or update a virtual hard disk. +Please note some properties can be set only during virtual hard disk creation. +.Description +The operation to create or update a virtual hard disk. +Please note some properties can be set only during virtual hard disk creation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/set-azstackhcivmvirtualharddisk +#> +function Set-AzStackHCIVmVirtualHardDisk { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('VirtualHardDiskName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual hard disk + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # . + ${BlockSizeByte}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage ContainerID of the storage container to be used for VHD + ${ContainerId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat] + # The format of the actual VHD file [vhd, vhdx] + ${DiskFileFormat}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # Size of the disk in GB + ${DiskSizeGb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Boolean for enabling dynamic sizing on the virtual hard disk + ${Dynamic}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${ExtendedLocationName}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes] + # The type of the extended location. + ${ExtendedLocationType}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration] + # The hypervisor generation of the Virtual Machine [V1, V2] + ${HyperVGeneration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # . + ${LogicalSectorByte}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # . + ${PhysicalSectorByte}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Set-AzStackHCIVmVirtualHardDisk_UpdateExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to create or update a virtual machine instance. +Please note some properties can be set only during virtual machine instance creation. +.Description +The operation to create or update a virtual machine instance. +Please note some properties can be set only during virtual machine instance creation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +LINUXCONFIGURATIONSSHPUBLICKEY : The list of SSH public keys used to authenticate with linux based VMs. + [KeyData ]: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + [Path ]: Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file. Example: /home/user/.ssh/authorized_keys + +NETWORKPROFILENETWORKINTERFACE : NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + [Id ]: ID - Resource Id of the network interface + +STORAGEPROFILEDATADISK : adds data disks to the virtual machine instance + [Id ]: Resource ID of the data disk + +WINDOWSCONFIGURATIONSSHPUBLICKEY : The list of SSH public keys used to authenticate with linux based VMs. + [KeyData ]: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + [Path ]: Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file. Example: /home/user/.ssh/authorized_keys +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/set-azstackhcivmvirtualmachineinstance +#> +function Set-AzStackHCIVmVirtualMachineInstance { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage of the total memory that the virtual machine instance is thought to need. + # This only applies to virtual systems with dynamic memory enabled. + # This property can be in the range of 5 to 2000. + ${DynamicMemoryConfigTargetMemoryBuffer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # . + ${DynamicMemoryMaximumMemoryInMb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # . + ${DynamicMemoryMinimumMemoryInMb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${ExtendedLocationName}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes] + # The type of the extended location. + ${ExtendedLocationType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # RAM in MB for the virtual machine instance + ${HardwareProfileMemoryMb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # number of processors for the virtual machine instance + ${HardwareProfileProcessor}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum] + # . + ${HardwareProfileVMSize}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The HTTP proxy server endpoint to use. + ${HttpProxyConfigHttpProxy}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The HTTPS proxy server endpoint to use. + ${HttpProxyConfigHttpsProxy}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # The endpoints that should not go through proxy. + ${HttpProxyConfigNoProxy}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Alternative CA cert to use for connecting to proxy servers. + ${HttpProxyConfigTrustedCa}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType] + # The identity type. + ${IdentityType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource ID of the image + ${ImageReferenceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # DisablePasswordAuthentication - whether password authentication should be disabled + ${LinuxConfigurationDisablePasswordAuthentication}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process. + ${LinuxConfigurationProvisionVMAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + ${LinuxConfigurationProvisionVMConfigAgent}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]] + # The list of SSH public keys used to authenticate with linux based VMs. + # To construct, see NOTES section for LINUXCONFIGURATIONSSHPUBLICKEY properties and create a hash table. + ${LinuxConfigurationSshPublicKey}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem[]] + # NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + # To construct, see NOTES section for NETWORKPROFILENETWORKINTERFACE properties and create a hash table. + ${NetworkProfileNetworkInterface}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource ID of the OS disk + ${OSDiskId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes] + # This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. + # Possible values are: **Windows,** **Linux.** + ${OSDiskOstype}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # AdminPassword - admin password + ${OSProfileAdminPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # AdminUsername - admin username + ${OSProfileAdminUsername}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # ComputerName - name of the compute + ${OSProfileComputerName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Unique identifier defined by ARC to identify the guest of the VM. + ${ResourceUid}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # . + ${SecurityProfileEnableTpm}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes] + # Specifies the SecurityType of the virtual machine. + # EnableTPM and SecureBootEnabled must be set to true for SecurityType to function. + ${SecurityProfileSecurityType}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem[]] + # adds data disks to the virtual machine instance + # To construct, see NOTES section for STORAGEPROFILEDATADISK properties and create a hash table. + ${StorageProfileDataDisk}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Id of the storage container that hosts the VM configuration file + ${StorageProfileVMConfigStoragePathId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Specifies whether secure boot should be enabled on the virtual machine instance. + ${UefiSettingSecureBootEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Whether to EnableAutomaticUpdates on the machine + ${WindowConfigurationEnableAutomaticUpdate}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process. + ${WindowConfigurationProvisionVMAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + ${WindowConfigurationProvisionVMConfigAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # TimeZone for the virtual machine instance + ${WindowConfigurationTimeZone}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]] + # The list of SSH public keys used to authenticate with linux based VMs. + # To construct, see NOTES section for WINDOWSCONFIGURATIONSSHPUBLICKEY properties and create a hash table. + ${WindowsConfigurationSshPublicKey}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Set-AzStackHCIVmVirtualMachineInstance_UpdateExpanded'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to start a virtual machine instance. +.Description +The operation to start a virtual machine instance. +.Example +Start-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/start-azstackhcivmvirtualmachine +#> +function Start-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='Start', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Start', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter(ParameterSetName='StartViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Start = 'Az.StackHCIVm.private\Start-AzStackHCIVmVirtualMachine_Start'; + StartViaIdentity = 'Az.StackHCIVm.private\Start-AzStackHCIVmVirtualMachine_StartViaIdentity'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to stop a virtual machine instance. +.Description +The operation to stop a virtual machine instance. +.Example +Stop-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/stop-azstackhcivmvirtualmachine +#> +function Stop-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='Stop', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Stop', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter(ParameterSetName='StopViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Stop = 'Az.StackHCIVm.private\Stop-AzStackHCIVmVirtualMachine_Stop'; + StopViaIdentity = 'Az.StackHCIVm.private\Stop-AzStackHCIVmVirtualMachine_StopViaIdentity'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to Upgrade Machine Extensions. +.Description +The operation to Upgrade Machine Extensions. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +EXTENSIONUPGRADEPARAMETER : Describes the Machine Extension Upgrade Properties. + [ExtensionTarget ]: Describes the Extension Target Properties. + [(Any) ]: This indicates any property can be added to this object. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmextension +#> +function Update-AzStackHCIVmExtension { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='UpgradeExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Upgrade', Mandatory)] + [Parameter(ParameterSetName='UpgradeExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the hybrid machine. + ${MachineName}, + + [Parameter(ParameterSetName='Upgrade', Mandatory)] + [Parameter(ParameterSetName='UpgradeExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Upgrade')] + [Parameter(ParameterSetName='UpgradeExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpgradeViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='UpgradeViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Upgrade', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='UpgradeViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade] + # Describes the Machine Extension Upgrade Properties. + # To construct, see NOTES section for EXTENSIONUPGRADEPARAMETER properties and create a hash table. + ${ExtensionUpgradeParameter}, + + [Parameter(ParameterSetName='UpgradeExpanded')] + [Parameter(ParameterSetName='UpgradeViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTarget]))] + [System.Collections.Hashtable] + # Describes the Extension Target Properties. + ${ExtensionTarget}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Upgrade = 'Az.StackHCIVm.private\Update-AzStackHCIVmExtension_Upgrade'; + UpgradeExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmExtension_UpgradeExpanded'; + UpgradeViaIdentity = 'Az.StackHCIVm.private\Update-AzStackHCIVmExtension_UpgradeViaIdentity'; + UpgradeViaIdentityExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmExtension_UpgradeViaIdentityExpanded'; + } + if (('Upgrade', 'UpgradeExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to update a gallery image. +.Description +The operation to update a gallery image. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmgalleryimage +#> +function Update-AzStackHCIVmGalleryImage { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('GalleryImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the gallery image + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmGalleryImage_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmGalleryImage_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to create or update the extension. +.Description +The operation to create or update the extension. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmmachineextension +#> +function Update-AzStackHCIVmMachineExtension { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the machine extension. + ${ExtensionName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the machine where the extension should be created or updated. + ${MachineName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether the extension should use a newer minor version if one is available at deployment time. + # Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + ${AutoUpgradeMinorVersion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + ${EnableAutomaticUpgrade}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # How the extension handler should be forced to update even if the extension configuration has not changed. + ${ForceUpdateTag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings]))] + [System.Collections.Hashtable] + # The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ${ProtectedSetting}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extension handler publisher. + ${Publisher}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings]))] + [System.Collections.Hashtable] + # Json formatted public settings for the extension. + ${Setting}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the type of the extension; an example is "CustomScriptExtension". + ${Type}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the version of the script handler. + ${TypeHandlerVersion}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmMachineExtension_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmMachineExtension_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to update a hybrid machine. +.Description +The operation to update a hybrid machine. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmmachine +#> +function Update-AzStackHCIVmMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('MachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the hybrid machine. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The correlation ID passed in from RSM per upgrade. + ${AgentUpgradeCorrelationId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the version info w.r.t AgentUpgrade for the machine. + ${AgentUpgradeDesiredVersion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Specifies if RSM should try to upgrade this machine + ${AgentUpgradeEnableAutomaticUpgrade}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType] + # The identity type. + ${IdentityType}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind] + # Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc. + ${Kind}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes] + # Specifies the assessment mode. + ${LinuxConfigurationPatchSettingsAssessmentMode}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes] + # Specifies the patch mode. + ${LinuxConfigurationPatchSettingsPatchMode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The city or locality where the resource is located. + ${LocationDataCity}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The country or region where the resource is located + ${LocationDataCountryOrRegion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The district, state, or province where the resource is located. + ${LocationDataDistrict}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # A canonical name for the geographic or physical location. + ${LocationDataName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + ${ParentClusterResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The resource id of the private link scope this machine is assigned to, if any. + ${PrivateLinkScopeResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes] + # Specifies the assessment mode. + ${WindowsConfigurationPatchSettingsAssessmentMode}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes] + # Specifies the patch mode. + ${WindowsConfigurationPatchSettingsPatchMode}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmMachine_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmMachine_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to update a marketplace gallery image. +.Description +The operation to update a marketplace gallery image. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmmarketplacegalleryimage +#> +function Update-AzStackHCIVmMarketplaceGalleryImage { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('MarketplaceGalleryImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the marketplace gallery image + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmMarketplaceGalleryImage_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmMarketplaceGalleryImage_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} + +<# +.Synopsis +The operation to update a virtual machine instance. +.Description +The operation to update a virtual machine instance. +.Example +Update-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" -VmMemoryInMB "4" + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk + +NETWORKPROFILENETWORKINTERFACE : NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + [Id ]: ID - Resource ID of the network interface + +STORAGEPROFILEDATADISK : adds data disks to the virtual machine instance for the update call + [Id ]: +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmvirtualmachine +#> +function Update-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # RAM in MB for the virtual machine instance + ${HardwareProfileMemoryMb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # number of processors for the virtual machine instance + ${HardwareProfileProcessor}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum] + # . + ${HardwareProfileVMSize}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType] + # The identity type. + ${IdentityType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process. + ${LinuxConfigurationProvisionVMAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + ${LinuxConfigurationProvisionVMConfigAgent}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem[]] + # NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + # To construct, see NOTES section for NETWORKPROFILENETWORKINTERFACE properties and create a hash table. + ${NetworkProfileNetworkInterface}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # ComputerName - name of the computer + ${OSProfileComputerName}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem[]] + # adds data disks to the virtual machine instance for the update call + # To construct, see NOTES section for STORAGEPROFILEDATADISK properties and create a hash table. + ${StorageProfileDataDisk}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process. + ${WindowConfigurationProvisionVMAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + ${WindowConfigurationProvisionVMConfigAgent}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmVirtualMachine_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmVirtualMachine_UpdateViaIdentityExpanded'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/README.md b/src/StackHCI/StackHCIVm.Autorest/internal/README.md new file mode 100644 index 000000000000..590ced440536 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/README.md @@ -0,0 +1,14 @@ +# Internal +This directory contains a module to handle *internal only* cmdlets. Cmdlets that you **hide** in configuration are created here. For more information on hiding, see [cmdlet hiding](https://github.com/Azure/autorest.powershell/blob/main/docs/directives.md#cmdlet-hiding-exportation-suppression). The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation. + +## Info +- Modifiable: no +- Generated: all +- Committed: no +- Packaged: yes + +## Details +The `Az.StackHCIVm.internal.psm1` file is generated to this folder. This module file handles the hidden cmdlets. These cmdlets will not be exported by `Az.StackHCIVm`. Instead, this sub-module is imported by the `..\custom\Az.StackHCIVm.custom.psm1` 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, `Az.StackHCIVm.internal\Get-Example` would call an internal cmdlet named `Get-Example`. + +## Purpose +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 `Az.StackHCIVm`. diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmGalleryImage.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmGalleryImage.ps1 new file mode 100644 index 000000000000..949da4d9ba83 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmGalleryImage.ps1 @@ -0,0 +1,201 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a gallery image. +.Description +The operation to delete a gallery image. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmgalleryimage +#> +function Remove-AzStackHCIVmGalleryImage { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('GalleryImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the gallery image + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Delete = 'Az.StackHCIVm.private\Remove-AzStackHCIVmGalleryImage_Delete'; + DeleteViaIdentity = 'Az.StackHCIVm.private\Remove-AzStackHCIVmGalleryImage_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmGuestAgent.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmGuestAgent.ps1 new file mode 100644 index 000000000000..21c7dbddee02 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmGuestAgent.ps1 @@ -0,0 +1,183 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Implements GuestAgent DELETE method. +.Description +Implements GuestAgent DELETE method. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmguestagent +#> +function Remove-AzStackHCIVmGuestAgent { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Delete = 'Az.StackHCIVm.private\Remove-AzStackHCIVmGuestAgent_Delete'; + DeleteViaIdentity = 'Az.StackHCIVm.private\Remove-AzStackHCIVmGuestAgent_DeleteViaIdentity'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmLogicalNetwork.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmLogicalNetwork.ps1 new file mode 100644 index 000000000000..5fe93d420182 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmLogicalNetwork.ps1 @@ -0,0 +1,199 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a logical network. +.Description +The operation to delete a logical network. +.Example +Remove-AzStackHCIVmLogicalNetwork -Name "testLnet" -ResourceGroupName "test-rg" + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmlogicalnetwork +#> +function Remove-AzStackHCIVmLogicalNetwork { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('LogicalNetworkName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the logical network + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Delete = 'Az.StackHCIVm.private\Remove-AzStackHCIVmLogicalNetwork_Delete'; + DeleteViaIdentity = 'Az.StackHCIVm.private\Remove-AzStackHCIVmLogicalNetwork_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmMachine.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmMachine.ps1 new file mode 100644 index 000000000000..175dcfc251cb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmMachine.ps1 @@ -0,0 +1,189 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a hybrid machine. +.Description +The operation to delete a hybrid machine. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmmachine +#> +function Remove-AzStackHCIVmMachine { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('MachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the hybrid machine. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Delete = 'Az.StackHCIVm.private\Remove-AzStackHCIVmMachine_Delete'; + DeleteViaIdentity = 'Az.StackHCIVm.private\Remove-AzStackHCIVmMachine_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmMachineExtension.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmMachineExtension.ps1 new file mode 100644 index 000000000000..6311dbf651a1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmMachineExtension.ps1 @@ -0,0 +1,206 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete the extension. +.Description +The operation to delete the extension. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmmachineextension +#> +function Remove-AzStackHCIVmMachineExtension { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the machine extension. + ${ExtensionName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the machine where the extension should be deleted. + ${MachineName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Delete = 'Az.StackHCIVm.private\Remove-AzStackHCIVmMachineExtension_Delete'; + DeleteViaIdentity = 'Az.StackHCIVm.private\Remove-AzStackHCIVmMachineExtension_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmMarketplaceGalleryImage.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmMarketplaceGalleryImage.ps1 new file mode 100644 index 000000000000..3fb67ab567d9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmMarketplaceGalleryImage.ps1 @@ -0,0 +1,201 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a marketplace gallery image. +.Description +The operation to delete a marketplace gallery image. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmmarketplacegalleryimage +#> +function Remove-AzStackHCIVmMarketplaceGalleryImage { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('MarketplaceGalleryImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the marketplace gallery image + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Delete = 'Az.StackHCIVm.private\Remove-AzStackHCIVmMarketplaceGalleryImage_Delete'; + DeleteViaIdentity = 'Az.StackHCIVm.private\Remove-AzStackHCIVmMarketplaceGalleryImage_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmNetworkInterface.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmNetworkInterface.ps1 new file mode 100644 index 000000000000..76c17d4ac9fa --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmNetworkInterface.ps1 @@ -0,0 +1,199 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a network interface. +.Description +The operation to delete a network interface. +.Example +Remove-AzStackHCIVmLogicalNetwork -Name "testNic" -ResourceGroupName "test-rg" + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmnetworkinterface +#> +function Remove-AzStackHCIVmNetworkInterface { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('NetworkInterfaceName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the network interface + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Delete = 'Az.StackHCIVm.private\Remove-AzStackHCIVmNetworkInterface_Delete'; + DeleteViaIdentity = 'Az.StackHCIVm.private\Remove-AzStackHCIVmNetworkInterface_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmStoragePath.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmStoragePath.ps1 new file mode 100644 index 000000000000..f8e106f3b559 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmStoragePath.ps1 @@ -0,0 +1,200 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a storage container. +.Description +The operation to delete a storage container. +.Example + Remove-AzStackHCIVmStoragePath -Name "testStoragePath" -ResourceGroupName "test-rg" + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmstoragepath +#> +function Remove-AzStackHCIVmStoragePath { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('StorageContainerName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the storage container + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Delete = 'Az.StackHCIVm.private\Remove-AzStackHCIVmStoragePath_Delete'; + DeleteViaIdentity = 'Az.StackHCIVm.private\Remove-AzStackHCIVmStoragePath_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmVirtualHardDisk.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmVirtualHardDisk.ps1 new file mode 100644 index 000000000000..fb62980623be --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmVirtualHardDisk.ps1 @@ -0,0 +1,200 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a virtual hard disk. +.Description +The operation to delete a virtual hard disk. +.Example +Remove-AzStackHCIVmVirtualHardDisk -Name "testVhd" -ResourceGroupName "test-rg" + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualharddisk +#> +function Remove-AzStackHCIVmVirtualHardDisk { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('VirtualHardDiskName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual hard disk + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Delete = 'Az.StackHCIVm.private\Remove-AzStackHCIVmVirtualHardDisk_Delete'; + DeleteViaIdentity = 'Az.StackHCIVm.private\Remove-AzStackHCIVmVirtualHardDisk_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmVirtualMachine.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmVirtualMachine.ps1 new file mode 100644 index 000000000000..719cdd66ece4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Remove-AzStackHCIVmVirtualMachine.ps1 @@ -0,0 +1,182 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a virtual machine instance. +.Description +The operation to delete a virtual machine instance. +.Example +Remove-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/remove-azstackhcivmvirtualmachine +#> +function Remove-AzStackHCIVmVirtualMachine { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Delete = 'Az.StackHCIVm.private\Remove-AzStackHCIVmVirtualMachine_Delete'; + DeleteViaIdentity = 'Az.StackHCIVm.private\Remove-AzStackHCIVmVirtualMachine_DeleteViaIdentity'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Restart-AzStackHCIVmVirtualMachine.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Restart-AzStackHCIVmVirtualMachine.ps1 new file mode 100644 index 000000000000..4631ac94863e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Restart-AzStackHCIVmVirtualMachine.ps1 @@ -0,0 +1,176 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to restart a virtual machine instance. +.Description +The operation to restart a virtual machine instance. +.Example +Restart-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/restart-azstackhcivmvirtualmachine +#> +function Restart-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='Restart', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Restart', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter(ParameterSetName='RestartViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Restart = 'Az.StackHCIVm.private\Restart-AzStackHCIVmVirtualMachine_Restart'; + RestartViaIdentity = 'Az.StackHCIVm.private\Restart-AzStackHCIVmVirtualMachine_RestartViaIdentity'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmGalleryImage.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmGalleryImage.ps1 new file mode 100644 index 000000000000..f5cc1265f15c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmGalleryImage.ps1 @@ -0,0 +1,246 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a gallery image. +Please note some properties can be set only during gallery image creation. +.Description +The operation to create or update a gallery image. +Please note some properties can be set only during gallery image creation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/set-azstackhcivmgalleryimage +#> +function Set-AzStackHCIVmGalleryImage { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('GalleryImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the gallery image + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource] + # Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + ${CloudInitDataSource}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage ContainerID of the storage container to be used for gallery image + ${ContainerId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${ExtendedLocationName}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes] + # The type of the extended location. + ${ExtendedLocationType}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration] + # The hypervisor generation of the Virtual Machine [V1, V2] + ${HyperVGeneration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition offer. + ${IdentifierOffer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition publisher. + ${IdentifierPublisher}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition SKU. + ${IdentifierSku}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # location of the image the gallery image should be created from + ${ImagePath}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes] + # Operating system type that the gallery image uses [Windows, Linux] + ${OSType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # This is the version of the gallery image. + ${VersionName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Set-AzStackHCIVmGalleryImage_UpdateExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmLogicalNetwork.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmLogicalNetwork.ps1 new file mode 100644 index 000000000000..c8cd55a6d03f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmLogicalNetwork.ps1 @@ -0,0 +1,232 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a logical network. +Please note some properties can be set only during logical network creation. +.Description +The operation to create or update a logical network. +Please note some properties can be set only during logical network creation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +SUBNET : Subnet - list of subnets under the logical network + [AddressPrefix ]: The address prefix for the subnet: Cidr for this subnet - IPv4, IPv6. + [AddressPrefixes ]: List of address prefixes for the subnet. + [IPAllocationMethod ]: IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic' + [IPConfigurationReference ]: IPConfigurationReferences - list of IPConfigurationReferences + [Id ]: IPConfigurationID + [IPPool ]: network associated pool of IP Addresses + [End ]: End of the IP address pool + [Name ]: Name of the IP-Pool + [Start ]: Start of the IP address pool + [Type ]: Type of the IP Pool [vm, vippool] + [Name ]: Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + [Route ]: Collection of routes contained within a route table. + [AddressPrefix ]: The destination CIDR to which the route applies. + [Name ]: Name - name of the subnet + [NextHopIPAddress ]: The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance. + [Vlan ]: Vlan to use for the subnet +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/set-azstackhcivmlogicalnetwork +#> +function Set-AzStackHCIVmLogicalNetwork { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ILogicalNetworks])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('LogicalNetworkName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the logical network + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # The list of DNS servers IP addresses. + ${DhcpOptionDnsServer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${ExtendedLocationName}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes] + # The type of the extended location. + ${ExtendedLocationType}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISubnet[]] + # Subnet - list of subnets under the logical network + # To construct, see NOTES section for SUBNET properties and create a hash table. + ${Subnet}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # name of the network switch to be used for VMs + ${VMSwitchName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Set-AzStackHCIVmLogicalNetwork_UpdateExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmMachine.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmMachine.ps1 new file mode 100644 index 000000000000..7794a5d79e7b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmMachine.ps1 @@ -0,0 +1,330 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a hybrid machine. +Please note some properties can be set only during machine creation. +.Description +The operation to create or update a hybrid machine. +Please note some properties can be set only during machine creation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +EXTENSION : Machine Extensions information (deprecated field) + [Name ]: The machine extension name. + [StatusCode ]: The status code. + [StatusDisplayStatus ]: The short localizable label for the status. + [StatusLevel ]: The level code. + [StatusMessage ]: The detailed status message, including for alerts and error messages. + [StatusTime ]: The time of the status. + [Type ]: Specifies the type of the extension; an example is "CustomScriptExtension". + [TypeHandlerVersion ]: Specifies the version of the script handler. +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/set-azstackhcivmmachine +#> +function Set-AzStackHCIVmMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('MachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the hybrid machine. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The correlation ID passed in from RSM per upgrade. + ${AgentUpgradeCorrelationId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the version info w.r.t AgentUpgrade for the machine. + ${AgentUpgradeDesiredVersion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Specifies if RSM should try to upgrade this machine + ${AgentUpgradeEnableAutomaticUpgrade}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Public Key that the client provides to be used during initial resource onboarding + ${ClientPublicKey}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionInstanceView[]] + # Machine Extensions information (deprecated field) + # To construct, see NOTES section for EXTENSION properties and create a hash table. + ${Extension}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The behavior of the service when the Arc-enabled machine starts up. + ${ExtensionServiceStartupType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The current status of the service. + ${ExtensionServiceStatus}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The behavior of the service when the Arc-enabled machine starts up. + ${GuestConfigurationServiceStartupType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The current status of the service. + ${GuestConfigurationServiceStatus}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType] + # The identity type. + ${IdentityType}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind] + # Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc. + ${Kind}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes] + # Specifies the assessment mode. + ${LinuxConfigurationPatchSettingsAssessmentMode}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes] + # Specifies the patch mode. + ${LinuxConfigurationPatchSettingsPatchMode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The city or locality where the resource is located. + ${LocationDataCity}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The country or region where the resource is located + ${LocationDataCountryOrRegion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The district, state, or province where the resource is located. + ${LocationDataDistrict}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # A canonical name for the geographic or physical location. + ${LocationDataName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies whether any MS SQL instance is discovered on the machine. + ${MssqlDiscovered}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The type of Operating System (windows/linux). + ${OSType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + ${ParentClusterResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The resource id of the private link scope this machine is assigned to, if any. + ${PrivateLinkScopeResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the hybrid machine unique ID. + ${VMId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes] + # Specifies the assessment mode. + ${WindowsConfigurationPatchSettingsAssessmentMode}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes] + # Specifies the patch mode. + ${WindowsConfigurationPatchSettingsPatchMode}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Set-AzStackHCIVmMachine_UpdateExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmMachineExtension.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmMachineExtension.ps1 new file mode 100644 index 000000000000..0664c11846de --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmMachineExtension.ps1 @@ -0,0 +1,279 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update the extension. +.Description +The operation to create or update the extension. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/set-azstackhcivmmachineextension +#> +function Set-AzStackHCIVmMachineExtension { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the machine extension. + ${ExtensionName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the machine where the extension should be created or updated. + ${MachineName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether the extension should use a newer minor version if one is available at deployment time. + # Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + ${AutoUpgradeMinorVersion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + ${EnableAutomaticUpgrade}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # How the extension handler should be forced to update even if the extension configuration has not changed. + ${ForceUpdateTag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The machine extension name. + ${InstanceViewName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the type of the extension; an example is "CustomScriptExtension". + ${InstanceViewType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the version of the script handler. + ${InstanceViewTypeHandlerVersion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the type of the extension; an example is "CustomScriptExtension". + ${PropertiesType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesProtectedSettings]))] + [System.Collections.Hashtable] + # The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ${ProtectedSetting}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extension handler publisher. + ${Publisher}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionPropertiesSettings]))] + [System.Collections.Hashtable] + # Json formatted public settings for the extension. + ${Setting}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The status code. + ${StatusCode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The short localizable label for the status. + ${StatusDisplayStatus}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.StatusLevelTypes] + # The level code. + ${StatusLevel}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The detailed status message, including for alerts and error messages. + ${StatusMessage}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.DateTime] + # The time of the status. + ${StatusTime}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the version of the script handler. + ${TypeHandlerVersion}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Set-AzStackHCIVmMachineExtension_UpdateExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmMarketplaceGalleryImage.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmMarketplaceGalleryImage.ps1 new file mode 100644 index 000000000000..c2f18e81775f --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmMarketplaceGalleryImage.ps1 @@ -0,0 +1,240 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a marketplace gallery image. +Please note some properties can be set only during marketplace gallery image creation. +.Description +The operation to create or update a marketplace gallery image. +Please note some properties can be set only during marketplace gallery image creation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/set-azstackhcivmmarketplacegalleryimage +#> +function Set-AzStackHCIVmMarketplaceGalleryImage { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('MarketplaceGalleryImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the marketplace gallery image + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.CloudInitDataSource] + # Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + ${CloudInitDataSource}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage ContainerID of the storage container to be used for marketplace gallery image + ${ContainerId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${ExtendedLocationName}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes] + # The type of the extended location. + ${ExtendedLocationType}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration] + # The hypervisor generation of the Virtual Machine [V1, V2] + ${HyperVGeneration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition offer. + ${IdentifierOffer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition publisher. + ${IdentifierPublisher}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the gallery image definition SKU. + ${IdentifierSku}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes] + # Operating system type that the gallery image uses [Windows, Linux] + ${OSType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # This is the version of the gallery image. + ${VersionName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Set-AzStackHCIVmMarketplaceGalleryImage_UpdateExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmNetworkInterface.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmNetworkInterface.ps1 new file mode 100644 index 000000000000..5e397f88ec5e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmNetworkInterface.ps1 @@ -0,0 +1,219 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a network interface. +Please note some properties can be set only during network interface creation. +.Description +The operation to create or update a network interface. +Please note some properties can be set only during network interface creation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +IPCONFIGURATION : IPConfigurations - A list of IPConfigurations of the network interface. + [IPAddress ]: PrivateIPAddress - Private IP address of the IP configuration. + [Name ]: Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + [SubnetId ]: ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/set-azstackhcivmnetworkinterface +#> +function Set-AzStackHCIVmNetworkInterface { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkInterfaces])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('NetworkInterfaceName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the network interface + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # List of DNS server IP Addresses for the interface + ${DnsSettingDnsServer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${ExtendedLocationName}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes] + # The type of the extended location. + ${ExtendedLocationType}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IIPConfiguration[]] + # IPConfigurations - A list of IPConfigurations of the network interface. + # To construct, see NOTES section for IPCONFIGURATION properties and create a hash table. + ${IPConfiguration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # MacAddress - The MAC address of the network interface. + ${MacAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Set-AzStackHCIVmNetworkInterface_UpdateExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmStorageContainer.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmStorageContainer.ps1 new file mode 100644 index 000000000000..7d0ff7ab2181 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmStorageContainer.ps1 @@ -0,0 +1,195 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a storage container. +Please note some properties can be set only during storage container creation. +.Description +The operation to create or update a storage container. +Please note some properties can be set only during storage container creation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/set-azstackhcivmstoragecontainer +#> +function Set-AzStackHCIVmStorageContainer { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageContainers])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('StorageContainerName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the storage container + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${ExtendedLocationName}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes] + # The type of the extended location. + ${ExtendedLocationType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Path of the storage container on the disk + ${Path}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Set-AzStackHCIVmStorageContainer_UpdateExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmVirtualHardDisk.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmVirtualHardDisk.ps1 new file mode 100644 index 000000000000..56a1507200cb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmVirtualHardDisk.ps1 @@ -0,0 +1,239 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a virtual hard disk. +Please note some properties can be set only during virtual hard disk creation. +.Description +The operation to create or update a virtual hard disk. +Please note some properties can be set only during virtual hard disk creation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/set-azstackhcivmvirtualharddisk +#> +function Set-AzStackHCIVmVirtualHardDisk { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualHardDisks])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('VirtualHardDiskName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the virtual hard disk + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The geo-location where the resource lives + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # . + ${BlockSizeByte}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Storage ContainerID of the storage container to be used for VHD + ${ContainerId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.DiskFileFormat] + # The format of the actual VHD file [vhd, vhdx] + ${DiskFileFormat}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # Size of the disk in GB + ${DiskSizeGb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Boolean for enabling dynamic sizing on the virtual hard disk + ${Dynamic}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${ExtendedLocationName}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes] + # The type of the extended location. + ${ExtendedLocationType}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.HyperVGeneration] + # The hypervisor generation of the Virtual Machine [V1, V2] + ${HyperVGeneration}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # . + ${LogicalSectorByte}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # . + ${PhysicalSectorByte}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api30.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Set-AzStackHCIVmVirtualHardDisk_UpdateExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmVirtualMachineInstance.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmVirtualMachineInstance.ps1 new file mode 100644 index 000000000000..fa7352d7ae8b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Set-AzStackHCIVmVirtualMachineInstance.ps1 @@ -0,0 +1,391 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update a virtual machine instance. +Please note some properties can be set only during virtual machine instance creation. +.Description +The operation to create or update a virtual machine instance. +Please note some properties can be set only during virtual machine instance creation. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +LINUXCONFIGURATIONSSHPUBLICKEY : The list of SSH public keys used to authenticate with linux based VMs. + [KeyData ]: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + [Path ]: Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file. Example: /home/user/.ssh/authorized_keys + +NETWORKPROFILENETWORKINTERFACE : NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + [Id ]: ID - Resource Id of the network interface + +STORAGEPROFILEDATADISK : adds data disks to the virtual machine instance + [Id ]: Resource ID of the data disk + +WINDOWSCONFIGURATIONSSHPUBLICKEY : The list of SSH public keys used to authenticate with linux based VMs. + [KeyData ]: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + [Path ]: Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file. Example: /home/user/.ssh/authorized_keys +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/set-azstackhcivmvirtualmachineinstance +#> +function Set-AzStackHCIVmVirtualMachineInstance { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a percentage of the total memory that the virtual machine instance is thought to need. + # This only applies to virtual systems with dynamic memory enabled. + # This property can be in the range of 5 to 2000. + ${DynamicMemoryConfigTargetMemoryBuffer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # . + ${DynamicMemoryMaximumMemoryInMb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # . + ${DynamicMemoryMinimumMemoryInMb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extended location. + ${ExtendedLocationName}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ExtendedLocationTypes] + # The type of the extended location. + ${ExtendedLocationType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # RAM in MB for the virtual machine instance + ${HardwareProfileMemoryMb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # number of processors for the virtual machine instance + ${HardwareProfileProcessor}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum] + # . + ${HardwareProfileVMSize}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The HTTP proxy server endpoint to use. + ${HttpProxyConfigHttpProxy}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The HTTPS proxy server endpoint to use. + ${HttpProxyConfigHttpsProxy}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String[]] + # The endpoints that should not go through proxy. + ${HttpProxyConfigNoProxy}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Alternative CA cert to use for connecting to proxy servers. + ${HttpProxyConfigTrustedCa}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType] + # The identity type. + ${IdentityType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource ID of the image + ${ImageReferenceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # DisablePasswordAuthentication - whether password authentication should be disabled + ${LinuxConfigurationDisablePasswordAuthentication}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process. + ${LinuxConfigurationProvisionVMAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + ${LinuxConfigurationProvisionVMConfigAgent}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]] + # The list of SSH public keys used to authenticate with linux based VMs. + # To construct, see NOTES section for LINUXCONFIGURATIONSSHPUBLICKEY properties and create a hash table. + ${LinuxConfigurationSshPublicKey}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem[]] + # NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + # To construct, see NOTES section for NETWORKPROFILENETWORKINTERFACE properties and create a hash table. + ${NetworkProfileNetworkInterface}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Resource ID of the OS disk + ${OSDiskId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.OperatingSystemTypes] + # This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. + # Possible values are: **Windows,** **Linux.** + ${OSDiskOstype}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # AdminPassword - admin password + ${OSProfileAdminPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # AdminUsername - admin username + ${OSProfileAdminUsername}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # ComputerName - name of the compute + ${OSProfileComputerName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Unique identifier defined by ARC to identify the guest of the VM. + ${ResourceUid}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # . + ${SecurityProfileEnableTpm}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.SecurityTypes] + # Specifies the SecurityType of the virtual machine. + # EnableTPM and SecureBootEnabled must be set to true for SecurityType to function. + ${SecurityProfileSecurityType}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstancePropertiesStorageProfileDataDisksItem[]] + # adds data disks to the virtual machine instance + # To construct, see NOTES section for STORAGEPROFILEDATADISK properties and create a hash table. + ${StorageProfileDataDisk}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Id of the storage container that hosts the VM configuration file + ${StorageProfileVMConfigStoragePathId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Specifies whether secure boot should be enabled on the virtual machine instance. + ${UefiSettingSecureBootEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Whether to EnableAutomaticUpdates on the machine + ${WindowConfigurationEnableAutomaticUpdate}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process. + ${WindowConfigurationProvisionVMAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + ${WindowConfigurationProvisionVMConfigAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # TimeZone for the virtual machine instance + ${WindowConfigurationTimeZone}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.ISshPublicKey[]] + # The list of SSH public keys used to authenticate with linux based VMs. + # To construct, see NOTES section for WINDOWSCONFIGURATIONSSHPUBLICKEY properties and create a hash table. + ${WindowsConfigurationSshPublicKey}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Set-AzStackHCIVmVirtualMachineInstance_UpdateExpanded'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Start-AzStackHCIVmVirtualMachine.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Start-AzStackHCIVmVirtualMachine.ps1 new file mode 100644 index 000000000000..a5fceed7ae57 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Start-AzStackHCIVmVirtualMachine.ps1 @@ -0,0 +1,176 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to start a virtual machine instance. +.Description +The operation to start a virtual machine instance. +.Example +Start-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/start-azstackhcivmvirtualmachine +#> +function Start-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='Start', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Start', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter(ParameterSetName='StartViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Start = 'Az.StackHCIVm.private\Start-AzStackHCIVmVirtualMachine_Start'; + StartViaIdentity = 'Az.StackHCIVm.private\Start-AzStackHCIVmVirtualMachine_StartViaIdentity'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Stop-AzStackHCIVmVirtualMachine.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Stop-AzStackHCIVmVirtualMachine.ps1 new file mode 100644 index 000000000000..4a95bbdb0e93 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Stop-AzStackHCIVmVirtualMachine.ps1 @@ -0,0 +1,176 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to stop a virtual machine instance. +.Description +The operation to stop a virtual machine instance. +.Example +Stop-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/stop-azstackhcivmvirtualmachine +#> +function Stop-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='Stop', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Stop', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter(ParameterSetName='StopViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Stop = 'Az.StackHCIVm.private\Stop-AzStackHCIVmVirtualMachine_Stop'; + StopViaIdentity = 'Az.StackHCIVm.private\Stop-AzStackHCIVmVirtualMachine_StopViaIdentity'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Update-AzStackHCIVmExtension.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Update-AzStackHCIVmExtension.ps1 new file mode 100644 index 000000000000..dd116277c40d --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Update-AzStackHCIVmExtension.ps1 @@ -0,0 +1,228 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to Upgrade Machine Extensions. +.Description +The operation to Upgrade Machine Extensions. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +EXTENSIONUPGRADEPARAMETER : Describes the Machine Extension Upgrade Properties. + [ExtensionTarget ]: Describes the Extension Target Properties. + [(Any) ]: This indicates any property can be added to this object. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmextension +#> +function Update-AzStackHCIVmExtension { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='UpgradeExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Upgrade', Mandatory)] + [Parameter(ParameterSetName='UpgradeExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the hybrid machine. + ${MachineName}, + + [Parameter(ParameterSetName='Upgrade', Mandatory)] + [Parameter(ParameterSetName='UpgradeExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Upgrade')] + [Parameter(ParameterSetName='UpgradeExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpgradeViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='UpgradeViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Upgrade', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='UpgradeViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpgrade] + # Describes the Machine Extension Upgrade Properties. + # To construct, see NOTES section for EXTENSIONUPGRADEPARAMETER properties and create a hash table. + ${ExtensionUpgradeParameter}, + + [Parameter(ParameterSetName='UpgradeExpanded')] + [Parameter(ParameterSetName='UpgradeViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IExtensionTarget]))] + [System.Collections.Hashtable] + # Describes the Extension Target Properties. + ${ExtensionTarget}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + Upgrade = 'Az.StackHCIVm.private\Update-AzStackHCIVmExtension_Upgrade'; + UpgradeExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmExtension_UpgradeExpanded'; + UpgradeViaIdentity = 'Az.StackHCIVm.private\Update-AzStackHCIVmExtension_UpgradeViaIdentity'; + UpgradeViaIdentityExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmExtension_UpgradeViaIdentityExpanded'; + } + if (('Upgrade', 'UpgradeExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Update-AzStackHCIVmGalleryImage.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Update-AzStackHCIVmGalleryImage.ps1 new file mode 100644 index 000000000000..b6bf29a295ba --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Update-AzStackHCIVmGalleryImage.ps1 @@ -0,0 +1,202 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update a gallery image. +.Description +The operation to update a gallery image. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmgalleryimage +#> +function Update-AzStackHCIVmGalleryImage { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImages])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('GalleryImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the gallery image + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IGalleryImagesUpdateRequestTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmGalleryImage_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmGalleryImage_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Update-AzStackHCIVmMachine.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Update-AzStackHCIVmMachine.ps1 new file mode 100644 index 000000000000..c24ba26b84e0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Update-AzStackHCIVmMachine.ps1 @@ -0,0 +1,286 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update a hybrid machine. +.Description +The operation to update a hybrid machine. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmmachine +#> +function Update-AzStackHCIVmMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachine])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('MachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the hybrid machine. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The correlation ID passed in from RSM per upgrade. + ${AgentUpgradeCorrelationId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the version info w.r.t AgentUpgrade for the machine. + ${AgentUpgradeDesiredVersion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Specifies if RSM should try to upgrade this machine + ${AgentUpgradeEnableAutomaticUpgrade}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType] + # The identity type. + ${IdentityType}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PrivateCloudKind] + # Indicates which kind of VM fabric the instance is an instance of, such as HCI or SCVMM etc. + ${Kind}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes] + # Specifies the assessment mode. + ${LinuxConfigurationPatchSettingsAssessmentMode}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes] + # Specifies the patch mode. + ${LinuxConfigurationPatchSettingsPatchMode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The city or locality where the resource is located. + ${LocationDataCity}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The country or region where the resource is located + ${LocationDataCountryOrRegion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The district, state, or province where the resource is located. + ${LocationDataDistrict}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # A canonical name for the geographic or physical location. + ${LocationDataName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + ${ParentClusterResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The resource id of the private link scope this machine is assigned to, if any. + ${PrivateLinkScopeResourceId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.AssessmentModeTypes] + # Specifies the assessment mode. + ${WindowsConfigurationPatchSettingsAssessmentMode}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.PatchModeTypes] + # Specifies the patch mode. + ${WindowsConfigurationPatchSettingsPatchMode}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmMachine_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmMachine_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Update-AzStackHCIVmMachineExtension.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Update-AzStackHCIVmMachineExtension.ps1 new file mode 100644 index 000000000000..3ea032a10846 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Update-AzStackHCIVmMachineExtension.ps1 @@ -0,0 +1,258 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create or update the extension. +.Description +The operation to create or update the extension. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmmachineextension +#> +function Update-AzStackHCIVmMachineExtension { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtension])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the machine extension. + ${ExtensionName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the machine where the extension should be created or updated. + ${MachineName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether the extension should use a newer minor version if one is available at deployment time. + # Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + ${AutoUpgradeMinorVersion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + ${EnableAutomaticUpgrade}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # How the extension handler should be forced to update even if the extension configuration has not changed. + ${ForceUpdateTag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesProtectedSettings]))] + [System.Collections.Hashtable] + # The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ${ProtectedSetting}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # The name of the extension handler publisher. + ${Publisher}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IMachineExtensionUpdatePropertiesSettings]))] + [System.Collections.Hashtable] + # Json formatted public settings for the extension. + ${Setting}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230315Preview.IResourceUpdateTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the type of the extension; an example is "CustomScriptExtension". + ${Type}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # Specifies the version of the script handler. + ${TypeHandlerVersion}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmMachineExtension_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmMachineExtension_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Update-AzStackHCIVmMarketplaceGalleryImage.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Update-AzStackHCIVmMarketplaceGalleryImage.ps1 new file mode 100644 index 000000000000..4444a97a5b4b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Update-AzStackHCIVmMarketplaceGalleryImage.ps1 @@ -0,0 +1,202 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update a marketplace gallery image. +.Description +The operation to update a marketplace gallery image. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmmarketplacegalleryimage +#> +function Update-AzStackHCIVmMarketplaceGalleryImage { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImages])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('MarketplaceGalleryImageName')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # Name of the marketplace gallery image + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IMarketplaceGalleryImagesUpdateRequestTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmMarketplaceGalleryImage_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmMarketplaceGalleryImage_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/internal/Update-AzStackHCIVmVirtualMachine.ps1 b/src/StackHCI/StackHCIVm.Autorest/internal/Update-AzStackHCIVmVirtualMachine.ps1 new file mode 100644 index 000000000000..b7be3bf94efd --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/internal/Update-AzStackHCIVmVirtualMachine.ps1 @@ -0,0 +1,253 @@ + +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update a virtual machine instance. +.Description +The operation to update a virtual machine instance. +.Example +Update-AzStackHCIVmVirtualMachine -Name "testVm" -ResourceGroupName "test-rg" -VmMemoryInMB "4" + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [ExtensionName ]: The name of the machine extension. + [ExtensionType ]: The extensionType of the Extension being received. + [GalleryImageName ]: Name of the gallery image + [Id ]: Resource identity path + [Location ]: The location of the Extension being received. + [LogicalNetworkName ]: Name of the logical network + [MachineName ]: The name of the hybrid machine. + [MarketplaceGalleryImageName ]: Name of the marketplace gallery image + [MetadataName ]: Name of the HybridIdentityMetadata. + [NetworkInterfaceName ]: Name of the network interface + [OSType ]: Defines the os type. + [Publisher ]: The publisher of the Extension being received. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceUri ]: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + [StorageContainerName ]: Name of the storage container + [SubscriptionId ]: The ID of the target subscription. + [Version ]: The version of the Extension being received. + [VirtualHardDiskName ]: Name of the virtual hard disk + +NETWORKPROFILENETWORKINTERFACE : NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + [Id ]: ID - Resource ID of the network interface + +STORAGEPROFILEDATADISK : adds data disks to the virtual machine instance for the update call + [Id ]: +.Link +https://learn.microsoft.com/powershell/module/az.stackhci/update-azstackhcivmvirtualmachine +#> +function Update-AzStackHCIVmVirtualMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IVirtualMachineInstance])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [System.String] + # The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. + ${ResourceUri}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.IStackHciVMIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int64] + # RAM in MB for the virtual machine instance + ${HardwareProfileMemoryMb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Int32] + # number of processors for the virtual machine instance + ${HardwareProfileProcessor}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.VMSizeEnum] + # . + ${HardwareProfileVMSize}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType])] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Support.ResourceIdentityType] + # The identity type. + ${IdentityType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process. + ${LinuxConfigurationProvisionVMAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + ${LinuxConfigurationProvisionVMConfigAgent}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.INetworkProfileUpdateNetworkInterfacesItem[]] + # NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + # To construct, see NOTES section for NETWORKPROFILENETWORKINTERFACE properties and create a hash table. + ${NetworkProfileNetworkInterface}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.String] + # ComputerName - name of the computer + ${OSProfileComputerName}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Models.Api20230901Preview.IStorageProfileUpdateDataDisksItem[]] + # adds data disks to the virtual machine instance for the update call + # To construct, see NOTES section for STORAGEPROFILEDATADISK properties and create a hash table. + ${StorageProfileDataDisk}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation process. + ${WindowConfigurationProvisionVMAgent}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + ${WindowConfigurationProvisionVMConfigAgent}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVm.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + UpdateExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmVirtualMachine_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.StackHCIVm.private\Update-AzStackHCIVmVirtualMachine_UpdateViaIdentityExpanded'; + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/src/StackHCI/StackHCIVm.Autorest/pack-module.ps1 b/src/StackHCI/StackHCIVm.Autorest/pack-module.ps1 new file mode 100644 index 000000000000..2f30ca3fffa0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/pack-module.ps1 @@ -0,0 +1,17 @@ +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- +Write-Host -ForegroundColor Green 'Packing module...' +dotnet pack $PSScriptRoot --no-build /nologo +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/run-module.ps1 b/src/StackHCI/StackHCIVm.Autorest/run-module.ps1 new file mode 100644 index 000000000000..abe98a336f12 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/run-module.ps1 @@ -0,0 +1,62 @@ +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$Code) +$ErrorActionPreference = 'Stop' + +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$isAzure = $true +if($isAzure) { + . (Join-Path $PSScriptRoot 'check-dependencies.ps1') -Isolated -Accounts + # Load the latest version of Az.Accounts installed + Import-Module -Name Az.Accounts -RequiredVersion (Get-Module -Name Az.Accounts -ListAvailable | Sort-Object -Property Version -Descending)[0].Version +} + +$localModulesPath = Join-Path $PSScriptRoot 'generated\modules' +if(Test-Path -Path $localModulesPath) { + $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" +} + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.StackHCIVm.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +function Prompt { + Write-Host -NoNewline -ForegroundColor Green "PS $(Get-Location)" + Write-Host -NoNewline -ForegroundColor Gray ' [' + Write-Host -NoNewline -ForegroundColor White -BackgroundColor DarkCyan $moduleName + ']> ' +} + +# where we would find the launch.json file +$vscodeDirectory = New-Item -ItemType Directory -Force -Path (Join-Path $PSScriptRoot '.vscode') +$launchJson = Join-Path $vscodeDirectory 'launch.json' + +# if there is a launch.json file, let's just assume -Code, and update the file +if(($Code) -or (test-Path $launchJson) ) { + $launchContent = '{ "version": "0.2.0", "configurations":[{ "name":"Attach to PowerShell", "type":"coreclr", "request":"attach", "processId":"' + ([System.Diagnostics.Process]::GetCurrentProcess().Id) + '", "justMyCode":false }] }' + Set-Content -Path $launchJson -Value $launchContent + if($Code) { + # only launch vscode if they say -code + code $PSScriptRoot + } +} + +Import-Module -Name $modulePath \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/test-module.ps1 b/src/StackHCI/StackHCIVm.Autorest/test-module.ps1 new file mode 100644 index 000000000000..7cfc24aa6446 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test-module.ps1 @@ -0,0 +1,94 @@ +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$Live, [switch]$Record, [switch]$Playback, [switch]$RegenerateSupportModule, [switch]$UsePreviousConfigForRecord, [string[]]$TestName) +$ErrorActionPreference = 'Stop' + +if(-not $Isolated) +{ + Write-Host -ForegroundColor Green 'Creating isolated process...' + if ($PSBoundParameters.ContainsKey("TestName")) { + $PSBoundParameters["TestName"] = $PSBoundParameters["TestName"] -join "," + } + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +# This is a workaround, since for string array parameter, pwsh -File will only take the first element +if ($PSBoundParameters.ContainsKey("TestName") -and ($TestName.count -eq 1) -and ($TestName[0].Contains(','))) { + $TestName = $TestName[0].Split(",") +} + +$ProgressPreference = 'SilentlyContinue' +$baseName = $PSScriptRoot.BaseName +$requireResourceModule = (($baseName -ne "Resources") -and ($Record.IsPresent -or $Live.IsPresent)) +. (Join-Path $PSScriptRoot 'check-dependencies.ps1') -Isolated -Accounts:$false -Pester -Resources:$requireResourceModule -RegenerateSupportModule:$RegenerateSupportModule +. ("$PSScriptRoot\test\utils.ps1") + +if ($requireResourceModule) +{ + # Load the latest Az.Accounts installed + Import-Module -Name Az.Accounts -RequiredVersion (Get-Module -Name Az.Accounts -ListAvailable | Sort-Object -Property Version -Descending)[0].Version + $resourceModulePSD = Get-Item -Path (Join-Path $HOME '.PSSharedModules\Resources\Az.Resources.TestSupport.psd1') + Import-Module -Name $resourceModulePSD.FullName +} + +$localModulesPath = Join-Path $PSScriptRoot 'generated\modules' +if(Test-Path -Path $localModulesPath) +{ + $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" +} + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.StackHCIVm.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +Import-Module -Name Pester +Import-Module -Name $modulePath + +$TestMode = 'playback' +$ExcludeTag = @("LiveOnly") +if($Live) +{ + $TestMode = 'live' + $ExcludeTag = @() +} +if($Record) +{ + $TestMode = 'record' +} +try +{ + if ($TestMode -ne 'playback') + { + setupEnv + } + $testFolder = Join-Path $PSScriptRoot 'test' + if ($null -ne $TestName) + { + Invoke-Pester -Script @{ Path = $testFolder } -TestName $TestName -ExcludeTag $ExcludeTag -EnableExit -OutputFile (Join-Path $testFolder "$moduleName-TestResults.xml") + } else + { + Invoke-Pester -Script @{ Path = $testFolder } -ExcludeTag $ExcludeTag -EnableExit -OutputFile (Join-Path $testFolder "$moduleName-TestResults.xml") + } +} Finally +{ + if ($TestMode -ne 'playback') + { + cleanupEnv + } +} + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Add-AzStackHCIVmVirtualMachineDataDisk.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Add-AzStackHCIVmVirtualMachineDataDisk.Tests.ps1 new file mode 100644 index 000000000000..ffdc41d502fd --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Add-AzStackHCIVmVirtualMachineDataDisk.Tests.ps1 @@ -0,0 +1,22 @@ +<# $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Add-AzStackHCIVmVirtualMachineDataDisk.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Add-AzStackHCIVmVirtualMachineDataDisk' { + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByName' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} #> diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Add-AzStackHCIVmVirtualMachineNetworkInterface.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Add-AzStackHCIVmVirtualMachineNetworkInterface.Tests.ps1 new file mode 100644 index 000000000000..af81421e52c4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Add-AzStackHCIVmVirtualMachineNetworkInterface.Tests.ps1 @@ -0,0 +1,23 @@ +<# $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Add-AzStackHCIVmVirtualMachineNetworkInterface.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Add-AzStackHCIVmVirtualMachineNetworkInterface' { + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByName' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} + #> \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmImageNew.Recording.json b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmImageNew.Recording.json new file mode 100644 index 000000000000..344f48c10518 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmImageNew.Recording.json @@ -0,0 +1,451 @@ +{ + "AzStackHCIVmImageNew+[NoContext]+Create Image +$PUT+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages/testImage1106-2?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages/testImage1106-2?api-version=2023-09-01-preview", + "Content": "{\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"imagePath\": \"C:\\\\ClusterStorage\\\\Volume1\\\\vhds\\\\ubuntu.vhdx\",\r\n \"osType\": \"Linux\"\r\n },\r\n \"extendedLocation\": {\r\n \"name\": \"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\r\n \"type\": \"CustomLocation\"\r\n }\r\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "377" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"34028c5c-0000-0100-0000-6549a13c0000\"" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "x-ms-providerhub-traffic": [ "True" ], + "mise-correlation-id": [ "1add87d2-403a-4112-b6ba-70fc35af391e" ], + "x-ms-request-id": [ "4de8a47a-98b1-406d-a68a-fa7e21ab9ec5" ], + "x-ms-correlation-request-id": [ "75e15b4a-b618-400f-a3ee-27232b5967ec" ], + "Azure-AsyncOperation": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/ffc21503-427a-4956-8d81-35c741108e8a*2CCDBEB6202518A0EA6553921D42E8D2E038AFBC43974F80754BE67F8D5D7CBC?api-version=2023-09-01-preview\u0026t=638349210205017523\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=bmif4lvL6U0d-ebVXMbeXRRPjcI6miHeRUDcU3Fc0HkT4FxYmf0jj-bDw3TOMIqNelBRf_9xuVS3f5ThfHSxfDR6MLNkmoDYgs4GWGe2t3ABJ26AarRjVyq16BVVHIw4A55y78S3mvW8rmRETD7y9OZx-NiDT7dMIrc71GQRsn9Srhwt6uUbjQoLnNB3XBSRK5weMPq9VBhpotNXqBuEp8RkNEN10wrTQVB4YXb75oQ1oqM9EWeXvTCf7nsvjsVPoxvKAZ3hokaSumTjPYDEmldAqIpc3Q5Ail7pHIOsuuYgj0Va9gwoq-VkhlgSHeJ8nmpxytdyMxdPy2obWXlp9A\u0026h=JhyYtYXaEzb7afehN0RKyPOTTNB4q9QHMJULkxdGzBc" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T023020Z:75e15b4a-b618-400f-a3ee-27232b5967ec" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 94FE0A7DB4E440C2A19EF177CB691E57 Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:30:18Z" ], + "Date": [ "Tue, 07 Nov 2023 02:30:19 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "756" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages/testImage1106-2\",\"name\":\"testImage1106-2\",\"type\":\"microsoft.azurestackhci/galleryimages\",\"location\":\"eastus\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T02:30:19.5642499Z\",\"lastModifiedBy\":\"havedati@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-11-07T02:30:19.5642499Z\"},\"properties\":{\"provisioningState\":\"Accepted\",\"osType\":\"Linux\"}}" + } + }, + "AzStackHCIVmImageNew+[NoContext]+Create Image +$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/ffc21503-427a-4956-8d81-35c741108e8a*2CCDBEB6202518A0EA6553921D42E8D2E038AFBC43974F80754BE67F8D5D7CBC?api-version=2023-09-01-preview\u0026t=638349210205017523\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=bmif4lvL6U0d-ebVXMbeXRRPjcI6miHeRUDcU3Fc0HkT4FxYmf0jj-bDw3TOMIqNelBRf_9xuVS3f5ThfHSxfDR6MLNkmoDYgs4GWGe2t3ABJ26AarRjVyq16BVVHIw4A55y78S3mvW8rmRETD7y9OZx-NiDT7dMIrc71GQRsn9Srhwt6uUbjQoLnNB3XBSRK5weMPq9VBhpotNXqBuEp8RkNEN10wrTQVB4YXb75oQ1oqM9EWeXvTCf7nsvjsVPoxvKAZ3hokaSumTjPYDEmldAqIpc3Q5Ail7pHIOsuuYgj0Va9gwoq-VkhlgSHeJ8nmpxytdyMxdPy2obWXlp9A\u0026h=JhyYtYXaEzb7afehN0RKyPOTTNB4q9QHMJULkxdGzBc+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/ffc21503-427a-4956-8d81-35c741108e8a*2CCDBEB6202518A0EA6553921D42E8D2E038AFBC43974F80754BE67F8D5D7CBC?api-version=2023-09-01-preview\u0026t=638349210205017523\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=bmif4lvL6U0d-ebVXMbeXRRPjcI6miHeRUDcU3Fc0HkT4FxYmf0jj-bDw3TOMIqNelBRf_9xuVS3f5ThfHSxfDR6MLNkmoDYgs4GWGe2t3ABJ26AarRjVyq16BVVHIw4A55y78S3mvW8rmRETD7y9OZx-NiDT7dMIrc71GQRsn9Srhwt6uUbjQoLnNB3XBSRK5weMPq9VBhpotNXqBuEp8RkNEN10wrTQVB4YXb75oQ1oqM9EWeXvTCf7nsvjsVPoxvKAZ3hokaSumTjPYDEmldAqIpc3Q5Ail7pHIOsuuYgj0Va9gwoq-VkhlgSHeJ8nmpxytdyMxdPy2obWXlp9A\u0026h=JhyYtYXaEzb7afehN0RKyPOTTNB4q9QHMJULkxdGzBc", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "53900cb8-2e11-4ad9-9641-61a534842f68" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmGalleryImage" ], + "FullCommandName": [ "New-AzStackHCIVmGalleryImage_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8702777e-0000-0100-0000-6549a1440000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "77eee856-3eb4-4ebe-a57f-98d8e4efcfe0" ], + "x-ms-correlation-request-id": [ "82d4c9ae-fee3-43ef-9ad4-d9845f859464" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T023050Z:82d4c9ae-fee3-43ef-9ad4-d9845f859464" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 0C78723F5CB54E039E3B32A37E891012 Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:30:50Z" ], + "Date": [ "Tue, 07 Nov 2023 02:30:49 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "515" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/ffc21503-427a-4956-8d81-35c741108e8a*2CCDBEB6202518A0EA6553921D42E8D2E038AFBC43974F80754BE67F8D5D7CBC\",\"name\":\"ffc21503-427a-4956-8d81-35c741108e8a*2CCDBEB6202518A0EA6553921D42E8D2E038AFBC43974F80754BE67F8D5D7CBC\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages/testImage1106-2\",\"status\":\"Accepted\",\"startTime\":\"2023-11-07T02:30:19.666631Z\"}" + } + }, + "AzStackHCIVmImageNew+[NoContext]+Create Image +$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/ffc21503-427a-4956-8d81-35c741108e8a*2CCDBEB6202518A0EA6553921D42E8D2E038AFBC43974F80754BE67F8D5D7CBC?api-version=2023-09-01-preview\u0026t=638349210205017523\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=bmif4lvL6U0d-ebVXMbeXRRPjcI6miHeRUDcU3Fc0HkT4FxYmf0jj-bDw3TOMIqNelBRf_9xuVS3f5ThfHSxfDR6MLNkmoDYgs4GWGe2t3ABJ26AarRjVyq16BVVHIw4A55y78S3mvW8rmRETD7y9OZx-NiDT7dMIrc71GQRsn9Srhwt6uUbjQoLnNB3XBSRK5weMPq9VBhpotNXqBuEp8RkNEN10wrTQVB4YXb75oQ1oqM9EWeXvTCf7nsvjsVPoxvKAZ3hokaSumTjPYDEmldAqIpc3Q5Ail7pHIOsuuYgj0Va9gwoq-VkhlgSHeJ8nmpxytdyMxdPy2obWXlp9A\u0026h=JhyYtYXaEzb7afehN0RKyPOTTNB4q9QHMJULkxdGzBc+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/ffc21503-427a-4956-8d81-35c741108e8a*2CCDBEB6202518A0EA6553921D42E8D2E038AFBC43974F80754BE67F8D5D7CBC?api-version=2023-09-01-preview\u0026t=638349210205017523\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=bmif4lvL6U0d-ebVXMbeXRRPjcI6miHeRUDcU3Fc0HkT4FxYmf0jj-bDw3TOMIqNelBRf_9xuVS3f5ThfHSxfDR6MLNkmoDYgs4GWGe2t3ABJ26AarRjVyq16BVVHIw4A55y78S3mvW8rmRETD7y9OZx-NiDT7dMIrc71GQRsn9Srhwt6uUbjQoLnNB3XBSRK5weMPq9VBhpotNXqBuEp8RkNEN10wrTQVB4YXb75oQ1oqM9EWeXvTCf7nsvjsVPoxvKAZ3hokaSumTjPYDEmldAqIpc3Q5Ail7pHIOsuuYgj0Va9gwoq-VkhlgSHeJ8nmpxytdyMxdPy2obWXlp9A\u0026h=JhyYtYXaEzb7afehN0RKyPOTTNB4q9QHMJULkxdGzBc", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "53900cb8-2e11-4ad9-9641-61a534842f68" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmGalleryImage" ], + "FullCommandName": [ "New-AzStackHCIVmGalleryImage_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8702777e-0000-0100-0000-6549a1440000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "2b4b92de-adc5-45bf-af2f-455f8c255d5f" ], + "x-ms-correlation-request-id": [ "7b3bf3b1-c511-4fac-9045-18c732514b12" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T023120Z:7b3bf3b1-c511-4fac-9045-18c732514b12" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 3E6CA519176B4DB88F1BAAB0CBDEFAAA Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:31:20Z" ], + "Date": [ "Tue, 07 Nov 2023 02:31:20 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "515" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/ffc21503-427a-4956-8d81-35c741108e8a*2CCDBEB6202518A0EA6553921D42E8D2E038AFBC43974F80754BE67F8D5D7CBC\",\"name\":\"ffc21503-427a-4956-8d81-35c741108e8a*2CCDBEB6202518A0EA6553921D42E8D2E038AFBC43974F80754BE67F8D5D7CBC\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages/testImage1106-2\",\"status\":\"Accepted\",\"startTime\":\"2023-11-07T02:30:19.666631Z\"}" + } + }, + "AzStackHCIVmImageNew+[NoContext]+Create Image +$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/ffc21503-427a-4956-8d81-35c741108e8a*2CCDBEB6202518A0EA6553921D42E8D2E038AFBC43974F80754BE67F8D5D7CBC?api-version=2023-09-01-preview\u0026t=638349210205017523\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=bmif4lvL6U0d-ebVXMbeXRRPjcI6miHeRUDcU3Fc0HkT4FxYmf0jj-bDw3TOMIqNelBRf_9xuVS3f5ThfHSxfDR6MLNkmoDYgs4GWGe2t3ABJ26AarRjVyq16BVVHIw4A55y78S3mvW8rmRETD7y9OZx-NiDT7dMIrc71GQRsn9Srhwt6uUbjQoLnNB3XBSRK5weMPq9VBhpotNXqBuEp8RkNEN10wrTQVB4YXb75oQ1oqM9EWeXvTCf7nsvjsVPoxvKAZ3hokaSumTjPYDEmldAqIpc3Q5Ail7pHIOsuuYgj0Va9gwoq-VkhlgSHeJ8nmpxytdyMxdPy2obWXlp9A\u0026h=JhyYtYXaEzb7afehN0RKyPOTTNB4q9QHMJULkxdGzBc+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/ffc21503-427a-4956-8d81-35c741108e8a*2CCDBEB6202518A0EA6553921D42E8D2E038AFBC43974F80754BE67F8D5D7CBC?api-version=2023-09-01-preview\u0026t=638349210205017523\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=bmif4lvL6U0d-ebVXMbeXRRPjcI6miHeRUDcU3Fc0HkT4FxYmf0jj-bDw3TOMIqNelBRf_9xuVS3f5ThfHSxfDR6MLNkmoDYgs4GWGe2t3ABJ26AarRjVyq16BVVHIw4A55y78S3mvW8rmRETD7y9OZx-NiDT7dMIrc71GQRsn9Srhwt6uUbjQoLnNB3XBSRK5weMPq9VBhpotNXqBuEp8RkNEN10wrTQVB4YXb75oQ1oqM9EWeXvTCf7nsvjsVPoxvKAZ3hokaSumTjPYDEmldAqIpc3Q5Ail7pHIOsuuYgj0Va9gwoq-VkhlgSHeJ8nmpxytdyMxdPy2obWXlp9A\u0026h=JhyYtYXaEzb7afehN0RKyPOTTNB4q9QHMJULkxdGzBc", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "53900cb8-2e11-4ad9-9641-61a534842f68" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmGalleryImage" ], + "FullCommandName": [ "New-AzStackHCIVmGalleryImage_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8702777e-0000-0100-0000-6549a1440000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "f8d429cf-4518-4dbf-88a7-e39433ef1743" ], + "x-ms-correlation-request-id": [ "fe34e1bd-a371-43bd-b918-f31abdb53268" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T023152Z:fe34e1bd-a371-43bd-b918-f31abdb53268" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: D619B67E08F141979A374453A8673648 Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:31:51Z" ], + "Date": [ "Tue, 07 Nov 2023 02:31:52 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "515" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/ffc21503-427a-4956-8d81-35c741108e8a*2CCDBEB6202518A0EA6553921D42E8D2E038AFBC43974F80754BE67F8D5D7CBC\",\"name\":\"ffc21503-427a-4956-8d81-35c741108e8a*2CCDBEB6202518A0EA6553921D42E8D2E038AFBC43974F80754BE67F8D5D7CBC\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages/testImage1106-2\",\"status\":\"Accepted\",\"startTime\":\"2023-11-07T02:30:19.666631Z\"}" + } + }, + "AzStackHCIVmImageNew+[NoContext]+Create Image +$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/ffc21503-427a-4956-8d81-35c741108e8a*2CCDBEB6202518A0EA6553921D42E8D2E038AFBC43974F80754BE67F8D5D7CBC?api-version=2023-09-01-preview\u0026t=638349210205017523\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=bmif4lvL6U0d-ebVXMbeXRRPjcI6miHeRUDcU3Fc0HkT4FxYmf0jj-bDw3TOMIqNelBRf_9xuVS3f5ThfHSxfDR6MLNkmoDYgs4GWGe2t3ABJ26AarRjVyq16BVVHIw4A55y78S3mvW8rmRETD7y9OZx-NiDT7dMIrc71GQRsn9Srhwt6uUbjQoLnNB3XBSRK5weMPq9VBhpotNXqBuEp8RkNEN10wrTQVB4YXb75oQ1oqM9EWeXvTCf7nsvjsVPoxvKAZ3hokaSumTjPYDEmldAqIpc3Q5Ail7pHIOsuuYgj0Va9gwoq-VkhlgSHeJ8nmpxytdyMxdPy2obWXlp9A\u0026h=JhyYtYXaEzb7afehN0RKyPOTTNB4q9QHMJULkxdGzBc+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/ffc21503-427a-4956-8d81-35c741108e8a*2CCDBEB6202518A0EA6553921D42E8D2E038AFBC43974F80754BE67F8D5D7CBC?api-version=2023-09-01-preview\u0026t=638349210205017523\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=bmif4lvL6U0d-ebVXMbeXRRPjcI6miHeRUDcU3Fc0HkT4FxYmf0jj-bDw3TOMIqNelBRf_9xuVS3f5ThfHSxfDR6MLNkmoDYgs4GWGe2t3ABJ26AarRjVyq16BVVHIw4A55y78S3mvW8rmRETD7y9OZx-NiDT7dMIrc71GQRsn9Srhwt6uUbjQoLnNB3XBSRK5weMPq9VBhpotNXqBuEp8RkNEN10wrTQVB4YXb75oQ1oqM9EWeXvTCf7nsvjsVPoxvKAZ3hokaSumTjPYDEmldAqIpc3Q5Ail7pHIOsuuYgj0Va9gwoq-VkhlgSHeJ8nmpxytdyMxdPy2obWXlp9A\u0026h=JhyYtYXaEzb7afehN0RKyPOTTNB4q9QHMJULkxdGzBc", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "5" ], + "x-ms-client-request-id": [ "53900cb8-2e11-4ad9-9641-61a534842f68" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmGalleryImage" ], + "FullCommandName": [ "New-AzStackHCIVmGalleryImage_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8702568c-0000-0100-0000-6549a19e0000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "6ea365a6-ae15-4911-aa8f-a85036a69866" ], + "x-ms-correlation-request-id": [ "26870a9d-a45f-451a-be54-a04ba2e9b585" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T023222Z:26870a9d-a45f-451a-be54-a04ba2e9b585" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 68A9B235137C497483569CA1FF4F85E9 Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:32:22Z" ], + "Date": [ "Tue, 07 Nov 2023 02:32:22 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "586" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/ffc21503-427a-4956-8d81-35c741108e8a*2CCDBEB6202518A0EA6553921D42E8D2E038AFBC43974F80754BE67F8D5D7CBC\",\"name\":\"ffc21503-427a-4956-8d81-35c741108e8a*2CCDBEB6202518A0EA6553921D42E8D2E038AFBC43974F80754BE67F8D5D7CBC\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages/testImage1106-2\",\"status\":\"Succeeded\",\"startTime\":\"2023-11-07T02:30:19.666631Z\",\"endTime\":\"2023-11-07T02:31:58.5713674Z\",\"error\":{},\"properties\":null}" + } + }, + "AzStackHCIVmImageNew+[NoContext]+Create Image +$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages/testImage1106-2?api-version=2023-09-01-preview+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages/testImage1106-2?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "6" ], + "x-ms-client-request-id": [ "53900cb8-2e11-4ad9-9641-61a534842f68" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmGalleryImage" ], + "FullCommandName": [ "New-AzStackHCIVmGalleryImage_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"34022a77-0000-0100-0000-6549a19f0000\"" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-providerhub-traffic": [ "True" ], + "x-ms-request-id": [ "201fe002-617f-47ce-ac3c-562a9625ea89" ], + "x-ms-correlation-request-id": [ "6869e465-2498-4ad1-b34b-46d418f05aab" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T023222Z:6869e465-2498-4ad1-b34b-46d418f05aab" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 147D50EA06F6424EA11BA16BE7208595 Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:32:22Z" ], + "Date": [ "Tue, 07 Nov 2023 02:32:22 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1059" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages/testImage1106-2\",\"name\":\"testImage1106-2\",\"type\":\"microsoft.azurestackhci/galleryimages\",\"location\":\"eastus\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T02:30:19.5642499Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-07T02:31:59.3367809Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"osType\":\"Linux\",\"status\":{\"provisioningStatus\":{\"operationId\":\"ffc21503-427a-4956-8d81-35c741108e8a*2CCDBEB6202518A0EA6553921D42E8D2E038AFBC43974F80754BE67F8D5D7CBC\",\"status\":\"Succeeded\"},\"downloadStatus\":{},\"progressPercentage\":100},\"version\":{\"properties\":{\"storageProfile\":{\"osDiskImage\":{}}}}}}" + } + }, + "AzStackHCIVmImageNew+[NoContext]+List+$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "7" ], + "x-ms-client-request-id": [ "86268cde-acc2-4d47-9597-dfecb955a139" ], + "CommandName": [ "Az.StackHCIVm.internal\\Get-AzStackHCIVmGalleryImage" ], + "FullCommandName": [ "Get-AzStackHCIVmGalleryImage_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-original-request-ids": [ "1aa7715f-965c-4ff7-ade7-6dcc7f03e1c5", "65cef7bf-1513-473c-9777-b200ce439209", "0238a16d-b5ba-453e-b8f6-8581b6ec917c", "06f39b10-d263-46cc-a2db-e4a59c562cac", "ce8e0f1a-aa1b-4605-8a78-61dc71e3dd9c", "5e58a921-1cbb-4341-a6ff-20d9e011e7a2", "57834675-e713-473d-b7b2-fdc45668c6d3", "eb955d0b-5d08-45db-8a83-5b63b7199663", "25d59fcb-b5cf-4ca1-9ed3-676e2ba4f861", "f4df235e-1a7f-4541-99f1-8c88b944ec5c" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "x-ms-request-id": [ "35c845e6-7f3e-4dcd-a3cc-7910a1eb3626" ], + "x-ms-correlation-request-id": [ "35c845e6-7f3e-4dcd-a3cc-7910a1eb3626" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T023224Z:35c845e6-7f3e-4dcd-a3cc-7910a1eb3626" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: B4D72DFBCBC74567BEF88C73E987CDDE Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:32:23Z" ], + "Date": [ "Tue, 07 Nov 2023 02:32:24 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "4232" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages/testImage1106-2\",\"name\":\"testImage1106-2\",\"type\":\"microsoft.azurestackhci/galleryimages\",\"location\":\"eastus\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T02:30:19.5642499Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-07T02:31:59.3367809Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"osType\":\"Linux\",\"status\":{\"provisioningStatus\":{\"operationId\":\"ffc21503-427a-4956-8d81-35c741108e8a*2CCDBEB6202518A0EA6553921D42E8D2E038AFBC43974F80754BE67F8D5D7CBC\",\"status\":\"Succeeded\"},\"downloadStatus\":{},\"progressPercentage\":100},\"version\":{\"properties\":{\"storageProfile\":{\"osDiskImage\":{}}}}}},{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryimages/linuxvhd\",\"name\":\"linuxvhd\",\"type\":\"microsoft.azurestackhci/galleryimages\",\"location\":\"eastus2euap\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"altayl@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-10-18T18:39:14.052324Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-10-18T18:39:52.395291Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"osType\":\"Linux\",\"status\":{\"provisioningStatus\":{\"operationId\":\"d7ea7b90-c9aa-4d7e-af04-df21e83e6a87*BC26C14C0A1B243ACC5EAE8EF15C22A65C33543F76EC9478A1C4530014F35E6E\",\"status\":\"Succeeded\"},\"downloadStatus\":{},\"progressPercentage\":100},\"version\":{\"properties\":{\"storageProfile\":{\"osDiskImage\":{}}}}}},{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryimages/customubuntu\",\"name\":\"customubuntu\",\"type\":\"microsoft.azurestackhci/galleryimages\",\"location\":\"eastus2euap\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"altayl@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-10-30T23:32:24.4780665Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-10-30T23:33:56.3138165Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"osType\":\"Linux\",\"status\":{\"provisioningStatus\":{\"operationId\":\"87624526-46ad-4745-b5ae-1f9be727cafe*FD7C8C1984DE4EB7C2B61F29110EAB881D521398F514458E1A180E314418B357\",\"status\":\"Succeeded\"},\"downloadStatus\":{},\"progressPercentage\":100},\"version\":{\"properties\":{\"storageProfile\":{\"osDiskImage\":{}}}}}},{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages/bugbashimage\",\"name\":\"bugbashimage\",\"type\":\"microsoft.azurestackhci/galleryimages\",\"location\":\"eastus2euap\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"altayl@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-01T18:23:23.0383876Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-01T18:24:53.8023297Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"osType\":\"Linux\",\"status\":{\"provisioningStatus\":{\"operationId\":\"0f73f20d-e05e-4516-8681-1c032a8f0dcc*069B58F9639B95874B9F6BAC41FEFF5FCBB9519C591CA322FF1F067164EA6773\",\"status\":\"Succeeded\"},\"downloadStatus\":{},\"progressPercentage\":100},\"version\":{\"properties\":{\"storageProfile\":{\"osDiskImage\":{}}}}}}]}" + } + }, + "AzStackHCIVmImageNew+[NoContext]+List+$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages?api-version=2023-09-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "8" ], + "x-ms-client-request-id": [ "2eece70c-a7b4-43e8-85d9-1d91b570d8a8" ], + "CommandName": [ "Az.StackHCIVm.internal\\Get-AzStackHCIVmMarketplaceGalleryImage" ], + "FullCommandName": [ "Get-AzStackHCIVmMarketplaceGalleryImage_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-original-request-ids": [ "968ef1c9-9556-4dd4-815e-13599f9fa4ec", "365c9f97-b400-4b63-87d2-f36e99db0b3f", "f0eb87a4-acd7-485c-ba02-569c96d23cee", "de04bb40-c83a-4643-80bc-f82140ac86bf", "19481fa4-78be-4281-a064-f138734bc3b1", "e89ae66b-5fce-4d25-96e4-02b65081de8a" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "db9a6165-443b-4c5d-84aa-6114d9eed5bd" ], + "x-ms-correlation-request-id": [ "db9a6165-443b-4c5d-84aa-6114d9eed5bd" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T023225Z:db9a6165-443b-4c5d-84aa-6114d9eed5bd" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 667F8B309DFD414DB2AD4A0C59390A6E Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:32:24Z" ], + "Date": [ "Tue, 07 Nov 2023 02:32:25 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "974" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/microsoft.azurestackhci/marketplacegalleryimages/win10Ent21H2-01\",\"name\":\"win10Ent21H2-01\",\"type\":\"microsoft.azurestackhci/marketplacegalleryimages\",\"location\":\"eastus2euap\",\"extendedLocation\":{\"type\":\"CustomLocation\",\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourcegroups/altaylsnclus-rg/providers/microsoft.extendedlocation/customlocations/myresourcebridge-cl\"},\"tags\":{},\"systemData\":{\"createdBy\":\"vlakshmanan@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-10-16T19:23:31.4261979Z\",\"lastModifiedBy\":\"vlakshmanan@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-10-16T19:23:31.4261979Z\"},\"properties\":{\"osType\":\"Windows\",\"hyperVGeneration\":\"V2\",\"identifier\":{\"publisher\":\"microsoftwindowsdesktop\",\"offer\":\"windows-10\",\"sku\":\"win10-21h2-avd-g2\"},\"version\":{\"name\":\"19044.3570.231001\"},\"provisioningState\":\"Failed\"}}]}" + } + }, + "AzStackHCIVmImageNew+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages/testImage1106-2?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages/testImage1106-2?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "9" ], + "x-ms-client-request-id": [ "5bf7fce9-ed96-4dab-9306-546cde4a4739" ], + "CommandName": [ "Az.StackHCIVm.internal\\Get-AzStackHCIVmGalleryImage" ], + "FullCommandName": [ "Get-AzStackHCIVmGalleryImage_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"34022a77-0000-0100-0000-6549a19f0000\"" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-providerhub-traffic": [ "True" ], + "x-ms-request-id": [ "39b8b305-24c9-4bfc-a7c0-de12dedeb0f1" ], + "x-ms-correlation-request-id": [ "0ea005a7-25ab-4599-8ab7-7f54d1196a4e" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T023225Z:0ea005a7-25ab-4599-8ab7-7f54d1196a4e" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: A0E2A8E522A04011B61C5EE3E5847B48 Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:32:25Z" ], + "Date": [ "Tue, 07 Nov 2023 02:32:25 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1059" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages/testImage1106-2\",\"name\":\"testImage1106-2\",\"type\":\"microsoft.azurestackhci/galleryimages\",\"location\":\"eastus\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T02:30:19.5642499Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-07T02:31:59.3367809Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"osType\":\"Linux\",\"status\":{\"provisioningStatus\":{\"operationId\":\"ffc21503-427a-4956-8d81-35c741108e8a*2CCDBEB6202518A0EA6553921D42E8D2E038AFBC43974F80754BE67F8D5D7CBC\",\"status\":\"Succeeded\"},\"downloadStatus\":{},\"progressPercentage\":100},\"version\":{\"properties\":{\"storageProfile\":{\"osDiskImage\":{}}}}}}" + } + }, + "AzStackHCIVmImageNew+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages/testImage1106-2?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages/testImage1106-2?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "14" ], + "x-ms-client-request-id": [ "4f999782-e7e2-46c5-9cfb-74fbddb312b9" ], + "CommandName": [ "Az.StackHCIVm.internal\\Get-AzStackHCIVmGalleryImage" ], + "FullCommandName": [ "Get-AzStackHCIVmGalleryImage_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 404, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-failure-cause": [ "gateway" ], + "x-ms-request-id": [ "b662faf0-d3a2-43d9-ab66-a6e9bb8cfcd4" ], + "x-ms-correlation-request-id": [ "b662faf0-d3a2-43d9-ab66-a6e9bb8cfcd4" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T023257Z:b662faf0-d3a2-43d9-ab66-a6e9bb8cfcd4" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: A6BB64C4E3E4423E9A2FBE6F208A6001 Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:32:57Z" ], + "Date": [ "Tue, 07 Nov 2023 02:32:57 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "240" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"error\":{\"code\":\"ResourceNotFound\",\"message\":\"The Resource \u0027Microsoft.AzureStackHCI/galleryImages/testImage1106-2\u0027 under resource group \u0027AltaylSnClus-rg\u0027 was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix\"}}" + } + }, + "AzStackHCIVmImageNew+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/testImage1106-2?api-version=2023-09-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/testImage1106-2?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "15" ], + "x-ms-client-request-id": [ "3fb096fe-cf1a-4197-b666-1a8b634ca022" ], + "CommandName": [ "Az.StackHCIVm.internal\\Get-AzStackHCIVmMarketplaceGalleryImage" ], + "FullCommandName": [ "Get-AzStackHCIVmMarketplaceGalleryImage_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 404, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-failure-cause": [ "gateway" ], + "x-ms-request-id": [ "d8198532-b79e-4a1b-9a87-bd1c9f39ce3a" ], + "x-ms-correlation-request-id": [ "d8198532-b79e-4a1b-9a87-bd1c9f39ce3a" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T023257Z:d8198532-b79e-4a1b-9a87-bd1c9f39ce3a" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 1377426B1418482E9D9E067425333FFC Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:32:57Z" ], + "Date": [ "Tue, 07 Nov 2023 02:32:57 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "251" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"error\":{\"code\":\"ResourceNotFound\",\"message\":\"The Resource \u0027Microsoft.AzureStackHCI/marketplaceGalleryImages/testImage1106-2\u0027 under resource group \u0027AltaylSnClus-rg\u0027 was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix\"}}" + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmImageNew.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmImageNew.Tests.ps1 new file mode 100644 index 000000000000..a73187e587f1 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmImageNew.Tests.ps1 @@ -0,0 +1,47 @@ +if(($null -eq $TestName) -or ($TestName -contains 'AzStackHCIVmImageNew')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'AzStackHCIVmImageNew.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'AzStackHCIVmImageNew' { + It 'Create Image ' { + New-AzStackHCIVmImage -Name $env.imageName -ImagePath $env.imagePath -SubscriptionId $env.SubscriptionId -ResourceGroupName $env.resourceGroupName -CustomLocationId $env.customLocationId -Location $env.location -OSType $env.osTypeLinux | Select-Object -Property ProvisioningState | Should -BeExactly "@{ProvisioningState=Succeeded}" + } + + + It 'List' { + { + $config = Get-AzStackHCIVMImage -ResourceGroupName $env.resourceGroupName + $config.Count | Should -BeGreaterThan 0 + } | Should -Not -Throw + } + + It 'Get' { + { + $config = Get-AzStackHCIVmImage -Name $env.imageName -ResourceGroupName $env.resourceGroupName + $config.Name | Should -Be $env.imageName + } | Should -Not -Throw + } + + + It 'Delete'{ + { + Remove-AzStackHCIVmImage -Name $env.imageName -ResourceGroupName $env.resourceGroupName -Force + $config = Get-AzStackHCIVmImage -Name $env.imageName -ResourceGroupName $env.resourceGroupName + $config | Should -Be $null + + } | Should -Throw + } + +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmLogicalNetwork.Recording.json b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmLogicalNetwork.Recording.json new file mode 100644 index 000000000000..b836b6e97ca8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmLogicalNetwork.Recording.json @@ -0,0 +1,372 @@ +{ + "AzStackHCIVmLogicalNetwork+[NoContext]+Create Logical Network +$PUT+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/testLnetPowershell1106?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/testLnetPowershell1106?api-version=2023-09-01-preview", + "Content": "{\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"subnets\": [\r\n {\r\n \"properties\": {\r\n \"ipAllocationMethod\": \"Dynamic\",\r\n \"vlan\": 0\r\n }\r\n }\r\n ],\r\n \"vmSwitchName\": \"ExternalSwitch\"\r\n },\r\n \"extendedLocation\": {\r\n \"name\": \"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\r\n \"type\": \"CustomLocation\"\r\n }\r\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "469" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"22025323-0000-0100-0000-6549a1dd0000\"" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "x-ms-providerhub-traffic": [ "True" ], + "mise-correlation-id": [ "b16403cf-8c9a-4b9c-b43e-0f63606f15a5" ], + "x-ms-request-id": [ "51c592ee-d0ae-4d05-aaa6-f9f87acfaef4" ], + "x-ms-correlation-request-id": [ "6cfeef10-f2f8-42f2-9217-ea7c1b9a82b7" ], + "Azure-AsyncOperation": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/9252ab61-875e-45ff-9760-71984fd6d99c*FE5444E74E1015B7FEACDDEED4988914A2F237CFF4045B50E050B3E7105285CF?api-version=2023-09-01-preview\u0026t=638349211820904677\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=mZB09pRdXoEXoo2dGKH6Ei97624NRu5Mrp_z1CRhDvf3qaNmi811bXVSIJcRu3Z3L3xtLlQ0P26nkhzaAhBCwO7eP3nIRTyun00gSxShsjLha-E2qDGgv2QuQVjf_9IMjN2WwXxK_zjZnOQ1rAOlQFKMEeD-pbm2w3pQcyj2Q562IFsOq_iVy2g2Ki3GLeYnJCeSIdJar4VxNZBUtdmiryDWGHTTGnUS1i-m8RKWkxHfynyBZeBX0x0HVa96SvqTR1nOdU4rtvuXFO3LNls6rdTvstZ0NNVsoAyCJlxTKB7MNMFSnvtYX-zxnyxRtrp_3-zVedew94VI3vyktGepaA\u0026h=AOE6AcOcRhe6dqtN_k7t7YjCsEGc9C08yEcxx-hTYrI" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T023302Z:6cfeef10-f2f8-42f2-9217-ea7c1b9a82b7" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: DCE7C3C6DEBE4E62AF97B9D1A1E7819C Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:32:58Z" ], + "Date": [ "Tue, 07 Nov 2023 02:33:01 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "858" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/testLnetPowershell1106\",\"name\":\"testLnetPowershell1106\",\"type\":\"microsoft.azurestackhci/logicalnetworks\",\"location\":\"eastus\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T02:33:01.3560261Z\",\"lastModifiedBy\":\"havedati@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-11-07T02:33:01.3560261Z\"},\"properties\":{\"provisioningState\":\"Accepted\",\"subnets\":[{\"properties\":{\"ipAllocationMethod\":\"Dynamic\",\"vlan\":0}}],\"vmSwitchName\":\"ExternalSwitch\"}}" + } + }, + "AzStackHCIVmLogicalNetwork+[NoContext]+Create Logical Network +$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/9252ab61-875e-45ff-9760-71984fd6d99c*FE5444E74E1015B7FEACDDEED4988914A2F237CFF4045B50E050B3E7105285CF?api-version=2023-09-01-preview\u0026t=638349211820904677\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=mZB09pRdXoEXoo2dGKH6Ei97624NRu5Mrp_z1CRhDvf3qaNmi811bXVSIJcRu3Z3L3xtLlQ0P26nkhzaAhBCwO7eP3nIRTyun00gSxShsjLha-E2qDGgv2QuQVjf_9IMjN2WwXxK_zjZnOQ1rAOlQFKMEeD-pbm2w3pQcyj2Q562IFsOq_iVy2g2Ki3GLeYnJCeSIdJar4VxNZBUtdmiryDWGHTTGnUS1i-m8RKWkxHfynyBZeBX0x0HVa96SvqTR1nOdU4rtvuXFO3LNls6rdTvstZ0NNVsoAyCJlxTKB7MNMFSnvtYX-zxnyxRtrp_3-zVedew94VI3vyktGepaA\u0026h=AOE6AcOcRhe6dqtN_k7t7YjCsEGc9C08yEcxx-hTYrI+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/9252ab61-875e-45ff-9760-71984fd6d99c*FE5444E74E1015B7FEACDDEED4988914A2F237CFF4045B50E050B3E7105285CF?api-version=2023-09-01-preview\u0026t=638349211820904677\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=mZB09pRdXoEXoo2dGKH6Ei97624NRu5Mrp_z1CRhDvf3qaNmi811bXVSIJcRu3Z3L3xtLlQ0P26nkhzaAhBCwO7eP3nIRTyun00gSxShsjLha-E2qDGgv2QuQVjf_9IMjN2WwXxK_zjZnOQ1rAOlQFKMEeD-pbm2w3pQcyj2Q562IFsOq_iVy2g2Ki3GLeYnJCeSIdJar4VxNZBUtdmiryDWGHTTGnUS1i-m8RKWkxHfynyBZeBX0x0HVa96SvqTR1nOdU4rtvuXFO3LNls6rdTvstZ0NNVsoAyCJlxTKB7MNMFSnvtYX-zxnyxRtrp_3-zVedew94VI3vyktGepaA\u0026h=AOE6AcOcRhe6dqtN_k7t7YjCsEGc9C08yEcxx-hTYrI", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "17" ], + "x-ms-client-request-id": [ "140eaf24-29e4-4504-8459-9b04736ebcab" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmLogicalNetwork" ], + "FullCommandName": [ "New-AzStackHCIVmLogicalNetwork_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"87029999-0000-0100-0000-6549a1e10000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "7b4a1f2f-2646-4298-b6ef-5a8fada803f0" ], + "x-ms-correlation-request-id": [ "805af1b1-a6be-43f7-abd1-69e5df264ee0" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T023332Z:805af1b1-a6be-43f7-abd1-69e5df264ee0" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: B6E39C9E7E664013950CA44196AAC212 Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:33:32Z" ], + "Date": [ "Tue, 07 Nov 2023 02:33:32 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "525" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/9252ab61-875e-45ff-9760-71984fd6d99c*FE5444E74E1015B7FEACDDEED4988914A2F237CFF4045B50E050B3E7105285CF\",\"name\":\"9252ab61-875e-45ff-9760-71984fd6d99c*FE5444E74E1015B7FEACDDEED4988914A2F237CFF4045B50E050B3E7105285CF\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/testLnetPowershell1106\",\"status\":\"Accepted\",\"startTime\":\"2023-11-07T02:33:01.4343476Z\"}" + } + }, + "AzStackHCIVmLogicalNetwork+[NoContext]+Create Logical Network +$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/9252ab61-875e-45ff-9760-71984fd6d99c*FE5444E74E1015B7FEACDDEED4988914A2F237CFF4045B50E050B3E7105285CF?api-version=2023-09-01-preview\u0026t=638349211820904677\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=mZB09pRdXoEXoo2dGKH6Ei97624NRu5Mrp_z1CRhDvf3qaNmi811bXVSIJcRu3Z3L3xtLlQ0P26nkhzaAhBCwO7eP3nIRTyun00gSxShsjLha-E2qDGgv2QuQVjf_9IMjN2WwXxK_zjZnOQ1rAOlQFKMEeD-pbm2w3pQcyj2Q562IFsOq_iVy2g2Ki3GLeYnJCeSIdJar4VxNZBUtdmiryDWGHTTGnUS1i-m8RKWkxHfynyBZeBX0x0HVa96SvqTR1nOdU4rtvuXFO3LNls6rdTvstZ0NNVsoAyCJlxTKB7MNMFSnvtYX-zxnyxRtrp_3-zVedew94VI3vyktGepaA\u0026h=AOE6AcOcRhe6dqtN_k7t7YjCsEGc9C08yEcxx-hTYrI+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/9252ab61-875e-45ff-9760-71984fd6d99c*FE5444E74E1015B7FEACDDEED4988914A2F237CFF4045B50E050B3E7105285CF?api-version=2023-09-01-preview\u0026t=638349211820904677\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=mZB09pRdXoEXoo2dGKH6Ei97624NRu5Mrp_z1CRhDvf3qaNmi811bXVSIJcRu3Z3L3xtLlQ0P26nkhzaAhBCwO7eP3nIRTyun00gSxShsjLha-E2qDGgv2QuQVjf_9IMjN2WwXxK_zjZnOQ1rAOlQFKMEeD-pbm2w3pQcyj2Q562IFsOq_iVy2g2Ki3GLeYnJCeSIdJar4VxNZBUtdmiryDWGHTTGnUS1i-m8RKWkxHfynyBZeBX0x0HVa96SvqTR1nOdU4rtvuXFO3LNls6rdTvstZ0NNVsoAyCJlxTKB7MNMFSnvtYX-zxnyxRtrp_3-zVedew94VI3vyktGepaA\u0026h=AOE6AcOcRhe6dqtN_k7t7YjCsEGc9C08yEcxx-hTYrI", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "18" ], + "x-ms-client-request-id": [ "140eaf24-29e4-4504-8459-9b04736ebcab" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmLogicalNetwork" ], + "FullCommandName": [ "New-AzStackHCIVmLogicalNetwork_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"87029999-0000-0100-0000-6549a1e10000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "6fd03788-bc89-4512-a105-5f3259e8014f" ], + "x-ms-correlation-request-id": [ "f936c72c-ee65-4fe4-b3f1-eca51e7a7008" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T023402Z:f936c72c-ee65-4fe4-b3f1-eca51e7a7008" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 11B14F1412244CAEBA645F6E34487BB7 Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:34:02Z" ], + "Date": [ "Tue, 07 Nov 2023 02:34:02 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "525" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/9252ab61-875e-45ff-9760-71984fd6d99c*FE5444E74E1015B7FEACDDEED4988914A2F237CFF4045B50E050B3E7105285CF\",\"name\":\"9252ab61-875e-45ff-9760-71984fd6d99c*FE5444E74E1015B7FEACDDEED4988914A2F237CFF4045B50E050B3E7105285CF\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/testLnetPowershell1106\",\"status\":\"Accepted\",\"startTime\":\"2023-11-07T02:33:01.4343476Z\"}" + } + }, + "AzStackHCIVmLogicalNetwork+[NoContext]+Create Logical Network +$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/9252ab61-875e-45ff-9760-71984fd6d99c*FE5444E74E1015B7FEACDDEED4988914A2F237CFF4045B50E050B3E7105285CF?api-version=2023-09-01-preview\u0026t=638349211820904677\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=mZB09pRdXoEXoo2dGKH6Ei97624NRu5Mrp_z1CRhDvf3qaNmi811bXVSIJcRu3Z3L3xtLlQ0P26nkhzaAhBCwO7eP3nIRTyun00gSxShsjLha-E2qDGgv2QuQVjf_9IMjN2WwXxK_zjZnOQ1rAOlQFKMEeD-pbm2w3pQcyj2Q562IFsOq_iVy2g2Ki3GLeYnJCeSIdJar4VxNZBUtdmiryDWGHTTGnUS1i-m8RKWkxHfynyBZeBX0x0HVa96SvqTR1nOdU4rtvuXFO3LNls6rdTvstZ0NNVsoAyCJlxTKB7MNMFSnvtYX-zxnyxRtrp_3-zVedew94VI3vyktGepaA\u0026h=AOE6AcOcRhe6dqtN_k7t7YjCsEGc9C08yEcxx-hTYrI+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/9252ab61-875e-45ff-9760-71984fd6d99c*FE5444E74E1015B7FEACDDEED4988914A2F237CFF4045B50E050B3E7105285CF?api-version=2023-09-01-preview\u0026t=638349211820904677\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=mZB09pRdXoEXoo2dGKH6Ei97624NRu5Mrp_z1CRhDvf3qaNmi811bXVSIJcRu3Z3L3xtLlQ0P26nkhzaAhBCwO7eP3nIRTyun00gSxShsjLha-E2qDGgv2QuQVjf_9IMjN2WwXxK_zjZnOQ1rAOlQFKMEeD-pbm2w3pQcyj2Q562IFsOq_iVy2g2Ki3GLeYnJCeSIdJar4VxNZBUtdmiryDWGHTTGnUS1i-m8RKWkxHfynyBZeBX0x0HVa96SvqTR1nOdU4rtvuXFO3LNls6rdTvstZ0NNVsoAyCJlxTKB7MNMFSnvtYX-zxnyxRtrp_3-zVedew94VI3vyktGepaA\u0026h=AOE6AcOcRhe6dqtN_k7t7YjCsEGc9C08yEcxx-hTYrI", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "19" ], + "x-ms-client-request-id": [ "140eaf24-29e4-4504-8459-9b04736ebcab" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmLogicalNetwork" ], + "FullCommandName": [ "New-AzStackHCIVmLogicalNetwork_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"87029999-0000-0100-0000-6549a1e10000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "5ef573ed-8461-446d-a128-ab852c55aefe" ], + "x-ms-correlation-request-id": [ "f60a84c0-9975-49ba-a6ec-a23ee37108cc" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T023432Z:f60a84c0-9975-49ba-a6ec-a23ee37108cc" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 45C4C844CC7C4BAC826E67AC806D9910 Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:34:32Z" ], + "Date": [ "Tue, 07 Nov 2023 02:34:32 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "525" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/9252ab61-875e-45ff-9760-71984fd6d99c*FE5444E74E1015B7FEACDDEED4988914A2F237CFF4045B50E050B3E7105285CF\",\"name\":\"9252ab61-875e-45ff-9760-71984fd6d99c*FE5444E74E1015B7FEACDDEED4988914A2F237CFF4045B50E050B3E7105285CF\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/testLnetPowershell1106\",\"status\":\"Accepted\",\"startTime\":\"2023-11-07T02:33:01.4343476Z\"}" + } + }, + "AzStackHCIVmLogicalNetwork+[NoContext]+Create Logical Network +$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/9252ab61-875e-45ff-9760-71984fd6d99c*FE5444E74E1015B7FEACDDEED4988914A2F237CFF4045B50E050B3E7105285CF?api-version=2023-09-01-preview\u0026t=638349211820904677\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=mZB09pRdXoEXoo2dGKH6Ei97624NRu5Mrp_z1CRhDvf3qaNmi811bXVSIJcRu3Z3L3xtLlQ0P26nkhzaAhBCwO7eP3nIRTyun00gSxShsjLha-E2qDGgv2QuQVjf_9IMjN2WwXxK_zjZnOQ1rAOlQFKMEeD-pbm2w3pQcyj2Q562IFsOq_iVy2g2Ki3GLeYnJCeSIdJar4VxNZBUtdmiryDWGHTTGnUS1i-m8RKWkxHfynyBZeBX0x0HVa96SvqTR1nOdU4rtvuXFO3LNls6rdTvstZ0NNVsoAyCJlxTKB7MNMFSnvtYX-zxnyxRtrp_3-zVedew94VI3vyktGepaA\u0026h=AOE6AcOcRhe6dqtN_k7t7YjCsEGc9C08yEcxx-hTYrI+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/9252ab61-875e-45ff-9760-71984fd6d99c*FE5444E74E1015B7FEACDDEED4988914A2F237CFF4045B50E050B3E7105285CF?api-version=2023-09-01-preview\u0026t=638349211820904677\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=mZB09pRdXoEXoo2dGKH6Ei97624NRu5Mrp_z1CRhDvf3qaNmi811bXVSIJcRu3Z3L3xtLlQ0P26nkhzaAhBCwO7eP3nIRTyun00gSxShsjLha-E2qDGgv2QuQVjf_9IMjN2WwXxK_zjZnOQ1rAOlQFKMEeD-pbm2w3pQcyj2Q562IFsOq_iVy2g2Ki3GLeYnJCeSIdJar4VxNZBUtdmiryDWGHTTGnUS1i-m8RKWkxHfynyBZeBX0x0HVa96SvqTR1nOdU4rtvuXFO3LNls6rdTvstZ0NNVsoAyCJlxTKB7MNMFSnvtYX-zxnyxRtrp_3-zVedew94VI3vyktGepaA\u0026h=AOE6AcOcRhe6dqtN_k7t7YjCsEGc9C08yEcxx-hTYrI", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "20" ], + "x-ms-client-request-id": [ "140eaf24-29e4-4504-8459-9b04736ebcab" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmLogicalNetwork" ], + "FullCommandName": [ "New-AzStackHCIVmLogicalNetwork_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8702b5ae-0000-0100-0000-6549a2540000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "76c46748-45d2-40ec-adb0-8466df0276c8" ], + "x-ms-correlation-request-id": [ "e9ecdc73-3e50-45e9-830a-5e6df6c90e23" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T023502Z:e9ecdc73-3e50-45e9-830a-5e6df6c90e23" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: D505681A4A7946FAB9B9AE322763DC3B Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:35:02Z" ], + "Date": [ "Tue, 07 Nov 2023 02:35:02 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "596" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/9252ab61-875e-45ff-9760-71984fd6d99c*FE5444E74E1015B7FEACDDEED4988914A2F237CFF4045B50E050B3E7105285CF\",\"name\":\"9252ab61-875e-45ff-9760-71984fd6d99c*FE5444E74E1015B7FEACDDEED4988914A2F237CFF4045B50E050B3E7105285CF\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/testLnetPowershell1106\",\"status\":\"Succeeded\",\"startTime\":\"2023-11-07T02:33:01.4343476Z\",\"endTime\":\"2023-11-07T02:35:00.3342028Z\",\"error\":{},\"properties\":null}" + } + }, + "AzStackHCIVmLogicalNetwork+[NoContext]+Create Logical Network +$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/testLnetPowershell1106?api-version=2023-09-01-preview+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/testLnetPowershell1106?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "21" ], + "x-ms-client-request-id": [ "140eaf24-29e4-4504-8459-9b04736ebcab" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmLogicalNetwork" ], + "FullCommandName": [ "New-AzStackHCIVmLogicalNetwork_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"2202ec30-0000-0100-0000-6549a2550000\"" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11992" ], + "x-ms-providerhub-traffic": [ "True" ], + "x-ms-request-id": [ "dcfef893-417f-4846-8c01-9241c59433ff" ], + "x-ms-correlation-request-id": [ "44431153-861c-4f2b-a067-03d45a379d9f" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T023503Z:44431153-861c-4f2b-a067-03d45a379d9f" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 80F788AC2D3C431B8E2552B1FF8DA68A Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:35:02Z" ], + "Date": [ "Tue, 07 Nov 2023 02:35:02 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "931" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/testLnetPowershell1106\",\"name\":\"testLnetPowershell1106\",\"type\":\"microsoft.azurestackhci/logicalnetworks\",\"location\":\"eastus\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T02:33:01.3560261Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-07T02:35:01.0648623Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"subnets\":[{\"properties\":{\"ipAllocationMethod\":\"Dynamic\",\"routeTable\":{\"properties\":{}}}}],\"vmSwitchName\":\"ExternalSwitch\",\"status\":{},\"dhcpOptions\":{}}}" + } + }, + "AzStackHCIVmLogicalNetwork+[NoContext]+List+$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "22" ], + "x-ms-client-request-id": [ "8056359c-a4cc-4814-9f6b-a79c9f748ab3" ], + "CommandName": [ "Get-AzStackHCIVMLogicalNetwork" ], + "FullCommandName": [ "Get-AzStackHCIVmLogicalNetwork_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-original-request-ids": [ "6820d48a-e211-4cef-843d-c22962a43e6a", "30e8b433-4bf1-4358-bda9-cce92e835499", "2accabcf-7c26-4fbc-beab-f2844c5d2503", "4f46a78c-93fb-4e08-a833-48bde6fa1126", "87f3254b-fe30-4566-a157-0a3101933ae9", "1461ba4f-26b5-4623-9ddc-a5d5b34520b3" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11984" ], + "x-ms-request-id": [ "04a7a122-ab37-43f2-a4ed-bb2eb1589b01" ], + "x-ms-correlation-request-id": [ "04a7a122-ab37-43f2-a4ed-bb2eb1589b01" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T023503Z:04a7a122-ab37-43f2-a4ed-bb2eb1589b01" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: DAB1281B2116435E9A6FA86F1BA0FF8C Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:35:03Z" ], + "Date": [ "Tue, 07 Nov 2023 02:35:03 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2660" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/testLnetPowershell1106\",\"name\":\"testLnetPowershell1106\",\"type\":\"microsoft.azurestackhci/logicalnetworks\",\"location\":\"eastus\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T02:33:01.3560261Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-07T02:35:01.0648623Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"subnets\":[{\"properties\":{\"ipAllocationMethod\":\"Dynamic\",\"routeTable\":{\"properties\":{}}}}],\"vmSwitchName\":\"ExternalSwitch\",\"status\":{},\"dhcpOptions\":{}}},{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/altaylvnet2\",\"name\":\"altaylvnet2\",\"type\":\"microsoft.azurestackhci/logicalnetworks\",\"location\":\"eastus2euap\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"altayl@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-10-18T20:57:59.7337776Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-10-20T14:52:58.7058407Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"subnets\":[],\"vmSwitchName\":\"ExternalSwitch\",\"status\":{},\"dhcpOptions\":{}}},{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/bugbashlnet\",\"name\":\"bugbashlnet\",\"type\":\"microsoft.azurestackhci/logicalnetworks\",\"location\":\"eastus2euap\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"altayl@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-01T18:29:16.6925646Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-01T18:31:25.0533724Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"subnets\":[{\"properties\":{\"routeTable\":{\"properties\":{}}}}],\"vmSwitchName\":\"ExternalSwitch\",\"status\":{},\"dhcpOptions\":{}}}]}" + } + }, + "AzStackHCIVmLogicalNetwork+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/testLnetPowershell1106?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/testLnetPowershell1106?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "23" ], + "x-ms-client-request-id": [ "bcdba6fd-6d07-492e-9123-a88e572dc6c7" ], + "CommandName": [ "Get-AzStackHCIVMLogicalNetwork" ], + "FullCommandName": [ "Get-AzStackHCIVmLogicalNetwork_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"2202ec30-0000-0100-0000-6549a2550000\"" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-providerhub-traffic": [ "True" ], + "x-ms-request-id": [ "dd5f646c-ca4f-42a3-be41-a878a4814e63" ], + "x-ms-correlation-request-id": [ "7942b09f-680e-4280-9500-33fffdcb665e" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T023504Z:7942b09f-680e-4280-9500-33fffdcb665e" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 0F05F7664B7B4938AAF4DFE004BCEF6D Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:35:03Z" ], + "Date": [ "Tue, 07 Nov 2023 02:35:03 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "931" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/testLnetPowershell1106\",\"name\":\"testLnetPowershell1106\",\"type\":\"microsoft.azurestackhci/logicalnetworks\",\"location\":\"eastus\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T02:33:01.3560261Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-07T02:35:01.0648623Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"subnets\":[{\"properties\":{\"ipAllocationMethod\":\"Dynamic\",\"routeTable\":{\"properties\":{}}}}],\"vmSwitchName\":\"ExternalSwitch\",\"status\":{},\"dhcpOptions\":{}}}" + } + }, + "AzStackHCIVmLogicalNetwork+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/testLnetPowershell1106?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/testLnetPowershell1106?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "27" ], + "x-ms-client-request-id": [ "40399022-ead1-4aa4-b959-c64a21c1716c" ], + "CommandName": [ "Get-AzStackHCIVMLogicalNetwork" ], + "FullCommandName": [ "Get-AzStackHCIVmLogicalNetwork_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 404, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "x-ms-providerhub-traffic": [ "True" ], + "x-ms-failure-cause": [ "gateway" ], + "x-ms-request-id": [ "8c00aab1-2c59-4732-9a8b-ef7932448c0c" ], + "x-ms-correlation-request-id": [ "12f18c4c-0edd-4100-a516-563ecd284565" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T023535Z:12f18c4c-0edd-4100-a516-563ecd284565" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 6C4D8ADF29E14E2AB32B4857EB691EE0 Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:35:35Z" ], + "Date": [ "Tue, 07 Nov 2023 02:35:35 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "147" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"error\":{\"code\":\"ResourceNotFound\",\"message\":\"The resource \u0027Microsoft.AzureStackHCI/logicalNetworks/testLnetPowershell1106\u0027 could not be found.\"}}" + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmNetworkInterface.Recording.json b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmNetworkInterface.Recording.json new file mode 100644 index 000000000000..038360e36102 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmNetworkInterface.Recording.json @@ -0,0 +1,371 @@ +{ + "AzStackHCIVmNetworkInterface+[NoContext]+Create Network Interface +$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/bugbashlnet?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/bugbashlnet?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "24fe42c8-c3f4-49d1-a27a-196648873d67" ], + "CommandName": [ "Az.StackHCIVm\\Get-AzStackHCIVmLogicalNetwork" ], + "FullCommandName": [ "Get-AzStackHCIVmLogicalNetwork_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"ff00f758-0000-3400-0000-6542997d0000\"" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-providerhub-traffic": [ "True" ], + "x-ms-request-id": [ "854218bf-ed95-4063-a990-e41191308df0" ], + "x-ms-correlation-request-id": [ "302a74a2-6f59-4068-af7b-d768e2a41037" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T072159Z:302a74a2-6f59-4068-af7b-d768e2a41037" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 8ED99655C5264617885FE9916EF292A4 Ref B: CO6AA3150219011 Ref C: 2023-11-07T07:21:59Z" ], + "Date": [ "Tue, 07 Nov 2023 07:21:59 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "881" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/bugbashlnet\",\"name\":\"bugbashlnet\",\"type\":\"microsoft.azurestackhci/logicalnetworks\",\"location\":\"eastus2euap\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"altayl@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-01T18:29:16.6925646Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-01T18:31:25.0533724Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"subnets\":[{\"properties\":{\"routeTable\":{\"properties\":{}}}}],\"vmSwitchName\":\"ExternalSwitch\",\"status\":{},\"dhcpOptions\":{}}}" + } + }, + "AzStackHCIVmNetworkInterface+[NoContext]+Create Network Interface +$PUT+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkInterfaces/testnicPowershell?api-version=2023-09-01-preview+2": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkInterfaces/testnicPowershell?api-version=2023-09-01-preview", + "Content": "{\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"ipConfigurations\": [\r\n {\r\n \"properties\": {\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/bugbashlnet\"\r\n }\r\n }\r\n }\r\n ]\r\n },\r\n \"extendedLocation\": {\r\n \"name\": \"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\r\n \"type\": \"CustomLocation\"\r\n }\r\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "576" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"4f090f3c-0000-0100-0000-6549e5990000\"" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1106" ], + "x-ms-providerhub-traffic": [ "True" ], + "mise-correlation-id": [ "02733218-9088-4b63-8387-8d8888a06feb" ], + "x-ms-request-id": [ "534d95fd-f95e-455a-a12a-acea40f4b8d6" ], + "x-ms-correlation-request-id": [ "3b31b38a-3045-4ca2-92a0-c1666efa6b05" ], + "Azure-AsyncOperation": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/e4304903-dbc0-4a97-9db0-cfb1edefaca9*3C7E6E0BAD1FB2B8E86E11B5C0971F06BF29D4ADA384F1AA9059CBA6B2DDCB50?api-version=2023-09-01-preview\u0026t=638349385212402672\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=SKBzKQlp1TO6SM2QP03q7UfAaszm1HAwgI6WaAGxiehuQL8_Rwe7iiTgB1SHdSCH1YEi7iO38b4kdWL-boqeSAlW5UY3dxPk6-r40oopL-wBPhPE6rF-CR3_JN3jTPi2e4NEyGZZfnH3GiwmK6jhBW--JVpnYHqrbge5lLWoHkQld_wRngBRZlI_-c-hS7_eqbDVf3sBi9aH23lD3O4KvZSEi0Gmm_B_aXnXbFgMnoA0xgLDr8k6fsrfNKlA7TwXmlL9U1f8diiU_wo2VOvgrsBrtnBHBRTF8JTvNIklcFzyYCsz1NnuVLnt7lbj2BPlAWsGmukMG97lFbkBMbmVWQ\u0026h=3qh2RNxovVXdsw8h3nb5XjBflyiHOXVMWodCgB7tc3U" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T072201Z:3b31b38a-3045-4ca2-92a0-c1666efa6b05" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 5CDCA70A99F24D3990CD20016CFA66B6 Ref B: CO6AA3150219011 Ref C: 2023-11-07T07:21:59Z" ], + "Date": [ "Tue, 07 Nov 2023 07:22:00 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "952" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkInterfaces/testnicPowershell\",\"name\":\"testnicPowershell\",\"type\":\"microsoft.azurestackhci/networkinterfaces\",\"location\":\"eastus\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T07:22:00.5996201Z\",\"lastModifiedBy\":\"havedati@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-11-07T07:22:00.5996201Z\"},\"properties\":{\"provisioningState\":\"Accepted\",\"ipConfigurations\":[{\"properties\":{\"subnet\":{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/bugbashlnet\"}}}]}}" + } + }, + "AzStackHCIVmNetworkInterface+[NoContext]+Create Network Interface +$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/e4304903-dbc0-4a97-9db0-cfb1edefaca9*3C7E6E0BAD1FB2B8E86E11B5C0971F06BF29D4ADA384F1AA9059CBA6B2DDCB50?api-version=2023-09-01-preview\u0026t=638349385212402672\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=SKBzKQlp1TO6SM2QP03q7UfAaszm1HAwgI6WaAGxiehuQL8_Rwe7iiTgB1SHdSCH1YEi7iO38b4kdWL-boqeSAlW5UY3dxPk6-r40oopL-wBPhPE6rF-CR3_JN3jTPi2e4NEyGZZfnH3GiwmK6jhBW--JVpnYHqrbge5lLWoHkQld_wRngBRZlI_-c-hS7_eqbDVf3sBi9aH23lD3O4KvZSEi0Gmm_B_aXnXbFgMnoA0xgLDr8k6fsrfNKlA7TwXmlL9U1f8diiU_wo2VOvgrsBrtnBHBRTF8JTvNIklcFzyYCsz1NnuVLnt7lbj2BPlAWsGmukMG97lFbkBMbmVWQ\u0026h=3qh2RNxovVXdsw8h3nb5XjBflyiHOXVMWodCgB7tc3U+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/e4304903-dbc0-4a97-9db0-cfb1edefaca9*3C7E6E0BAD1FB2B8E86E11B5C0971F06BF29D4ADA384F1AA9059CBA6B2DDCB50?api-version=2023-09-01-preview\u0026t=638349385212402672\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=SKBzKQlp1TO6SM2QP03q7UfAaszm1HAwgI6WaAGxiehuQL8_Rwe7iiTgB1SHdSCH1YEi7iO38b4kdWL-boqeSAlW5UY3dxPk6-r40oopL-wBPhPE6rF-CR3_JN3jTPi2e4NEyGZZfnH3GiwmK6jhBW--JVpnYHqrbge5lLWoHkQld_wRngBRZlI_-c-hS7_eqbDVf3sBi9aH23lD3O4KvZSEi0Gmm_B_aXnXbFgMnoA0xgLDr8k6fsrfNKlA7TwXmlL9U1f8diiU_wo2VOvgrsBrtnBHBRTF8JTvNIklcFzyYCsz1NnuVLnt7lbj2BPlAWsGmukMG97lFbkBMbmVWQ\u0026h=3qh2RNxovVXdsw8h3nb5XjBflyiHOXVMWodCgB7tc3U", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "8747615a-93df-4c3d-974f-d7f585605c37" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmNetworkInterface" ], + "FullCommandName": [ "New-AzStackHCIVmNetworkInterface_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"93026b8a-0000-0100-0000-6549e5a10000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "f76fcb08-2023-45da-a641-150ba7a166fc" ], + "x-ms-correlation-request-id": [ "5477bcad-a975-44ce-945e-c47d79676524" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T072231Z:5477bcad-a975-44ce-945e-c47d79676524" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: F4E00839F1AD422AA715DC15A20A42EE Ref B: CO6AA3150219011 Ref C: 2023-11-07T07:22:31Z" ], + "Date": [ "Tue, 07 Nov 2023 07:22:31 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "522" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/e4304903-dbc0-4a97-9db0-cfb1edefaca9*3C7E6E0BAD1FB2B8E86E11B5C0971F06BF29D4ADA384F1AA9059CBA6B2DDCB50\",\"name\":\"e4304903-dbc0-4a97-9db0-cfb1edefaca9*3C7E6E0BAD1FB2B8E86E11B5C0971F06BF29D4ADA384F1AA9059CBA6B2DDCB50\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkInterfaces/testnicPowershell\",\"status\":\"Accepted\",\"startTime\":\"2023-11-07T07:22:00.6742692Z\"}" + } + }, + "AzStackHCIVmNetworkInterface+[NoContext]+Create Network Interface +$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/e4304903-dbc0-4a97-9db0-cfb1edefaca9*3C7E6E0BAD1FB2B8E86E11B5C0971F06BF29D4ADA384F1AA9059CBA6B2DDCB50?api-version=2023-09-01-preview\u0026t=638349385212402672\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=SKBzKQlp1TO6SM2QP03q7UfAaszm1HAwgI6WaAGxiehuQL8_Rwe7iiTgB1SHdSCH1YEi7iO38b4kdWL-boqeSAlW5UY3dxPk6-r40oopL-wBPhPE6rF-CR3_JN3jTPi2e4NEyGZZfnH3GiwmK6jhBW--JVpnYHqrbge5lLWoHkQld_wRngBRZlI_-c-hS7_eqbDVf3sBi9aH23lD3O4KvZSEi0Gmm_B_aXnXbFgMnoA0xgLDr8k6fsrfNKlA7TwXmlL9U1f8diiU_wo2VOvgrsBrtnBHBRTF8JTvNIklcFzyYCsz1NnuVLnt7lbj2BPlAWsGmukMG97lFbkBMbmVWQ\u0026h=3qh2RNxovVXdsw8h3nb5XjBflyiHOXVMWodCgB7tc3U+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/e4304903-dbc0-4a97-9db0-cfb1edefaca9*3C7E6E0BAD1FB2B8E86E11B5C0971F06BF29D4ADA384F1AA9059CBA6B2DDCB50?api-version=2023-09-01-preview\u0026t=638349385212402672\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=SKBzKQlp1TO6SM2QP03q7UfAaszm1HAwgI6WaAGxiehuQL8_Rwe7iiTgB1SHdSCH1YEi7iO38b4kdWL-boqeSAlW5UY3dxPk6-r40oopL-wBPhPE6rF-CR3_JN3jTPi2e4NEyGZZfnH3GiwmK6jhBW--JVpnYHqrbge5lLWoHkQld_wRngBRZlI_-c-hS7_eqbDVf3sBi9aH23lD3O4KvZSEi0Gmm_B_aXnXbFgMnoA0xgLDr8k6fsrfNKlA7TwXmlL9U1f8diiU_wo2VOvgrsBrtnBHBRTF8JTvNIklcFzyYCsz1NnuVLnt7lbj2BPlAWsGmukMG97lFbkBMbmVWQ\u0026h=3qh2RNxovVXdsw8h3nb5XjBflyiHOXVMWodCgB7tc3U", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "8747615a-93df-4c3d-974f-d7f585605c37" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmNetworkInterface" ], + "FullCommandName": [ "New-AzStackHCIVmNetworkInterface_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"93026b8a-0000-0100-0000-6549e5a10000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "1c1ba93d-4179-4218-b34c-79bd9e97b573" ], + "x-ms-correlation-request-id": [ "3d97dfa7-44d3-4920-a638-02055959e029" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T072301Z:3d97dfa7-44d3-4920-a638-02055959e029" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: FB1D53828E654E1EABD6D666FE0492BC Ref B: CO6AA3150219011 Ref C: 2023-11-07T07:23:01Z" ], + "Date": [ "Tue, 07 Nov 2023 07:23:01 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "522" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/e4304903-dbc0-4a97-9db0-cfb1edefaca9*3C7E6E0BAD1FB2B8E86E11B5C0971F06BF29D4ADA384F1AA9059CBA6B2DDCB50\",\"name\":\"e4304903-dbc0-4a97-9db0-cfb1edefaca9*3C7E6E0BAD1FB2B8E86E11B5C0971F06BF29D4ADA384F1AA9059CBA6B2DDCB50\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkInterfaces/testnicPowershell\",\"status\":\"Accepted\",\"startTime\":\"2023-11-07T07:22:00.6742692Z\"}" + } + }, + "AzStackHCIVmNetworkInterface+[NoContext]+Create Network Interface +$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/e4304903-dbc0-4a97-9db0-cfb1edefaca9*3C7E6E0BAD1FB2B8E86E11B5C0971F06BF29D4ADA384F1AA9059CBA6B2DDCB50?api-version=2023-09-01-preview\u0026t=638349385212402672\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=SKBzKQlp1TO6SM2QP03q7UfAaszm1HAwgI6WaAGxiehuQL8_Rwe7iiTgB1SHdSCH1YEi7iO38b4kdWL-boqeSAlW5UY3dxPk6-r40oopL-wBPhPE6rF-CR3_JN3jTPi2e4NEyGZZfnH3GiwmK6jhBW--JVpnYHqrbge5lLWoHkQld_wRngBRZlI_-c-hS7_eqbDVf3sBi9aH23lD3O4KvZSEi0Gmm_B_aXnXbFgMnoA0xgLDr8k6fsrfNKlA7TwXmlL9U1f8diiU_wo2VOvgrsBrtnBHBRTF8JTvNIklcFzyYCsz1NnuVLnt7lbj2BPlAWsGmukMG97lFbkBMbmVWQ\u0026h=3qh2RNxovVXdsw8h3nb5XjBflyiHOXVMWodCgB7tc3U+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/e4304903-dbc0-4a97-9db0-cfb1edefaca9*3C7E6E0BAD1FB2B8E86E11B5C0971F06BF29D4ADA384F1AA9059CBA6B2DDCB50?api-version=2023-09-01-preview\u0026t=638349385212402672\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=SKBzKQlp1TO6SM2QP03q7UfAaszm1HAwgI6WaAGxiehuQL8_Rwe7iiTgB1SHdSCH1YEi7iO38b4kdWL-boqeSAlW5UY3dxPk6-r40oopL-wBPhPE6rF-CR3_JN3jTPi2e4NEyGZZfnH3GiwmK6jhBW--JVpnYHqrbge5lLWoHkQld_wRngBRZlI_-c-hS7_eqbDVf3sBi9aH23lD3O4KvZSEi0Gmm_B_aXnXbFgMnoA0xgLDr8k6fsrfNKlA7TwXmlL9U1f8diiU_wo2VOvgrsBrtnBHBRTF8JTvNIklcFzyYCsz1NnuVLnt7lbj2BPlAWsGmukMG97lFbkBMbmVWQ\u0026h=3qh2RNxovVXdsw8h3nb5XjBflyiHOXVMWodCgB7tc3U", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "5" ], + "x-ms-client-request-id": [ "8747615a-93df-4c3d-974f-d7f585605c37" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmNetworkInterface" ], + "FullCommandName": [ "New-AzStackHCIVmNetworkInterface_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"93028996-0000-0100-0000-6549e5e20000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "84a10f14-7a15-441d-92d7-2e953b559c5a" ], + "x-ms-correlation-request-id": [ "e4ad963f-819d-43a6-820a-2aa68acde2fc" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T072331Z:e4ad963f-819d-43a6-820a-2aa68acde2fc" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: DA45DB840F694ADC98434ECBC824194B Ref B: CO6AA3150219011 Ref C: 2023-11-07T07:23:31Z" ], + "Date": [ "Tue, 07 Nov 2023 07:23:31 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "593" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/e4304903-dbc0-4a97-9db0-cfb1edefaca9*3C7E6E0BAD1FB2B8E86E11B5C0971F06BF29D4ADA384F1AA9059CBA6B2DDCB50\",\"name\":\"e4304903-dbc0-4a97-9db0-cfb1edefaca9*3C7E6E0BAD1FB2B8E86E11B5C0971F06BF29D4ADA384F1AA9059CBA6B2DDCB50\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkInterfaces/testnicPowershell\",\"status\":\"Succeeded\",\"startTime\":\"2023-11-07T07:22:00.6742692Z\",\"endTime\":\"2023-11-07T07:23:14.2145668Z\",\"error\":{},\"properties\":null}" + } + }, + "AzStackHCIVmNetworkInterface+[NoContext]+Create Network Interface +$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkInterfaces/testnicPowershell?api-version=2023-09-01-preview+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkInterfaces/testnicPowershell?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "6" ], + "x-ms-client-request-id": [ "8747615a-93df-4c3d-974f-d7f585605c37" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmNetworkInterface" ], + "FullCommandName": [ "New-AzStackHCIVmNetworkInterface_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"4f09b251-0000-0100-0000-6549e5e30000\"" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-providerhub-traffic": [ "True" ], + "x-ms-request-id": [ "7938d75d-9c23-45d2-8fff-d97574640732" ], + "x-ms-correlation-request-id": [ "10777645-13f3-40fe-b776-19ab502b1c95" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T072332Z:10777645-13f3-40fe-b776-19ab502b1c95" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: E200FDD348724E19B1189902EDED2059 Ref B: CO6AA3150219011 Ref C: 2023-11-07T07:23:32Z" ], + "Date": [ "Tue, 07 Nov 2023 07:23:31 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "823" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkInterfaces/testnicPowershell\",\"name\":\"testnicPowershell\",\"type\":\"microsoft.azurestackhci/networkinterfaces\",\"location\":\"eastus\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T07:22:00.5996201Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-07T07:23:15.207965Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"ipConfigurations\":[],\"status\":{},\"dnsSettings\":{}}}" + } + }, + "AzStackHCIVmNetworkInterface+[NoContext]+List+$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkInterfaces?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkInterfaces?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "7" ], + "x-ms-client-request-id": [ "13972824-aa51-40cd-9a70-c41d8bc1e0d0" ], + "CommandName": [ "Get-AzStackHCIVMNetworkInterface" ], + "FullCommandName": [ "Get-AzStackHCIVmNetworkInterface_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-original-request-ids": [ "3f06195d-ec85-4bd7-8159-13491d26a96c", "735ee9b9-d0fe-43ca-a064-3dd6b1c36501", "0ba19aa7-1702-486d-ba94-0539869c54c7", "7d61a7d7-301b-4696-b25a-b64d6adc7a8f", "4d1d4453-ab5d-42e8-9dca-2e6be984e127", "de9b0ac8-a76c-4bdc-be5e-eb434ff6d727", "4ba2d0a6-b455-44d0-ad2b-d4f814b4391f", "163457c3-df1c-45b0-9b91-09a8392cc52a", "3688603f-6b85-41f5-803b-2f17c990159a", "4736c28f-9153-410a-816d-8ffa13ca40e8" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "93897bbe-a1f5-47e9-96b1-0a922d1114c6" ], + "x-ms-correlation-request-id": [ "93897bbe-a1f5-47e9-96b1-0a922d1114c6" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T072333Z:93897bbe-a1f5-47e9-96b1-0a922d1114c6" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 7C07A11C49CD4499B8DA564D89C2B0D5 Ref B: CO6AA3150219011 Ref C: 2023-11-07T07:23:32Z" ], + "Date": [ "Tue, 07 Nov 2023 07:23:33 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "13517" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkInterfaces/testwithnewChanges\",\"name\":\"testwithnewChanges\",\"type\":\"microsoft.azurestackhci/networkinterfaces\",\"location\":\"eastus\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T07:14:13.2092843Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-07T07:15:23.7836499Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"ipConfigurations\":[{\"properties\":{\"subnet\":{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/bugbashlnet\"}}}],\"status\":{},\"dnsSettings\":{}}},{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkInterfaces/testnicPowershell\",\"name\":\"testnicPowershell\",\"type\":\"microsoft.azurestackhci/networkinterfaces\",\"location\":\"eastus\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T07:22:00.5996201Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-07T07:23:15.207965Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"ipConfigurations\":[],\"status\":{},\"dnsSettings\":{}}},{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkinterfaces/newapinic\",\"name\":\"newapinic\",\"type\":\"microsoft.azurestackhci/networkinterfaces\",\"location\":\"eastus2euap\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"altayl@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-10-18T18:41:59.1193017Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-10-18T19:51:14.8642739Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"ipConfigurations\":[{\"properties\":{\"privateIPAddress\":\"10.193.232.11\",\"subnet\":{\"id\":\"altaylvnet1\"}}}],\"status\":{},\"dnsSettings\":{}}},{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkinterfaces/newapinic1\",\"name\":\"newapinic1\",\"type\":\"microsoft.azurestackhci/networkinterfaces\",\"location\":\"eastus2euap\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"altayl@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-10-18T19:35:38.870064Z\",\"lastModifiedBy\":\"altayl@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-10-18T19:38:22.8351729Z\"},\"properties\":{\"provisioningState\":\"Failed\",\"ipConfigurations\":[{\"name\":\"ipconfig\",\"properties\":{\"subnet\":{\"id\":\"altaylvnet1\"}}}]}},{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkinterfaces/newapinic2\",\"name\":\"newapinic2\",\"type\":\"microsoft.azurestackhci/networkinterfaces\",\"location\":\"eastus2euap\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"altayl@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-10-18T19:41:39.0815776Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-10-19T18:04:36.1243245Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"ipConfigurations\":[{\"properties\":{\"privateIPAddress\":\"10.193.232.8\",\"subnet\":{\"id\":\"altaylvnet1\"}}}],\"status\":{},\"dnsSettings\":{}}},{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkinterfaces/newapinic3\",\"name\":\"newapinic3\",\"type\":\"microsoft.azurestackhci/networkinterfaces\",\"location\":\"eastus2euap\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"altayl@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-10-18T20:18:47.215525Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-10-18T20:31:11.5963955Z\"},\"properties\":{\"provisioningState\":\"Failed\",\"status\":{\"errorCode\":\"NotFound\",\"errorMessage\":\"The moc-operator network interface service returned an error while reconciling: rpc error: code = NotFound desc = Failed to find vnet [altaylvnet1] in ipconfiguration [subnetid:\\\"altaylvnet1\\\" allocation:Dynamic ] : Type[VirtualNetwork], Location[MocLocation], Group[Default_Group], Name[altaylvnet1]: Not Found\"},\"ipConfigurations\":[]}},{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkinterfaces/lnetnic\",\"name\":\"lnetnic\",\"type\":\"microsoft.azurestackhci/networkinterfaces\",\"location\":\"eastus2euap\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"altayl@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-10-20T14:56:49.1318822Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-10-20T15:27:57.38329Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"ipConfigurations\":[{\"properties\":{\"privateIPAddress\":\"10.193.232.23\",\"subnet\":{\"id\":\"altaylvnet2\"}}}],\"status\":{},\"dnsSettings\":{}}},{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkinterfaces/lnetnic1\",\"name\":\"lnetnic1\",\"type\":\"microsoft.azurestackhci/networkinterfaces\",\"location\":\"eastus2euap\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"altayl@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-10-23T21:26:14.3056588Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-10-23T21:37:07.9142932Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"ipConfigurations\":[{\"properties\":{\"privateIPAddress\":\"10.193.232.24\",\"subnet\":{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/altaylvnet2\"}}}],\"status\":{},\"dnsSettings\":{}}},{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkinterfaces/lnetnic2\",\"name\":\"lnetnic2\",\"type\":\"microsoft.azurestackhci/networkinterfaces\",\"location\":\"eastus2euap\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"altayl@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-10-26T18:19:07.1743813Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-10-26T18:49:19.6892259Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"ipConfigurations\":[{\"properties\":{\"privateIPAddress\":\"10.193.232.8\",\"subnet\":{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/altaylvnet2\"}}}],\"status\":{},\"dnsSettings\":{}}},{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkinterfaces/lnetnic3\",\"name\":\"lnetnic3\",\"type\":\"microsoft.azurestackhci/networkinterfaces\",\"location\":\"eastus2euap\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"altayl@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-10-26T19:03:54.4502347Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-10-26T19:05:06.1094749Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"ipConfigurations\":[{\"properties\":{\"subnet\":{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/altaylvnet2\"}}}],\"status\":{},\"dnsSettings\":{}}},{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkinterfaces/lnetnic4\",\"name\":\"lnetnic4\",\"type\":\"microsoft.azurestackhci/networkinterfaces\",\"location\":\"eastus2euap\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"altayl@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-10-31T14:52:47.1394646Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-10-31T14:57:08.7933478Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"ipConfigurations\":[{\"properties\":{\"subnet\":{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/altaylvnet2\"}}}],\"status\":{},\"dnsSettings\":{}}},{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkInterfaces/bugbashnic\",\"name\":\"bugbashnic\",\"type\":\"microsoft.azurestackhci/networkinterfaces\",\"location\":\"eastus2euap\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"altayl@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-01T18:33:46.8517873Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-01T18:34:59.7579647Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"ipConfigurations\":[{\"properties\":{\"subnet\":{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/bugbashlnet\"}}}],\"status\":{},\"dnsSettings\":{}}},{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkInterfaces/bugbashnic2\",\"name\":\"bugbashnic2\",\"type\":\"microsoft.azurestackhci/networkinterfaces\",\"location\":\"eastus2euap\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"altayl@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-01T18:45:12.3420216Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-01T18:51:30.9619009Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"ipConfigurations\":[{\"properties\":{\"privateIPAddress\":\"10.193.232.25\",\"subnet\":{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/bugbashlnet\"}}}],\"status\":{},\"dnsSettings\":{}}},{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkinterfaces/lnetnic5\",\"name\":\"lnetnic5\",\"type\":\"microsoft.azurestackhci/networkinterfaces\",\"location\":\"eastus2euap\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"altayl@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-01T21:11:34.4146945Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-01T21:12:45.893972Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"ipConfigurations\":[{\"properties\":{\"subnet\":{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/altaylvnet2\"}}}],\"status\":{},\"dnsSettings\":{}}}]}" + } + }, + "AzStackHCIVmNetworkInterface+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkInterfaces/testnicPowershell?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkInterfaces/testnicPowershell?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "8" ], + "x-ms-client-request-id": [ "be48d922-8338-4915-a7d7-8006447f5732" ], + "CommandName": [ "Get-AzStackHCIVMNetworkInterface" ], + "FullCommandName": [ "Get-AzStackHCIVmNetworkInterface_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"4f094455-0000-0100-0000-6549e5f40000\"" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11997" ], + "x-ms-providerhub-traffic": [ "True" ], + "x-ms-request-id": [ "37af656f-5168-43c8-a6aa-ad057a9f51bd" ], + "x-ms-correlation-request-id": [ "d85408ee-3a17-4d37-ac9a-1e580bded47d" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T072334Z:d85408ee-3a17-4d37-ac9a-1e580bded47d" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 632B944DBDED44D292C94A8DD9487075 Ref B: CO6AA3150219011 Ref C: 2023-11-07T07:23:33Z" ], + "Date": [ "Tue, 07 Nov 2023 07:23:33 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1003" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkInterfaces/testnicPowershell\",\"name\":\"testnicPowershell\",\"type\":\"microsoft.azurestackhci/networkinterfaces\",\"location\":\"eastus\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T07:22:00.5996201Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-07T07:23:32.6611841Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"ipConfigurations\":[{\"properties\":{\"subnet\":{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/bugbashlnet\"}}}],\"status\":{},\"dnsSettings\":{}}}" + } + }, + "AzStackHCIVmNetworkInterface+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkInterfaces/testnicPowershell?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/networkInterfaces/testnicPowershell?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "12" ], + "x-ms-client-request-id": [ "339f2534-2064-481b-ad1a-f455413cb369" ], + "CommandName": [ "Get-AzStackHCIVMNetworkInterface" ], + "FullCommandName": [ "Get-AzStackHCIVmNetworkInterface_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 404, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-failure-cause": [ "gateway" ], + "x-ms-request-id": [ "874469a8-2a56-4c47-982b-e050933671bc" ], + "x-ms-correlation-request-id": [ "874469a8-2a56-4c47-982b-e050933671bc" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T072405Z:874469a8-2a56-4c47-982b-e050933671bc" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 74D3F9FA487448F9AFC2CBB079E82037 Ref B: CO6AA3150219011 Ref C: 2023-11-07T07:24:05Z" ], + "Date": [ "Tue, 07 Nov 2023 07:24:04 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "246" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"error\":{\"code\":\"ResourceNotFound\",\"message\":\"The Resource \u0027Microsoft.AzureStackHCI/networkInterfaces/testnicPowershell\u0027 under resource group \u0027AltaylSnClus-rg\u0027 was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix\"}}" + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmStoragePath.Recording.json b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmStoragePath.Recording.json new file mode 100644 index 000000000000..2fae72c331e7 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmStoragePath.Recording.json @@ -0,0 +1,456 @@ +{ + "AzStackHCIVmStoragePath+[NoContext]+Create Storage Path +$PUT+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/storageContainers/teststoragepath1106?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/storageContainers/teststoragepath1106?api-version=2023-09-01-preview", + "Content": "{\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"path\": \"C:\\\\\\\\ClusterStorage\\\\\\\\Volume1\\\\\\\\testPath1106\"\r\n },\r\n \"extendedLocation\": {\r\n \"name\": \"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\r\n \"type\": \"CustomLocation\"\r\n }\r\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "349" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"870214b5-0000-0100-0000-6549a3ae0000\"" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "x-ms-providerhub-traffic": [ "True" ], + "mise-correlation-id": [ "3ecb6b7f-e36f-4c90-9394-98d9ae9aebee" ], + "x-ms-request-id": [ "d7867eea-6975-4a3c-b4c0-007f8535bea8" ], + "x-ms-correlation-request-id": [ "f4957803-fc5c-4506-afa2-4ae9c61c89af" ], + "Azure-AsyncOperation": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/f4333ca0-d8c7-46a9-9034-b5ec179d65a1*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4?api-version=2023-09-01-preview\u0026t=638349216465454976\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=NOd-QkEW_uGauTfL4XDvjjcDK81UuWe6tEjNrPd_3GDgkbQz-uzlubmuOT5T_zf3R2-KUuqlMrza7wxX9mLsazQILxiFmD6lVbve5kdFLZQljsAtjplcXDSFqBK5cWcEq34RP59B8KuIUuvTqemRFygwAQ0CdYyNMNtWLMlxcFrSIOSkoDhpbO6gymZTgH9RpQSQm695J_aIsU7vxU7LUknUMOL8QxIfVUm-r3JEdk2INPP_puMgPT1V1Ly29pSgWxX-00WBJmg8vmGDv8GZYWGM9qL1ooIueIiJGuK0ypKcvNKNp7VPMXIQqJEm-yGrotA0Tf2GO9eOeD53mG1Y_g\u0026h=OvRuzUVv95q_Ge7APGDRtAFaVAaf0tH1Ir8l88MJ_1k" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T024046Z:f4957803-fc5c-4506-afa2-4ae9c61c89af" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: A34A81198C8B4DB19BFA400913F94525 Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:40:45Z" ], + "Date": [ "Tue, 07 Nov 2023 02:40:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "812" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/storageContainers/teststoragepath1106\",\"name\":\"teststoragepath1106\",\"type\":\"microsoft.azurestackhci/storagecontainers\",\"location\":\"eastus\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T02:40:45.8111178Z\",\"lastModifiedBy\":\"havedati@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-11-07T02:40:45.8111178Z\"},\"properties\":{\"provisioningState\":\"Accepted\",\"path\":\"C:\\\\\\\\ClusterStorage\\\\\\\\Volume1\\\\\\\\testPath1106\"}}" + } + }, + "AzStackHCIVmStoragePath+[NoContext]+Create Storage Path +$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/f4333ca0-d8c7-46a9-9034-b5ec179d65a1*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4?api-version=2023-09-01-preview\u0026t=638349216465454976\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=NOd-QkEW_uGauTfL4XDvjjcDK81UuWe6tEjNrPd_3GDgkbQz-uzlubmuOT5T_zf3R2-KUuqlMrza7wxX9mLsazQILxiFmD6lVbve5kdFLZQljsAtjplcXDSFqBK5cWcEq34RP59B8KuIUuvTqemRFygwAQ0CdYyNMNtWLMlxcFrSIOSkoDhpbO6gymZTgH9RpQSQm695J_aIsU7vxU7LUknUMOL8QxIfVUm-r3JEdk2INPP_puMgPT1V1Ly29pSgWxX-00WBJmg8vmGDv8GZYWGM9qL1ooIueIiJGuK0ypKcvNKNp7VPMXIQqJEm-yGrotA0Tf2GO9eOeD53mG1Y_g\u0026h=OvRuzUVv95q_Ge7APGDRtAFaVAaf0tH1Ir8l88MJ_1k+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/f4333ca0-d8c7-46a9-9034-b5ec179d65a1*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4?api-version=2023-09-01-preview\u0026t=638349216465454976\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=NOd-QkEW_uGauTfL4XDvjjcDK81UuWe6tEjNrPd_3GDgkbQz-uzlubmuOT5T_zf3R2-KUuqlMrza7wxX9mLsazQILxiFmD6lVbve5kdFLZQljsAtjplcXDSFqBK5cWcEq34RP59B8KuIUuvTqemRFygwAQ0CdYyNMNtWLMlxcFrSIOSkoDhpbO6gymZTgH9RpQSQm695J_aIsU7vxU7LUknUMOL8QxIfVUm-r3JEdk2INPP_puMgPT1V1Ly29pSgWxX-00WBJmg8vmGDv8GZYWGM9qL1ooIueIiJGuK0ypKcvNKNp7VPMXIQqJEm-yGrotA0Tf2GO9eOeD53mG1Y_g\u0026h=OvRuzUVv95q_Ge7APGDRtAFaVAaf0tH1Ir8l88MJ_1k", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "51" ], + "x-ms-client-request-id": [ "c53a4b70-b86d-4d64-ac0c-d2bab1fa9ef5" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmStoragePath" ], + "FullCommandName": [ "New-AzStackHCIVmStoragePath_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8702dcea-0000-0100-0000-6549a3b40000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "635c81fa-66f2-4130-8b94-99b6bc146660" ], + "x-ms-correlation-request-id": [ "0f85a1f1-d881-4798-b31c-257900e34385" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T024116Z:0f85a1f1-d881-4798-b31c-257900e34385" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 12632E7BAD0543039EBD78826F934924 Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:41:16Z" ], + "Date": [ "Tue, 07 Nov 2023 02:41:15 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "524" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/f4333ca0-d8c7-46a9-9034-b5ec179d65a1*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4\",\"name\":\"f4333ca0-d8c7-46a9-9034-b5ec179d65a1*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/storageContainers/teststoragepath1106\",\"status\":\"Accepted\",\"startTime\":\"2023-11-07T02:40:45.8814868Z\"}" + } + }, + "AzStackHCIVmStoragePath+[NoContext]+Create Storage Path +$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/f4333ca0-d8c7-46a9-9034-b5ec179d65a1*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4?api-version=2023-09-01-preview\u0026t=638349216465454976\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=NOd-QkEW_uGauTfL4XDvjjcDK81UuWe6tEjNrPd_3GDgkbQz-uzlubmuOT5T_zf3R2-KUuqlMrza7wxX9mLsazQILxiFmD6lVbve5kdFLZQljsAtjplcXDSFqBK5cWcEq34RP59B8KuIUuvTqemRFygwAQ0CdYyNMNtWLMlxcFrSIOSkoDhpbO6gymZTgH9RpQSQm695J_aIsU7vxU7LUknUMOL8QxIfVUm-r3JEdk2INPP_puMgPT1V1Ly29pSgWxX-00WBJmg8vmGDv8GZYWGM9qL1ooIueIiJGuK0ypKcvNKNp7VPMXIQqJEm-yGrotA0Tf2GO9eOeD53mG1Y_g\u0026h=OvRuzUVv95q_Ge7APGDRtAFaVAaf0tH1Ir8l88MJ_1k+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/f4333ca0-d8c7-46a9-9034-b5ec179d65a1*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4?api-version=2023-09-01-preview\u0026t=638349216465454976\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=NOd-QkEW_uGauTfL4XDvjjcDK81UuWe6tEjNrPd_3GDgkbQz-uzlubmuOT5T_zf3R2-KUuqlMrza7wxX9mLsazQILxiFmD6lVbve5kdFLZQljsAtjplcXDSFqBK5cWcEq34RP59B8KuIUuvTqemRFygwAQ0CdYyNMNtWLMlxcFrSIOSkoDhpbO6gymZTgH9RpQSQm695J_aIsU7vxU7LUknUMOL8QxIfVUm-r3JEdk2INPP_puMgPT1V1Ly29pSgWxX-00WBJmg8vmGDv8GZYWGM9qL1ooIueIiJGuK0ypKcvNKNp7VPMXIQqJEm-yGrotA0Tf2GO9eOeD53mG1Y_g\u0026h=OvRuzUVv95q_Ge7APGDRtAFaVAaf0tH1Ir8l88MJ_1k", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "52" ], + "x-ms-client-request-id": [ "c53a4b70-b86d-4d64-ac0c-d2bab1fa9ef5" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmStoragePath" ], + "FullCommandName": [ "New-AzStackHCIVmStoragePath_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8702dcea-0000-0100-0000-6549a3b40000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "919a4b09-bb33-4d7f-8000-77086415a999" ], + "x-ms-correlation-request-id": [ "8d0726dd-a212-40ba-8541-280f86b100f2" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T024146Z:8d0726dd-a212-40ba-8541-280f86b100f2" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 91E62F90A5954C86A6E25D22F173820F Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:41:46Z" ], + "Date": [ "Tue, 07 Nov 2023 02:41:46 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "524" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/f4333ca0-d8c7-46a9-9034-b5ec179d65a1*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4\",\"name\":\"f4333ca0-d8c7-46a9-9034-b5ec179d65a1*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/storageContainers/teststoragepath1106\",\"status\":\"Accepted\",\"startTime\":\"2023-11-07T02:40:45.8814868Z\"}" + } + }, + "AzStackHCIVmStoragePath+[NoContext]+Create Storage Path +$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/f4333ca0-d8c7-46a9-9034-b5ec179d65a1*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4?api-version=2023-09-01-preview\u0026t=638349216465454976\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=NOd-QkEW_uGauTfL4XDvjjcDK81UuWe6tEjNrPd_3GDgkbQz-uzlubmuOT5T_zf3R2-KUuqlMrza7wxX9mLsazQILxiFmD6lVbve5kdFLZQljsAtjplcXDSFqBK5cWcEq34RP59B8KuIUuvTqemRFygwAQ0CdYyNMNtWLMlxcFrSIOSkoDhpbO6gymZTgH9RpQSQm695J_aIsU7vxU7LUknUMOL8QxIfVUm-r3JEdk2INPP_puMgPT1V1Ly29pSgWxX-00WBJmg8vmGDv8GZYWGM9qL1ooIueIiJGuK0ypKcvNKNp7VPMXIQqJEm-yGrotA0Tf2GO9eOeD53mG1Y_g\u0026h=OvRuzUVv95q_Ge7APGDRtAFaVAaf0tH1Ir8l88MJ_1k+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/f4333ca0-d8c7-46a9-9034-b5ec179d65a1*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4?api-version=2023-09-01-preview\u0026t=638349216465454976\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=NOd-QkEW_uGauTfL4XDvjjcDK81UuWe6tEjNrPd_3GDgkbQz-uzlubmuOT5T_zf3R2-KUuqlMrza7wxX9mLsazQILxiFmD6lVbve5kdFLZQljsAtjplcXDSFqBK5cWcEq34RP59B8KuIUuvTqemRFygwAQ0CdYyNMNtWLMlxcFrSIOSkoDhpbO6gymZTgH9RpQSQm695J_aIsU7vxU7LUknUMOL8QxIfVUm-r3JEdk2INPP_puMgPT1V1Ly29pSgWxX-00WBJmg8vmGDv8GZYWGM9qL1ooIueIiJGuK0ypKcvNKNp7VPMXIQqJEm-yGrotA0Tf2GO9eOeD53mG1Y_g\u0026h=OvRuzUVv95q_Ge7APGDRtAFaVAaf0tH1Ir8l88MJ_1k", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "53" ], + "x-ms-client-request-id": [ "c53a4b70-b86d-4d64-ac0c-d2bab1fa9ef5" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmStoragePath" ], + "FullCommandName": [ "New-AzStackHCIVmStoragePath_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8702b6f4-0000-0100-0000-6549a3f10000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "79186db5-292c-442d-b559-425db00ca607" ], + "x-ms-correlation-request-id": [ "3be1c3bf-daae-48d0-9eb1-8901fbb79e5b" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T024217Z:3be1c3bf-daae-48d0-9eb1-8901fbb79e5b" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: A63B46784D9349BBA4A0CC839180AE7B Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:42:16Z" ], + "Date": [ "Tue, 07 Nov 2023 02:42:16 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "595" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/f4333ca0-d8c7-46a9-9034-b5ec179d65a1*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4\",\"name\":\"f4333ca0-d8c7-46a9-9034-b5ec179d65a1*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/storageContainers/teststoragepath1106\",\"status\":\"Succeeded\",\"startTime\":\"2023-11-07T02:40:45.8814868Z\",\"endTime\":\"2023-11-07T02:41:53.6135499Z\",\"error\":{},\"properties\":null}" + } + }, + "AzStackHCIVmStoragePath+[NoContext]+Create Storage Path +$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/storageContainers/teststoragepath1106?api-version=2023-09-01-preview+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/storageContainers/teststoragepath1106?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "54" ], + "x-ms-client-request-id": [ "c53a4b70-b86d-4d64-ac0c-d2bab1fa9ef5" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmStoragePath" ], + "FullCommandName": [ "New-AzStackHCIVmStoragePath_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"870248bf-0000-0100-0000-6549a3f20000\"" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11875" ], + "x-ms-providerhub-traffic": [ "True" ], + "x-ms-request-id": [ "a06b7f79-9a72-41ce-8f07-0bbf75b6363d" ], + "x-ms-correlation-request-id": [ "1389ecb9-9d59-46e0-b36a-22e942b8a287" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T024217Z:1389ecb9-9d59-46e0-b36a-22e942b8a287" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 1EA5CF21B7DD4358912168F6EC50C4DC Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:42:17Z" ], + "Date": [ "Tue, 07 Nov 2023 02:42:16 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "896" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/storageContainers/teststoragepath1106\",\"name\":\"teststoragepath1106\",\"type\":\"microsoft.azurestackhci/storagecontainers\",\"location\":\"eastus\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T02:40:45.8111178Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-07T02:41:54.5294944Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"path\":\"C:\\\\\\\\ClusterStorage\\\\\\\\Volume1\\\\\\\\testPath1106\",\"status\":{\"availableSizeMB\":515788,\"containerSizeMB\":1048576}}}" + } + }, + "AzStackHCIVmStoragePath+[NoContext]+List+$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/storageContainers?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/storageContainers?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "55" ], + "x-ms-client-request-id": [ "f98fa341-f351-4015-8606-c4a2b4388e31" ], + "CommandName": [ "Get-AzStackHCIVMStoragePath" ], + "FullCommandName": [ "Get-AzStackHCIVmStoragePath_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-original-request-ids": [ "64308f2b-e6ac-4b63-953e-d2d77e51fc99", "cecc421f-a235-4351-b7b6-8feee76383e5", "3e1a27c1-10fd-446e-82de-cc3a0c45b5ec", "46a13786-306c-455a-8cba-bc1adba7d6a9", "76d5601e-e1da-41b3-b42c-196ff361059b", "c10b438b-a1b1-45f3-95a4-d97e444bce00", "9160ec2a-efe0-4feb-81e3-9d1a237e7f14", "cd2d4463-533b-4d46-88f6-73066c724984", "d777bdc8-a429-4e5c-8cba-4af2fac3b081", "ead203c9-8f28-4f1f-bbe3-319a32ac9e04" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "76d686cc-5604-4bd2-aa5e-8fa4bedc45c0" ], + "x-ms-correlation-request-id": [ "76d686cc-5604-4bd2-aa5e-8fa4bedc45c0" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T024218Z:76d686cc-5604-4bd2-aa5e-8fa4bedc45c0" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 4E06D71C3DDA413D9657FA62AB1CBB8D Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:42:17Z" ], + "Date": [ "Tue, 07 Nov 2023 02:42:17 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1784" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/storageContainers/teststoragepath1106\",\"name\":\"teststoragepath1106\",\"type\":\"microsoft.azurestackhci/storagecontainers\",\"location\":\"eastus\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T02:40:45.8111178Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-07T02:41:54.5294944Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"path\":\"C:\\\\\\\\ClusterStorage\\\\\\\\Volume1\\\\\\\\testPath1106\",\"status\":{\"availableSizeMB\":515788,\"containerSizeMB\":1048576}}},{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/storageContainers/bugbashtoragepath\",\"name\":\"bugbashtoragepath\",\"type\":\"microsoft.azurestackhci/storagecontainers\",\"location\":\"eastus2euap\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"altayl@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-01T18:17:29.8416309Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-07T02:34:37.6736324Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"path\":\"C:\\\\ClusterStorage\\\\Volume1\",\"status\":{\"availableSizeMB\":501145,\"containerSizeMB\":1048576}}}]}" + } + }, + "AzStackHCIVmStoragePath+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/storageContainers/teststoragepath1106?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/storageContainers/teststoragepath1106?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "56" ], + "x-ms-client-request-id": [ "775bcfec-02b6-4158-94a1-e726085e242b" ], + "CommandName": [ "Get-AzStackHCIVMStoragePath" ], + "FullCommandName": [ "Get-AzStackHCIVmStoragePath_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"870248bf-0000-0100-0000-6549a3f20000\"" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11977" ], + "x-ms-providerhub-traffic": [ "True" ], + "x-ms-request-id": [ "b638fe45-3124-4877-885e-e2b430bc8df4" ], + "x-ms-correlation-request-id": [ "19418123-d043-410b-8f0f-662cfa2d5e03" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T024218Z:19418123-d043-410b-8f0f-662cfa2d5e03" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 5A380661C65C4A53838BE7D9615D7D8C Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:42:18Z" ], + "Date": [ "Tue, 07 Nov 2023 02:42:17 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "896" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/storageContainers/teststoragepath1106\",\"name\":\"teststoragepath1106\",\"type\":\"microsoft.azurestackhci/storagecontainers\",\"location\":\"eastus\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T02:40:45.8111178Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-07T02:41:54.5294944Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"path\":\"C:\\\\\\\\ClusterStorage\\\\\\\\Volume1\\\\\\\\testPath1106\",\"status\":{\"availableSizeMB\":515788,\"containerSizeMB\":1048576}}}" + } + }, + "AzStackHCIVmStoragePath+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/storageContainers/teststoragepath1106?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/storageContainers/teststoragepath1106?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "57" ], + "x-ms-client-request-id": [ "6c76c2ab-5084-4d46-b45a-a998f297dcec" ], + "CommandName": [ "Az.StackHCIVm.internal\\Remove-AzStackHCIVmStoragePath" ], + "FullCommandName": [ "Remove-AzStackHCIVmStoragePath_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"87022bc3-0000-0100-0000-6549a40b0000\"" ], + "Location": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/8df44431-c2bb-4c77-a827-8b6622b21ef9*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4?api-version=2023-09-01-preview\u0026t=638349217397026647\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=hravrC4cabyEeiQw_c4EprzFggd1P4TsCKcNBxqa1ZAdK9E9fwv0WztvVVIeXtIxGgCCuoNU8hVf6KTxSv2zjsx8qGfbexBSbb1lZGEsl-yCfxj1PXNk-vIciH-vV6N7AW7jfOEBatIQlYW_mamaTNLD0ZyIyc8glScZT1ruKMpAkRbGwI4Z-ihk_8VyyfYvFR3NE6Xdz0vo3yskCZzzutS5k8D34m6RqmvhhXFA_EK6-drk7U46gzNgs_ktuKk9HH441AShVDWfdfkUPLhtOfl_rVZLEcTUJkMZkSMWrzO3OWxt9aCCK80sCL-ou1pZnZE3ZktWt-kghYvGTCSFxQ\u0026h=JTBSyYj-WNaozRThyzbOFM8KuK0Dw-QJrnz5KtbfpJo" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14999" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T024219Z:7c354d50-d302-429c-b3ca-c3214fdd548d" ], + "x-ms-providerhub-traffic": [ "True" ], + "mise-correlation-id": [ "cd374493-adf2-4b83-9268-4b7a95571836" ], + "x-ms-request-id": [ "00000000-0000-0000-0000-000000000000" ], + "Azure-AsyncOperation": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/8df44431-c2bb-4c77-a827-8b6622b21ef9*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4?api-version=2023-09-01-preview\u0026t=638349217396870389\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=PetIbkHrMlgLZYB6irSk2gRQWQXFxs9xr0vm0A1i7ZdTsuoiHpglvgCjloSJeNni77gt4q-aCtSsQzxZGbHMiebkjEbnFSYHJGXEJik22i8kefPJqUcJUObu9eXIu3gNXiwHot6ATwRjRod-FsgQZk-6hIXPhNrh_BoR0yTnZPCH9utgdfTyjulvxQYn1WT-R1NoEtVg7hBm5JtIWpWC5io7zGNKRohvKudFdZjAH5LsIQKlnuLbDOQ6XoHLFDEH9h4X1Isw66Byb7LY2TYR3VwEd7dH4iJD_EB4hH2OZSVI5ttte_LBJeBSE9rg-Vz-LuOeuX8IZSLKJ2st4TpYGQ\u0026h=WwTR8YpnLtDctpIesBA4_hUxkv036VMMSxAE3Pt7XHg" ], + "x-ms-correlation-request-id": [ "7c354d50-d302-429c-b3ca-c3214fdd548d" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: F08D6F14ED27445B851E33602AED3D80 Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:42:18Z" ], + "Date": [ "Tue, 07 Nov 2023 02:42:18 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "4" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "bnVsbA==" + } + }, + "AzStackHCIVmStoragePath+[NoContext]+Delete+$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/8df44431-c2bb-4c77-a827-8b6622b21ef9*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4?api-version=2023-09-01-preview\u0026t=638349217396870389\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=PetIbkHrMlgLZYB6irSk2gRQWQXFxs9xr0vm0A1i7ZdTsuoiHpglvgCjloSJeNni77gt4q-aCtSsQzxZGbHMiebkjEbnFSYHJGXEJik22i8kefPJqUcJUObu9eXIu3gNXiwHot6ATwRjRod-FsgQZk-6hIXPhNrh_BoR0yTnZPCH9utgdfTyjulvxQYn1WT-R1NoEtVg7hBm5JtIWpWC5io7zGNKRohvKudFdZjAH5LsIQKlnuLbDOQ6XoHLFDEH9h4X1Isw66Byb7LY2TYR3VwEd7dH4iJD_EB4hH2OZSVI5ttte_LBJeBSE9rg-Vz-LuOeuX8IZSLKJ2st4TpYGQ\u0026h=WwTR8YpnLtDctpIesBA4_hUxkv036VMMSxAE3Pt7XHg+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/8df44431-c2bb-4c77-a827-8b6622b21ef9*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4?api-version=2023-09-01-preview\u0026t=638349217396870389\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=PetIbkHrMlgLZYB6irSk2gRQWQXFxs9xr0vm0A1i7ZdTsuoiHpglvgCjloSJeNni77gt4q-aCtSsQzxZGbHMiebkjEbnFSYHJGXEJik22i8kefPJqUcJUObu9eXIu3gNXiwHot6ATwRjRod-FsgQZk-6hIXPhNrh_BoR0yTnZPCH9utgdfTyjulvxQYn1WT-R1NoEtVg7hBm5JtIWpWC5io7zGNKRohvKudFdZjAH5LsIQKlnuLbDOQ6XoHLFDEH9h4X1Isw66Byb7LY2TYR3VwEd7dH4iJD_EB4hH2OZSVI5ttte_LBJeBSE9rg-Vz-LuOeuX8IZSLKJ2st4TpYGQ\u0026h=WwTR8YpnLtDctpIesBA4_hUxkv036VMMSxAE3Pt7XHg", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "58" ], + "x-ms-client-request-id": [ "6c76c2ab-5084-4d46-b45a-a998f297dcec" ], + "CommandName": [ "Az.StackHCIVm.internal\\Remove-AzStackHCIVmStoragePath" ], + "FullCommandName": [ "Remove-AzStackHCIVmStoragePath_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"870217fa-0000-0100-0000-6549a4110000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "cf14c064-beeb-4858-8d97-ada2e26e86d1" ], + "x-ms-correlation-request-id": [ "cbaa5590-d3e0-462f-b223-e58e1f36242f" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T024249Z:cbaa5590-d3e0-462f-b223-e58e1f36242f" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 78CF12395F2C47918E1C31F77CD660A6 Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:42:49Z" ], + "Date": [ "Tue, 07 Nov 2023 02:42:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "584" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/8df44431-c2bb-4c77-a827-8b6622b21ef9*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4\",\"name\":\"8df44431-c2bb-4c77-a827-8b6622b21ef9*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/storageContainers/teststoragepath1106\",\"status\":\"Succeeded\",\"startTime\":\"2023-11-07T02:42:19.2899734Z\",\"endTime\":\"2023-11-07T02:42:25.3061495Z\",\"properties\":null}" + } + }, + "AzStackHCIVmStoragePath+[NoContext]+Delete+$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/8df44431-c2bb-4c77-a827-8b6622b21ef9*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4?api-version=2023-09-01-preview\u0026t=638349217396870389\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=PetIbkHrMlgLZYB6irSk2gRQWQXFxs9xr0vm0A1i7ZdTsuoiHpglvgCjloSJeNni77gt4q-aCtSsQzxZGbHMiebkjEbnFSYHJGXEJik22i8kefPJqUcJUObu9eXIu3gNXiwHot6ATwRjRod-FsgQZk-6hIXPhNrh_BoR0yTnZPCH9utgdfTyjulvxQYn1WT-R1NoEtVg7hBm5JtIWpWC5io7zGNKRohvKudFdZjAH5LsIQKlnuLbDOQ6XoHLFDEH9h4X1Isw66Byb7LY2TYR3VwEd7dH4iJD_EB4hH2OZSVI5ttte_LBJeBSE9rg-Vz-LuOeuX8IZSLKJ2st4TpYGQ\u0026h=WwTR8YpnLtDctpIesBA4_hUxkv036VMMSxAE3Pt7XHg+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/8df44431-c2bb-4c77-a827-8b6622b21ef9*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4?api-version=2023-09-01-preview\u0026t=638349217396870389\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=PetIbkHrMlgLZYB6irSk2gRQWQXFxs9xr0vm0A1i7ZdTsuoiHpglvgCjloSJeNni77gt4q-aCtSsQzxZGbHMiebkjEbnFSYHJGXEJik22i8kefPJqUcJUObu9eXIu3gNXiwHot6ATwRjRod-FsgQZk-6hIXPhNrh_BoR0yTnZPCH9utgdfTyjulvxQYn1WT-R1NoEtVg7hBm5JtIWpWC5io7zGNKRohvKudFdZjAH5LsIQKlnuLbDOQ6XoHLFDEH9h4X1Isw66Byb7LY2TYR3VwEd7dH4iJD_EB4hH2OZSVI5ttte_LBJeBSE9rg-Vz-LuOeuX8IZSLKJ2st4TpYGQ\u0026h=WwTR8YpnLtDctpIesBA4_hUxkv036VMMSxAE3Pt7XHg", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "59" ], + "x-ms-client-request-id": [ "6c76c2ab-5084-4d46-b45a-a998f297dcec" ], + "CommandName": [ "Az.StackHCIVm.internal\\Remove-AzStackHCIVmStoragePath" ], + "FullCommandName": [ "Remove-AzStackHCIVmStoragePath_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"870217fa-0000-0100-0000-6549a4110000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11998" ], + "x-ms-request-id": [ "70c32a33-dc81-45af-80d3-779211be9dc8" ], + "x-ms-correlation-request-id": [ "02f62284-4093-43bf-b0ee-0a99502d3312" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T024249Z:02f62284-4093-43bf-b0ee-0a99502d3312" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: D3ED7871994A43B5AB84B51F2D8FA292 Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:42:49Z" ], + "Date": [ "Tue, 07 Nov 2023 02:42:49 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "584" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/8df44431-c2bb-4c77-a827-8b6622b21ef9*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4\",\"name\":\"8df44431-c2bb-4c77-a827-8b6622b21ef9*250B765E4686985F451173DC4F3E997E814EF5C50A640F6BC6D568826924F3A4\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/storageContainers/teststoragepath1106\",\"status\":\"Succeeded\",\"startTime\":\"2023-11-07T02:42:19.2899734Z\",\"endTime\":\"2023-11-07T02:42:25.3061495Z\",\"properties\":null}" + } + }, + "AzStackHCIVmStoragePath+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/storageContainers/teststoragepath1106?api-version=2023-09-01-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/storageContainers/teststoragepath1106?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "60" ], + "x-ms-client-request-id": [ "66d69019-0072-4f15-bcef-b7e301186b1f" ], + "CommandName": [ "Get-AzStackHCIVMStoragePath" ], + "FullCommandName": [ "Get-AzStackHCIVmStoragePath_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 404, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-failure-cause": [ "gateway" ], + "x-ms-request-id": [ "e04f46b8-8cd3-4750-8402-1537efdf17ba" ], + "x-ms-correlation-request-id": [ "e04f46b8-8cd3-4750-8402-1537efdf17ba" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T024250Z:e04f46b8-8cd3-4750-8402-1537efdf17ba" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: A1E46E4AAA954B86A5AC1E272A62C7D7 Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:42:50Z" ], + "Date": [ "Tue, 07 Nov 2023 02:42:49 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "248" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"error\":{\"code\":\"ResourceNotFound\",\"message\":\"The Resource \u0027Microsoft.AzureStackHCI/storageContainers/teststoragepath1106\u0027 under resource group \u0027AltaylSnClus-rg\u0027 was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix\"}}" + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmVirtualHardDisks.Recording.json b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmVirtualHardDisks.Recording.json new file mode 100644 index 000000000000..e754ca8a4ae8 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmVirtualHardDisks.Recording.json @@ -0,0 +1,329 @@ +{ + "AzStackHCIVmVirtualHardDisks+[NoContext]+Create+$PUT+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/virtualHardDisks/testVhd1106?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/virtualHardDisks/testVhd1106?api-version=2023-09-01-preview", + "Content": "{\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"diskSizeGB\": 2\r\n },\r\n \"extendedLocation\": {\r\n \"name\": \"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\r\n \"type\": \"CustomLocation\"\r\n }\r\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "307" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"c700cfea-0000-0100-0000-6549a42b0000\"" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "x-ms-providerhub-traffic": [ "True" ], + "mise-correlation-id": [ "33976ac9-eb0b-4cc2-a6bd-e5eac8f6e2b5" ], + "x-ms-request-id": [ "44eb6c7d-81bc-44ca-bea1-3bdb09d30f84" ], + "x-ms-correlation-request-id": [ "647fa2c5-d6d3-40f4-bf77-9b18adfdb74c" ], + "Azure-AsyncOperation": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/5b3e5b97-49ff-4ab0-aeb1-b1606efa705e*858E99D61C8792A16BCCC3A502ED0F2F9E316C198DC38C7038AB85E35036F095?api-version=2023-09-01-preview\u0026t=638349217718506527\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=VBttbnguz-kenxvFlX1p_bvatPYWUW_GVUa0CV4oChJKowVxuOA3Wn7VUt6aLYgjMiD3h0Ux09e2dpsn6-ScyyK3z52eYyizTgLKq2GfrdPorL33T0U4IsllKYJ9eOTSqigV_Z0u3mPZeORjexIkjHH6vscLuFWy0hjhpnT6bbe8rZnyvBf20LRWBowq1fDbziBt3z1v7bflMtnA1HfaHCoM2G5S_HvX9Hslhsd7PmwISdGQ-0OZj2QlAgf4XeCR5GqAnLE7cGkuVFDM6G7N2fTPN5UpJB6xQKnc3s2t_oqtvcUWkfYgX1LCK-58uAGiwX3KtcYPOYLMIINLldvryg\u0026h=yzIFRMzX_2AweM4T1zqamwcqMq8N_q4gFTT813i6Im4" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T024251Z:647fa2c5-d6d3-40f4-bf77-9b18adfdb74c" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 07BBB33F1FF147A487A09E1D41174299 Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:42:50Z" ], + "Date": [ "Tue, 07 Nov 2023 02:42:50 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "752" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/virtualHardDisks/testVhd1106\",\"name\":\"testVhd1106\",\"type\":\"microsoft.azurestackhci/virtualharddisks\",\"location\":\"eastus\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T02:42:51.2100535Z\",\"lastModifiedBy\":\"havedati@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-11-07T02:42:51.2100535Z\"},\"properties\":{\"provisioningState\":\"Accepted\",\"diskSizeGB\":2}}" + } + }, + "AzStackHCIVmVirtualHardDisks+[NoContext]+Create+$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/5b3e5b97-49ff-4ab0-aeb1-b1606efa705e*858E99D61C8792A16BCCC3A502ED0F2F9E316C198DC38C7038AB85E35036F095?api-version=2023-09-01-preview\u0026t=638349217718506527\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=VBttbnguz-kenxvFlX1p_bvatPYWUW_GVUa0CV4oChJKowVxuOA3Wn7VUt6aLYgjMiD3h0Ux09e2dpsn6-ScyyK3z52eYyizTgLKq2GfrdPorL33T0U4IsllKYJ9eOTSqigV_Z0u3mPZeORjexIkjHH6vscLuFWy0hjhpnT6bbe8rZnyvBf20LRWBowq1fDbziBt3z1v7bflMtnA1HfaHCoM2G5S_HvX9Hslhsd7PmwISdGQ-0OZj2QlAgf4XeCR5GqAnLE7cGkuVFDM6G7N2fTPN5UpJB6xQKnc3s2t_oqtvcUWkfYgX1LCK-58uAGiwX3KtcYPOYLMIINLldvryg\u0026h=yzIFRMzX_2AweM4T1zqamwcqMq8N_q4gFTT813i6Im4+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/5b3e5b97-49ff-4ab0-aeb1-b1606efa705e*858E99D61C8792A16BCCC3A502ED0F2F9E316C198DC38C7038AB85E35036F095?api-version=2023-09-01-preview\u0026t=638349217718506527\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=VBttbnguz-kenxvFlX1p_bvatPYWUW_GVUa0CV4oChJKowVxuOA3Wn7VUt6aLYgjMiD3h0Ux09e2dpsn6-ScyyK3z52eYyizTgLKq2GfrdPorL33T0U4IsllKYJ9eOTSqigV_Z0u3mPZeORjexIkjHH6vscLuFWy0hjhpnT6bbe8rZnyvBf20LRWBowq1fDbziBt3z1v7bflMtnA1HfaHCoM2G5S_HvX9Hslhsd7PmwISdGQ-0OZj2QlAgf4XeCR5GqAnLE7cGkuVFDM6G7N2fTPN5UpJB6xQKnc3s2t_oqtvcUWkfYgX1LCK-58uAGiwX3KtcYPOYLMIINLldvryg\u0026h=yzIFRMzX_2AweM4T1zqamwcqMq8N_q4gFTT813i6Im4", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "62" ], + "x-ms-client-request-id": [ "4d1f2968-b9f9-4a57-8a66-b1fa2e508865" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmVirtualHardDisk" ], + "FullCommandName": [ "New-AzStackHCIVmVirtualHardDisk_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"870290ff-0000-0100-0000-6549a4300000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "4b590fbd-6553-49b3-adc0-3a3fe974ef75" ], + "x-ms-correlation-request-id": [ "210a1ffd-29b6-4f58-9375-483c0ece91bb" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T024322Z:210a1ffd-29b6-4f58-9375-483c0ece91bb" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 2EADC74416D3476AA20A710BAE92FABA Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:43:21Z" ], + "Date": [ "Tue, 07 Nov 2023 02:43:21 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "515" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/5b3e5b97-49ff-4ab0-aeb1-b1606efa705e*858E99D61C8792A16BCCC3A502ED0F2F9E316C198DC38C7038AB85E35036F095\",\"name\":\"5b3e5b97-49ff-4ab0-aeb1-b1606efa705e*858E99D61C8792A16BCCC3A502ED0F2F9E316C198DC38C7038AB85E35036F095\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/virtualHardDisks/testVhd1106\",\"status\":\"Accepted\",\"startTime\":\"2023-11-07T02:42:51.3352895Z\"}" + } + }, + "AzStackHCIVmVirtualHardDisks+[NoContext]+Create+$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/5b3e5b97-49ff-4ab0-aeb1-b1606efa705e*858E99D61C8792A16BCCC3A502ED0F2F9E316C198DC38C7038AB85E35036F095?api-version=2023-09-01-preview\u0026t=638349217718506527\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=VBttbnguz-kenxvFlX1p_bvatPYWUW_GVUa0CV4oChJKowVxuOA3Wn7VUt6aLYgjMiD3h0Ux09e2dpsn6-ScyyK3z52eYyizTgLKq2GfrdPorL33T0U4IsllKYJ9eOTSqigV_Z0u3mPZeORjexIkjHH6vscLuFWy0hjhpnT6bbe8rZnyvBf20LRWBowq1fDbziBt3z1v7bflMtnA1HfaHCoM2G5S_HvX9Hslhsd7PmwISdGQ-0OZj2QlAgf4XeCR5GqAnLE7cGkuVFDM6G7N2fTPN5UpJB6xQKnc3s2t_oqtvcUWkfYgX1LCK-58uAGiwX3KtcYPOYLMIINLldvryg\u0026h=yzIFRMzX_2AweM4T1zqamwcqMq8N_q4gFTT813i6Im4+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/5b3e5b97-49ff-4ab0-aeb1-b1606efa705e*858E99D61C8792A16BCCC3A502ED0F2F9E316C198DC38C7038AB85E35036F095?api-version=2023-09-01-preview\u0026t=638349217718506527\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=VBttbnguz-kenxvFlX1p_bvatPYWUW_GVUa0CV4oChJKowVxuOA3Wn7VUt6aLYgjMiD3h0Ux09e2dpsn6-ScyyK3z52eYyizTgLKq2GfrdPorL33T0U4IsllKYJ9eOTSqigV_Z0u3mPZeORjexIkjHH6vscLuFWy0hjhpnT6bbe8rZnyvBf20LRWBowq1fDbziBt3z1v7bflMtnA1HfaHCoM2G5S_HvX9Hslhsd7PmwISdGQ-0OZj2QlAgf4XeCR5GqAnLE7cGkuVFDM6G7N2fTPN5UpJB6xQKnc3s2t_oqtvcUWkfYgX1LCK-58uAGiwX3KtcYPOYLMIINLldvryg\u0026h=yzIFRMzX_2AweM4T1zqamwcqMq8N_q4gFTT813i6Im4", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "63" ], + "x-ms-client-request-id": [ "4d1f2968-b9f9-4a57-8a66-b1fa2e508865" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmVirtualHardDisk" ], + "FullCommandName": [ "New-AzStackHCIVmVirtualHardDisk_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"870290ff-0000-0100-0000-6549a4300000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "9effc01a-b182-480c-b544-dd9a6773d76a" ], + "x-ms-correlation-request-id": [ "be548825-e470-4e01-88d5-be50cd379e11" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T024352Z:be548825-e470-4e01-88d5-be50cd379e11" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 2B1CE32A846E420089692908472E6CEE Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:43:52Z" ], + "Date": [ "Tue, 07 Nov 2023 02:43:52 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "515" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/5b3e5b97-49ff-4ab0-aeb1-b1606efa705e*858E99D61C8792A16BCCC3A502ED0F2F9E316C198DC38C7038AB85E35036F095\",\"name\":\"5b3e5b97-49ff-4ab0-aeb1-b1606efa705e*858E99D61C8792A16BCCC3A502ED0F2F9E316C198DC38C7038AB85E35036F095\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/virtualHardDisks/testVhd1106\",\"status\":\"Accepted\",\"startTime\":\"2023-11-07T02:42:51.3352895Z\"}" + } + }, + "AzStackHCIVmVirtualHardDisks+[NoContext]+Create+$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/5b3e5b97-49ff-4ab0-aeb1-b1606efa705e*858E99D61C8792A16BCCC3A502ED0F2F9E316C198DC38C7038AB85E35036F095?api-version=2023-09-01-preview\u0026t=638349217718506527\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=VBttbnguz-kenxvFlX1p_bvatPYWUW_GVUa0CV4oChJKowVxuOA3Wn7VUt6aLYgjMiD3h0Ux09e2dpsn6-ScyyK3z52eYyizTgLKq2GfrdPorL33T0U4IsllKYJ9eOTSqigV_Z0u3mPZeORjexIkjHH6vscLuFWy0hjhpnT6bbe8rZnyvBf20LRWBowq1fDbziBt3z1v7bflMtnA1HfaHCoM2G5S_HvX9Hslhsd7PmwISdGQ-0OZj2QlAgf4XeCR5GqAnLE7cGkuVFDM6G7N2fTPN5UpJB6xQKnc3s2t_oqtvcUWkfYgX1LCK-58uAGiwX3KtcYPOYLMIINLldvryg\u0026h=yzIFRMzX_2AweM4T1zqamwcqMq8N_q4gFTT813i6Im4+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/5b3e5b97-49ff-4ab0-aeb1-b1606efa705e*858E99D61C8792A16BCCC3A502ED0F2F9E316C198DC38C7038AB85E35036F095?api-version=2023-09-01-preview\u0026t=638349217718506527\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=VBttbnguz-kenxvFlX1p_bvatPYWUW_GVUa0CV4oChJKowVxuOA3Wn7VUt6aLYgjMiD3h0Ux09e2dpsn6-ScyyK3z52eYyizTgLKq2GfrdPorL33T0U4IsllKYJ9eOTSqigV_Z0u3mPZeORjexIkjHH6vscLuFWy0hjhpnT6bbe8rZnyvBf20LRWBowq1fDbziBt3z1v7bflMtnA1HfaHCoM2G5S_HvX9Hslhsd7PmwISdGQ-0OZj2QlAgf4XeCR5GqAnLE7cGkuVFDM6G7N2fTPN5UpJB6xQKnc3s2t_oqtvcUWkfYgX1LCK-58uAGiwX3KtcYPOYLMIINLldvryg\u0026h=yzIFRMzX_2AweM4T1zqamwcqMq8N_q4gFTT813i6Im4", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "64" ], + "x-ms-client-request-id": [ "4d1f2968-b9f9-4a57-8a66-b1fa2e508865" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmVirtualHardDisk" ], + "FullCommandName": [ "New-AzStackHCIVmVirtualHardDisk_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8802b609-0000-0100-0000-6549a46e0000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "8f0a1d97-d2e9-4ecb-b437-5b38f74e48ca" ], + "x-ms-correlation-request-id": [ "5d58ca5a-de66-4303-b72f-45589e488f53" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T024422Z:5d58ca5a-de66-4303-b72f-45589e488f53" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 6FCC0735EE524BDE90AC35D814C46E1B Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:44:22Z" ], + "Date": [ "Tue, 07 Nov 2023 02:44:22 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "586" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/5b3e5b97-49ff-4ab0-aeb1-b1606efa705e*858E99D61C8792A16BCCC3A502ED0F2F9E316C198DC38C7038AB85E35036F095\",\"name\":\"5b3e5b97-49ff-4ab0-aeb1-b1606efa705e*858E99D61C8792A16BCCC3A502ED0F2F9E316C198DC38C7038AB85E35036F095\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/virtualHardDisks/testVhd1106\",\"status\":\"Succeeded\",\"startTime\":\"2023-11-07T02:42:51.3352895Z\",\"endTime\":\"2023-11-07T02:43:58.6737633Z\",\"error\":{},\"properties\":null}" + } + }, + "AzStackHCIVmVirtualHardDisks+[NoContext]+Create+$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/virtualHardDisks/testVhd1106?api-version=2023-09-01-preview+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/virtualHardDisks/testVhd1106?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "65" ], + "x-ms-client-request-id": [ "4d1f2968-b9f9-4a57-8a66-b1fa2e508865" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmVirtualHardDisk" ], + "FullCommandName": [ "New-AzStackHCIVmVirtualHardDisk_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"c700ecf1-0000-0100-0000-6549a46f0000\"" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11983" ], + "x-ms-providerhub-traffic": [ "True" ], + "x-ms-request-id": [ "933c921a-ba41-40d9-b55c-a9d21ed832c4" ], + "x-ms-correlation-request-id": [ "778bb7a7-e07d-430c-8588-5c91d34c83b9" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T024422Z:778bb7a7-e07d-430c-8588-5c91d34c83b9" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: BECDC6008F1F424D970EB25448FB83AC Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:44:22Z" ], + "Date": [ "Tue, 07 Nov 2023 02:44:22 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "786" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/virtualHardDisks/testVhd1106\",\"name\":\"testVhd1106\",\"type\":\"microsoft.azurestackhci/virtualharddisks\",\"location\":\"eastus\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T02:42:51.2100535Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-07T02:43:59.4464225Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"status\":{},\"diskSizeGB\":2}}" + } + }, + "AzStackHCIVmVirtualHardDisks+[NoContext]+List+$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/virtualHardDisks?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/virtualHardDisks?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "66" ], + "x-ms-client-request-id": [ "da3ca64d-f665-43f5-90fa-fa2d4d9db112" ], + "CommandName": [ "Get-AzStackHCIVMVirtualHardDisk" ], + "FullCommandName": [ "Get-AzStackHCIVmVirtualHardDisk_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-original-request-ids": [ "e7aed54f-9010-4ae2-9783-4356b8e486eb", "9d225690-9f53-4f38-9e27-a7d061eff29d", "35a62154-445e-4975-b292-6d491f00ab18", "5f4603fc-83c3-4cb3-a32d-dc33beb62adc", "ee41dd80-707a-402f-a4f5-6061164cfa44", "90634114-2a12-4e75-a9f4-b76ae74a11a1", "917c67b8-1624-4c18-9a51-f6d0d6110afb", "88b75bb2-84f9-4ef4-a083-10d2e83b2a02", "07213e7a-9a43-4c33-b017-44918e3bf651", "51c01207-3f8f-48ad-992d-7540c398bb36" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "96938cfa-eb9f-4a96-b16f-a9cfecd65ef6" ], + "x-ms-correlation-request-id": [ "96938cfa-eb9f-4a96-b16f-a9cfecd65ef6" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T024424Z:96938cfa-eb9f-4a96-b16f-a9cfecd65ef6" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 88A54EF838564196ADBB6290B496C316 Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:44:22Z" ], + "Date": [ "Tue, 07 Nov 2023 02:44:24 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "798" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/virtualHardDisks/testVhd1106\",\"name\":\"testVhd1106\",\"type\":\"microsoft.azurestackhci/virtualharddisks\",\"location\":\"eastus\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T02:42:51.2100535Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-07T02:43:59.4464225Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"status\":{},\"diskSizeGB\":2}}]}" + } + }, + "AzStackHCIVmVirtualHardDisks+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/virtualHardDisks/testVhd1106?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/virtualHardDisks/testVhd1106?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "67" ], + "x-ms-client-request-id": [ "2e188567-8cab-405c-8f4a-63c7d5c6bd28" ], + "CommandName": [ "Get-AzStackHCIVMVirtualHardDisk" ], + "FullCommandName": [ "Get-AzStackHCIVmVirtualHardDisk_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"c700ecf1-0000-0100-0000-6549a46f0000\"" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-providerhub-traffic": [ "True" ], + "x-ms-request-id": [ "55c265a1-6cb8-4a01-995e-5f3fc5a49643" ], + "x-ms-correlation-request-id": [ "47433d1b-06b2-4547-a091-52a0d41cd59a" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T024424Z:47433d1b-06b2-4547-a091-52a0d41cd59a" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 6FDA72371142413698501B49E5121F7F Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:44:24Z" ], + "Date": [ "Tue, 07 Nov 2023 02:44:24 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "786" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/virtualHardDisks/testVhd1106\",\"name\":\"testVhd1106\",\"type\":\"microsoft.azurestackhci/virtualharddisks\",\"location\":\"eastus\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T02:42:51.2100535Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-07T02:43:59.4464225Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"status\":{},\"diskSizeGB\":2}}" + } + }, + "AzStackHCIVmVirtualHardDisks+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/virtualHardDisks/testVhd1106?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/virtualHardDisks/testVhd1106?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "71" ], + "x-ms-client-request-id": [ "7afc0ca9-a8fb-4474-8a43-6620939974c9" ], + "CommandName": [ "Get-AzStackHCIVMVirtualHardDisk" ], + "FullCommandName": [ "Get-AzStackHCIVmVirtualHardDisk_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 404, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-failure-cause": [ "gateway" ], + "x-ms-request-id": [ "ab4385cc-853d-4c2b-8954-33c1097de026" ], + "x-ms-correlation-request-id": [ "ab4385cc-853d-4c2b-8954-33c1097de026" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T024455Z:ab4385cc-853d-4c2b-8954-33c1097de026" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 0A182551F76445BCB93A52A8E2AE862B Ref B: CO6AA3150217023 Ref C: 2023-11-07T02:44:55Z" ], + "Date": [ "Tue, 07 Nov 2023 02:44:55 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "239" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"error\":{\"code\":\"ResourceNotFound\",\"message\":\"The Resource \u0027Microsoft.AzureStackHCI/virtualHardDisks/testVhd1106\u0027 under resource group \u0027AltaylSnClus-rg\u0027 was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix\"}}" + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmVirtualHardDisks.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmVirtualHardDisks.Tests.ps1 new file mode 100644 index 000000000000..6b40e7ad87f4 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmVirtualHardDisks.Tests.ps1 @@ -0,0 +1,46 @@ +if(($null -eq $TestName) -or ($TestName -contains 'AzStackHCIVmVirtualHardDisks')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'AzStackHCIVmVirtualHardDisks.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'AzStackHCIVmVirtualHardDisks' { + It 'Create' { + New-AzStackHCIVMVirtualHardDisk -Name $env.vhdName -SubscriptionId $env.SubscriptionId -ResourceGroupName $env.resourceGroupName -CustomLocationId $env.customLocationId -Location $env.location -SizeGb $env.sizeGb | Select-Object -Property ProvisioningState | Should -BeExactly "@{ProvisioningState=Succeeded}" + } + + It 'List' { + { + $config = Get-AzStackHCIVMVirtualHardDisk -ResourceGroupName $env.resourceGroupName + $config.Count | Should -BeGreaterThan 0 + } | Should -Not -Throw + } + + It 'Get' { + { + $config = Get-AzStackHCIVMVirtualHardDisk -Name $env.vhdName -ResourceGroupName $env.resourceGroupName + $config.Name | Should -Be $env.vhdName + } | Should -Not -Throw + } + + + It 'Delete'{ + { + Remove-AzStackHCIVMVirtualHardDisk -Name $env.vhdName -ResourceGroupName $env.resourceGroupName -Force + $config = Get-AzStackHCIVMVirtualHardDisk -Name $env.vhdName -ResourceGroupName $env.resourceGroupName + $config | Should -Be $null + + } | Should -Throw + } + +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmVirtualMachine.Recording.json b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmVirtualMachine.Recording.json new file mode 100644 index 000000000000..f643e3d6bf67 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHCIVmVirtualMachine.Recording.json @@ -0,0 +1,1040 @@ +{ + "AzStackHCIVmVirtualMachine+[NoContext]+Create Virtual Machine +$PUT+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2?api-version=2023-03-15-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2?api-version=2023-03-15-preview", + "Content": "{\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"osType\": \"Linux\"\r\n },\r\n \"identity\": {\r\n \"type\": \"SystemAssigned\"\r\n },\r\n \"kind\": \"HCI\"\r\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "147" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ "319" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-request-id": [ "cc76789d-b1f4-437b-b9bd-5048a273d1ce" ], + "x-ms-correlation-request-id": [ "804f2067-2a3e-49f1-823f-892023d5f0b6" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T053646Z:804f2067-2a3e-49f1-823f-892023d5f0b6" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: EF0037EA10964253AFD726B3C2630DED Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:36:44Z" ], + "Date": [ "Tue, 07 Nov 2023 05:36:46 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "582" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2\",\"name\":\"manualvmtest2\",\"location\":\"eastus\",\"kind\":\"HCI\",\"identity\":{\"type\":\"SystemAssigned\",\"principalId\":\"29a34a3e-a6ec-470e-b9ce-b0616fe65b23\",\"tenantId\":\"72f988bf-86f1-41af-91ab-2d7cd011db47\"},\"type\":\"Microsoft.HybridCompute/machines\",\"properties\":{\"provisioningState\":\"Creating\",\"osType\":\"Linux\",\"osProfile\":{},\"vmId\":\"e90d74b0-6c59-4aa4-b834-fa9bb4e91bae\",\"agentConfiguration\":{},\"agentUpgrade\":{\"enableAutomaticUpgrade\":false}}}" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Create Virtual Machine +$PUT+https://management.azure.com//subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default?api-version=2023-09-01-preview+2": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com//subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default?api-version=2023-09-01-preview", + "Content": "{\r\n \"properties\": {\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_K8S_v1\"\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"manualvmtest2\"\r\n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \"id\": \"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages/bugbashimage\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\"\r\n }\r\n }\r\n },\r\n \"extendedLocation\": {\r\n \"name\": \"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\r\n \"type\": \"CustomLocation\"\r\n }\r\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "682" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"46038510-0000-0100-0000-6549ccef0000\"" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "x-ms-providerhub-traffic": [ "True" ], + "mise-correlation-id": [ "35af5b40-90e3-4810-b635-e462964e2e2c" ], + "x-ms-request-id": [ "eb639699-3a1c-499b-b99f-69e00855b7cb" ], + "x-ms-correlation-request-id": [ "c7cf2be2-5110-445e-ad0e-65eef5df7481" ], + "Azure-AsyncOperation": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/a0e4c8cc-47bf-425c-a82f-f14a4ad68e4d*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349322074666639\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=F8anJ4qeWULY7oqOsrrWqt9UwpyRvufPgAz1phAiWcIgLdZeIKgjexBa8_xUTwLhorwxDRg78Y4WoxjD6PtX-_5F9HvwwKlSDWw-aSpykUP8LFg3-xRTsXqalSpxYDmZQFU1EsUP86KRnmS-pvkWMJXgABy3X7hgrDv5E3iNiU97mFvfinz1eDR-HqXT9lLaDtKw81fWfYnlWV_nHf2TQybJhcSA88dBBUejPWDjxU_WAuvGmrWUOXec2JlG72_ljunEoEOVAfxTON8DkOUZr9FXaTQ6ht8nAAqmzosbqafQ3hsjAcni_Atvw52mZU_hNgBm2dZYfSKMCVIvy26jDw\u0026h=XW8fMPQ3K32rrfqd8H3C5awBaq0febNLOoVeL0oMjRI" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T053647Z:c7cf2be2-5110-445e-ad0e-65eef5df7481" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 26F1398302E345F1BD1969B0DA48F9FF Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:36:46Z" ], + "Date": [ "Tue, 07 Nov 2023 05:36:47 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1089" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default\",\"name\":\"default\",\"type\":\"microsoft.azurestackhci/virtualmachineinstances\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T05:36:46.6698209Z\",\"lastModifiedBy\":\"havedati@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-11-07T05:36:46.6698209Z\"},\"properties\":{\"provisioningState\":\"Accepted\",\"hardwareProfile\":{\"vmSize\":\"Standard_K8S_v1\"},\"osProfile\":{\"computerName\":\"manualvmtest2\"},\"storageProfile\":{\"imageReference\":{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages/bugbashimage\"},\"osDisk\":{\"osType\":\"Linux\"}}}}" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Create Virtual Machine +$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/a0e4c8cc-47bf-425c-a82f-f14a4ad68e4d*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349322074666639\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=F8anJ4qeWULY7oqOsrrWqt9UwpyRvufPgAz1phAiWcIgLdZeIKgjexBa8_xUTwLhorwxDRg78Y4WoxjD6PtX-_5F9HvwwKlSDWw-aSpykUP8LFg3-xRTsXqalSpxYDmZQFU1EsUP86KRnmS-pvkWMJXgABy3X7hgrDv5E3iNiU97mFvfinz1eDR-HqXT9lLaDtKw81fWfYnlWV_nHf2TQybJhcSA88dBBUejPWDjxU_WAuvGmrWUOXec2JlG72_ljunEoEOVAfxTON8DkOUZr9FXaTQ6ht8nAAqmzosbqafQ3hsjAcni_Atvw52mZU_hNgBm2dZYfSKMCVIvy26jDw\u0026h=XW8fMPQ3K32rrfqd8H3C5awBaq0febNLOoVeL0oMjRI+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/a0e4c8cc-47bf-425c-a82f-f14a4ad68e4d*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349322074666639\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=F8anJ4qeWULY7oqOsrrWqt9UwpyRvufPgAz1phAiWcIgLdZeIKgjexBa8_xUTwLhorwxDRg78Y4WoxjD6PtX-_5F9HvwwKlSDWw-aSpykUP8LFg3-xRTsXqalSpxYDmZQFU1EsUP86KRnmS-pvkWMJXgABy3X7hgrDv5E3iNiU97mFvfinz1eDR-HqXT9lLaDtKw81fWfYnlWV_nHf2TQybJhcSA88dBBUejPWDjxU_WAuvGmrWUOXec2JlG72_ljunEoEOVAfxTON8DkOUZr9FXaTQ6ht8nAAqmzosbqafQ3hsjAcni_Atvw52mZU_hNgBm2dZYfSKMCVIvy26jDw\u0026h=XW8fMPQ3K32rrfqd8H3C5awBaq0febNLOoVeL0oMjRI", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "16" ], + "x-ms-client-request-id": [ "adb5e6b8-4b6e-4ef3-abd4-2b01e628d341" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmVirtualMachine" ], + "FullCommandName": [ "New-AzStackHCIVmVirtualMachine_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8f02a025-0000-0100-0000-6549ccf40000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "6c3990bc-86bd-40e3-8b1d-2a4d86c12101" ], + "x-ms-correlation-request-id": [ "4611dca6-34ce-4117-af9c-11ec60bc6db8" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T053717Z:4611dca6-34ce-4117-af9c-11ec60bc6db8" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 1F1B0A4B63C9462D843BE8D6A37AD3C6 Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:37:17Z" ], + "Date": [ "Tue, 07 Nov 2023 05:37:17 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "575" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/a0e4c8cc-47bf-425c-a82f-f14a4ad68e4d*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"name\":\"a0e4c8cc-47bf-425c-a82f-f14a4ad68e4d*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default\",\"status\":\"Accepted\",\"startTime\":\"2023-11-07T05:36:46.9028576Z\"}" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Create Virtual Machine +$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/a0e4c8cc-47bf-425c-a82f-f14a4ad68e4d*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349322074666639\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=F8anJ4qeWULY7oqOsrrWqt9UwpyRvufPgAz1phAiWcIgLdZeIKgjexBa8_xUTwLhorwxDRg78Y4WoxjD6PtX-_5F9HvwwKlSDWw-aSpykUP8LFg3-xRTsXqalSpxYDmZQFU1EsUP86KRnmS-pvkWMJXgABy3X7hgrDv5E3iNiU97mFvfinz1eDR-HqXT9lLaDtKw81fWfYnlWV_nHf2TQybJhcSA88dBBUejPWDjxU_WAuvGmrWUOXec2JlG72_ljunEoEOVAfxTON8DkOUZr9FXaTQ6ht8nAAqmzosbqafQ3hsjAcni_Atvw52mZU_hNgBm2dZYfSKMCVIvy26jDw\u0026h=XW8fMPQ3K32rrfqd8H3C5awBaq0febNLOoVeL0oMjRI+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/a0e4c8cc-47bf-425c-a82f-f14a4ad68e4d*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349322074666639\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=F8anJ4qeWULY7oqOsrrWqt9UwpyRvufPgAz1phAiWcIgLdZeIKgjexBa8_xUTwLhorwxDRg78Y4WoxjD6PtX-_5F9HvwwKlSDWw-aSpykUP8LFg3-xRTsXqalSpxYDmZQFU1EsUP86KRnmS-pvkWMJXgABy3X7hgrDv5E3iNiU97mFvfinz1eDR-HqXT9lLaDtKw81fWfYnlWV_nHf2TQybJhcSA88dBBUejPWDjxU_WAuvGmrWUOXec2JlG72_ljunEoEOVAfxTON8DkOUZr9FXaTQ6ht8nAAqmzosbqafQ3hsjAcni_Atvw52mZU_hNgBm2dZYfSKMCVIvy26jDw\u0026h=XW8fMPQ3K32rrfqd8H3C5awBaq0febNLOoVeL0oMjRI", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "17" ], + "x-ms-client-request-id": [ "adb5e6b8-4b6e-4ef3-abd4-2b01e628d341" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmVirtualMachine" ], + "FullCommandName": [ "New-AzStackHCIVmVirtualMachine_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8f02a025-0000-0100-0000-6549ccf40000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "343cceea-3b20-4670-97d2-a5b1af7c9e39" ], + "x-ms-correlation-request-id": [ "0c2f67c8-f74b-413a-abc6-968ea71dfd6e" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T053747Z:0c2f67c8-f74b-413a-abc6-968ea71dfd6e" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: EAB65551DBE54CD8A4F879939F4B78AA Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:37:47Z" ], + "Date": [ "Tue, 07 Nov 2023 05:37:47 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "575" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/a0e4c8cc-47bf-425c-a82f-f14a4ad68e4d*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"name\":\"a0e4c8cc-47bf-425c-a82f-f14a4ad68e4d*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default\",\"status\":\"Accepted\",\"startTime\":\"2023-11-07T05:36:46.9028576Z\"}" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Create Virtual Machine +$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/a0e4c8cc-47bf-425c-a82f-f14a4ad68e4d*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349322074666639\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=F8anJ4qeWULY7oqOsrrWqt9UwpyRvufPgAz1phAiWcIgLdZeIKgjexBa8_xUTwLhorwxDRg78Y4WoxjD6PtX-_5F9HvwwKlSDWw-aSpykUP8LFg3-xRTsXqalSpxYDmZQFU1EsUP86KRnmS-pvkWMJXgABy3X7hgrDv5E3iNiU97mFvfinz1eDR-HqXT9lLaDtKw81fWfYnlWV_nHf2TQybJhcSA88dBBUejPWDjxU_WAuvGmrWUOXec2JlG72_ljunEoEOVAfxTON8DkOUZr9FXaTQ6ht8nAAqmzosbqafQ3hsjAcni_Atvw52mZU_hNgBm2dZYfSKMCVIvy26jDw\u0026h=XW8fMPQ3K32rrfqd8H3C5awBaq0febNLOoVeL0oMjRI+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/a0e4c8cc-47bf-425c-a82f-f14a4ad68e4d*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349322074666639\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=F8anJ4qeWULY7oqOsrrWqt9UwpyRvufPgAz1phAiWcIgLdZeIKgjexBa8_xUTwLhorwxDRg78Y4WoxjD6PtX-_5F9HvwwKlSDWw-aSpykUP8LFg3-xRTsXqalSpxYDmZQFU1EsUP86KRnmS-pvkWMJXgABy3X7hgrDv5E3iNiU97mFvfinz1eDR-HqXT9lLaDtKw81fWfYnlWV_nHf2TQybJhcSA88dBBUejPWDjxU_WAuvGmrWUOXec2JlG72_ljunEoEOVAfxTON8DkOUZr9FXaTQ6ht8nAAqmzosbqafQ3hsjAcni_Atvw52mZU_hNgBm2dZYfSKMCVIvy26jDw\u0026h=XW8fMPQ3K32rrfqd8H3C5awBaq0febNLOoVeL0oMjRI", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "18" ], + "x-ms-client-request-id": [ "adb5e6b8-4b6e-4ef3-abd4-2b01e628d341" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmVirtualMachine" ], + "FullCommandName": [ "New-AzStackHCIVmVirtualMachine_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8f02a025-0000-0100-0000-6549ccf40000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "d8b8b5dc-e8a0-4d11-82f8-114734c8e87e" ], + "x-ms-correlation-request-id": [ "b15ba4c6-c237-438b-bf4f-e586cd2ec122" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T053817Z:b15ba4c6-c237-438b-bf4f-e586cd2ec122" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: D95C47C7C34E4E6FB767693210CA8480 Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:38:17Z" ], + "Date": [ "Tue, 07 Nov 2023 05:38:17 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "575" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/a0e4c8cc-47bf-425c-a82f-f14a4ad68e4d*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"name\":\"a0e4c8cc-47bf-425c-a82f-f14a4ad68e4d*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default\",\"status\":\"Accepted\",\"startTime\":\"2023-11-07T05:36:46.9028576Z\"}" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Create Virtual Machine +$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/a0e4c8cc-47bf-425c-a82f-f14a4ad68e4d*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349322074666639\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=F8anJ4qeWULY7oqOsrrWqt9UwpyRvufPgAz1phAiWcIgLdZeIKgjexBa8_xUTwLhorwxDRg78Y4WoxjD6PtX-_5F9HvwwKlSDWw-aSpykUP8LFg3-xRTsXqalSpxYDmZQFU1EsUP86KRnmS-pvkWMJXgABy3X7hgrDv5E3iNiU97mFvfinz1eDR-HqXT9lLaDtKw81fWfYnlWV_nHf2TQybJhcSA88dBBUejPWDjxU_WAuvGmrWUOXec2JlG72_ljunEoEOVAfxTON8DkOUZr9FXaTQ6ht8nAAqmzosbqafQ3hsjAcni_Atvw52mZU_hNgBm2dZYfSKMCVIvy26jDw\u0026h=XW8fMPQ3K32rrfqd8H3C5awBaq0febNLOoVeL0oMjRI+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/a0e4c8cc-47bf-425c-a82f-f14a4ad68e4d*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349322074666639\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=F8anJ4qeWULY7oqOsrrWqt9UwpyRvufPgAz1phAiWcIgLdZeIKgjexBa8_xUTwLhorwxDRg78Y4WoxjD6PtX-_5F9HvwwKlSDWw-aSpykUP8LFg3-xRTsXqalSpxYDmZQFU1EsUP86KRnmS-pvkWMJXgABy3X7hgrDv5E3iNiU97mFvfinz1eDR-HqXT9lLaDtKw81fWfYnlWV_nHf2TQybJhcSA88dBBUejPWDjxU_WAuvGmrWUOXec2JlG72_ljunEoEOVAfxTON8DkOUZr9FXaTQ6ht8nAAqmzosbqafQ3hsjAcni_Atvw52mZU_hNgBm2dZYfSKMCVIvy26jDw\u0026h=XW8fMPQ3K32rrfqd8H3C5awBaq0febNLOoVeL0oMjRI", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "19" ], + "x-ms-client-request-id": [ "adb5e6b8-4b6e-4ef3-abd4-2b01e628d341" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmVirtualMachine" ], + "FullCommandName": [ "New-AzStackHCIVmVirtualMachine_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8f028535-0000-0100-0000-6549cd520000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "22fb0c69-14f2-4cd5-8dbd-6911496c484b" ], + "x-ms-correlation-request-id": [ "8d41fa9b-9d85-4c86-85d3-b7f9643820c4" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T053848Z:8d41fa9b-9d85-4c86-85d3-b7f9643820c4" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 51A76F0C6536421D96E617691D2A146C Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:38:47Z" ], + "Date": [ "Tue, 07 Nov 2023 05:38:47 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "646" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/a0e4c8cc-47bf-425c-a82f-f14a4ad68e4d*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"name\":\"a0e4c8cc-47bf-425c-a82f-f14a4ad68e4d*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default\",\"status\":\"Succeeded\",\"startTime\":\"2023-11-07T05:36:46.9028576Z\",\"endTime\":\"2023-11-07T05:38:26.2923937Z\",\"error\":{},\"properties\":null}" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Create Virtual Machine +$GET+https://management.azure.com//subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default?api-version=2023-09-01-preview+7": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com//subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "20" ], + "x-ms-client-request-id": [ "adb5e6b8-4b6e-4ef3-abd4-2b01e628d341" ], + "CommandName": [ "Az.StackHCIVm.internal\\New-AzStackHCIVmVirtualMachine" ], + "FullCommandName": [ "New-AzStackHCIVmVirtualMachine_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"4603cb25-0000-0100-0000-6549cd530000\"" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-providerhub-traffic": [ "True" ], + "x-ms-request-id": [ "ac39b4f5-f9db-4327-a046-c82664352720" ], + "x-ms-correlation-request-id": [ "342b0b6c-eb4b-42d5-9a82-5b6f6abc6ffa" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T053848Z:342b0b6c-eb4b-42d5-9a82-5b6f6abc6ffa" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 21ACDAB0D80F49FC8C6EE11AD6764CC1 Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:38:48Z" ], + "Date": [ "Tue, 07 Nov 2023 05:38:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1504" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default\",\"name\":\"default\",\"type\":\"microsoft.azurestackhci/virtualmachineinstances\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T05:36:46.6698209Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-07T05:38:27.2016437Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"hardwareProfile\":{\"dynamicMemoryConfig\":{},\"vmSize\":\"Custom\",\"processors\":4,\"memoryMB\":4096},\"osProfile\":{\"computerName\":\"manualvmtest2\",\"linuxConfiguration\":{\"ssh\":{},\"disablePasswordAuthentication\":false},\"windowsConfiguration\":{\"ssh\":{}}},\"storageProfile\":{\"imageReference\":{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages/bugbashimage\"},\"osDisk\":{\"osType\":\"Linux\"},\"dataDisks\":[]},\"status\":{\"powerState\":\"Running\"},\"networkProfile\":{\"networkInterfaces\":[]},\"securityProfile\":{\"uefiSettings\":{\"secureBootEnabled\":true}},\"vmId\":\"e90d74b0-6c59-4aa4-b834-fa9bb4e91bae\",\"instanceView\":{\"vmAgent\":{\"statuses\":[]}}}}" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Get+$GET+https://management.azure.com//subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com//subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "21" ], + "x-ms-client-request-id": [ "07c9dbd5-83e4-4c5b-a647-d2ac94f69767" ], + "CommandName": [ "Az.StackHCIVm.internal\\Get-AzStackHCIVmVirtualMachine" ], + "FullCommandName": [ "Get-AzStackHCIVmVirtualMachine_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"4603cb25-0000-0100-0000-6549cd530000\"" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-providerhub-traffic": [ "True" ], + "x-ms-request-id": [ "7f3166ae-9312-42a2-b90d-91e57431ce30" ], + "x-ms-correlation-request-id": [ "908fdfd2-3c9c-454a-8736-5893ca71bf2f" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T053848Z:908fdfd2-3c9c-454a-8736-5893ca71bf2f" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: F3F56F31F0D9418DAE1E09940CCB68E7 Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:38:48Z" ], + "Date": [ "Tue, 07 Nov 2023 05:38:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1504" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default\",\"name\":\"default\",\"type\":\"microsoft.azurestackhci/virtualmachineinstances\",\"extendedLocation\":{\"name\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl\",\"type\":\"CustomLocation\"},\"systemData\":{\"createdBy\":\"havedati@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-11-07T05:36:46.6698209Z\",\"lastModifiedBy\":\"319f651f-7ddb-4fc6-9857-7aef9250bd05\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-11-07T05:38:27.2016437Z\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"hardwareProfile\":{\"dynamicMemoryConfig\":{},\"vmSize\":\"Custom\",\"processors\":4,\"memoryMB\":4096},\"osProfile\":{\"computerName\":\"manualvmtest2\",\"linuxConfiguration\":{\"ssh\":{},\"disablePasswordAuthentication\":false},\"windowsConfiguration\":{\"ssh\":{}}},\"storageProfile\":{\"imageReference\":{\"id\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages/bugbashimage\"},\"osDisk\":{\"osType\":\"Linux\"},\"dataDisks\":[]},\"status\":{\"powerState\":\"Running\"},\"networkProfile\":{\"networkInterfaces\":[]},\"securityProfile\":{\"uefiSettings\":{\"secureBootEnabled\":true}},\"vmId\":\"e90d74b0-6c59-4aa4-b834-fa9bb4e91bae\",\"instanceView\":{\"vmAgent\":{\"statuses\":[]}}}}" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Stop+$POST+https://management.azure.com//subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/stop?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com//subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/stop?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "22" ], + "x-ms-client-request-id": [ "a2b3b734-a56f-4ce9-90b6-84df546a8bc8" ], + "CommandName": [ "Az.StackHCIVm.internal\\Stop-AzStackHCIVmVirtualMachine" ], + "FullCommandName": [ "Stop-AzStackHCIVmVirtualMachine_Stop" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/96ca029d-851e-4305-b4db-42a5617e2913*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349323295935928\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=YLCnztCg4Aj01mke8yde9QXYFJVnIRk8W1NXHm08QnXT4OSpZ_C_RqxuBG5IK3nYguyLwmOA8pDWde5LmWHYad-Vil1xUOl1PKpKnZVkdGFwYXVSlH1QSm2PmrqIW3M2QXoEzB0ceaVJQay-qt02zfWX2w9NGGT8Oa0JhoibqcKZtRTzPzaBn1Viqtr88c6-qFmKaMtyS1pQ-epSTVWzwEN3G26pQzpdLKOAnZY3C3Q_8pGNd2knWlWgubIy2I1wZtj6dLms0G4iDaMkx5ng_oSsZb5J-HOsGzaAtARBJ_zTLFscYwiqtsWQaOmVyu4Fmqe_ZiKK_rPGA0GaS02f_Q\u0026h=CmSZgd6lDaK0QyfALHikZtxKd1t78owyUyeXCZs3RrM" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T053849Z:acb2990f-0959-4899-ba9b-8d8b89c241a1" ], + "x-ms-providerhub-traffic": [ "True" ], + "mise-correlation-id": [ "8819c55b-cf94-48ba-a038-a505cc1b289c" ], + "x-ms-request-id": [ "00000000-0000-0000-0000-000000000000" ], + "Azure-AsyncOperation": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/96ca029d-851e-4305-b4db-42a5617e2913*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349323295779999\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=aZdZ_sqg2_rfw5KtrkZDl9HdxKQpu65ABW9OEkEFjI89-E6cNzBbpXPwYUAnhrWeGn5aasZbTrpaJF3IwHgn0werhpKPrkwmE8PcBKmA9opFnM7tQ0_SpK0B0xmPzAKZ9w3JTZyGTXqx3qb9dpZeG8CIQREHWW7S2BKtLF9Sq9vgBLJlZUc_AFcCyT1IledVJP3Z29e39oAmH_-9BcjkbtGQXhhEbanCkzNvbIc6F5yItQhf-GVA0-EIPuyviNSlDzyKRsjcSQX8VTBOyTuNPhCRbv8GPv98JKcT0zYLRnFWdEkh6Cn5NPjeUEO1ZKeqJgY1Evp6yL7ccO08BH0nVg\u0026h=2JB6VibbQp6NN_79SuLD1x1zd9Zv3k5dx5wjnLu9N5U" ], + "x-ms-correlation-request-id": [ "acb2990f-0959-4899-ba9b-8d8b89c241a1" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: D10D05606C414A668A51BDEE868A3071 Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:38:48Z" ], + "Date": [ "Tue, 07 Nov 2023 05:38:49 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "4" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "bnVsbA==" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Stop+$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/96ca029d-851e-4305-b4db-42a5617e2913*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349323295779999\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=aZdZ_sqg2_rfw5KtrkZDl9HdxKQpu65ABW9OEkEFjI89-E6cNzBbpXPwYUAnhrWeGn5aasZbTrpaJF3IwHgn0werhpKPrkwmE8PcBKmA9opFnM7tQ0_SpK0B0xmPzAKZ9w3JTZyGTXqx3qb9dpZeG8CIQREHWW7S2BKtLF9Sq9vgBLJlZUc_AFcCyT1IledVJP3Z29e39oAmH_-9BcjkbtGQXhhEbanCkzNvbIc6F5yItQhf-GVA0-EIPuyviNSlDzyKRsjcSQX8VTBOyTuNPhCRbv8GPv98JKcT0zYLRnFWdEkh6Cn5NPjeUEO1ZKeqJgY1Evp6yL7ccO08BH0nVg\u0026h=2JB6VibbQp6NN_79SuLD1x1zd9Zv3k5dx5wjnLu9N5U+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/96ca029d-851e-4305-b4db-42a5617e2913*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349323295779999\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=aZdZ_sqg2_rfw5KtrkZDl9HdxKQpu65ABW9OEkEFjI89-E6cNzBbpXPwYUAnhrWeGn5aasZbTrpaJF3IwHgn0werhpKPrkwmE8PcBKmA9opFnM7tQ0_SpK0B0xmPzAKZ9w3JTZyGTXqx3qb9dpZeG8CIQREHWW7S2BKtLF9Sq9vgBLJlZUc_AFcCyT1IledVJP3Z29e39oAmH_-9BcjkbtGQXhhEbanCkzNvbIc6F5yItQhf-GVA0-EIPuyviNSlDzyKRsjcSQX8VTBOyTuNPhCRbv8GPv98JKcT0zYLRnFWdEkh6Cn5NPjeUEO1ZKeqJgY1Evp6yL7ccO08BH0nVg\u0026h=2JB6VibbQp6NN_79SuLD1x1zd9Zv3k5dx5wjnLu9N5U", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "23" ], + "x-ms-client-request-id": [ "a2b3b734-a56f-4ce9-90b6-84df546a8bc8" ], + "CommandName": [ "Az.StackHCIVm.internal\\Stop-AzStackHCIVmVirtualMachine" ], + "FullCommandName": [ "Stop-AzStackHCIVmVirtualMachine_Stop" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8f02293b-0000-0100-0000-6549cd730000\"" ], + "Location": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/96ca029d-851e-4305-b4db-42a5617e2913*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349323599286876\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=Dhy7IsF-JEq9ZMLkkrGyXO0mCFixF1s6Hz6PwcsReN-akf4ZX55soq1OqrJiWVsTakvm7DkI4sif_QYD9pYmGosNqdfqS1RAHNmH_YLXJOBTsygaorFeW83jvqAt2DFGpDWwXda57pTIA_cHEf5pEJM7InpmH-mK-NuefaTbhE-AvHlynA2pUHblFNTJ9zs219IjHI_Ot2nbqQrlyUzl58nX0vyDAi2bItCM7DM2vRDTD2w7_5g6JeAvaNsKg6OEVmFyEr4L2KMhrYsdSYSAlgupdihy3KWg_B6csOR5WjHUgaCiO0spRC4ftZnEkFbob78WNTGff80ubAynZADTow\u0026h=XDS4dDK1XbmvMEDdye0BF2me_oYer4t__fnPRBZxN9U" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11998" ], + "Azure-AsyncOperation": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/96ca029d-851e-4305-b4db-42a5617e2913*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349323599286876\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=Dhy7IsF-JEq9ZMLkkrGyXO0mCFixF1s6Hz6PwcsReN-akf4ZX55soq1OqrJiWVsTakvm7DkI4sif_QYD9pYmGosNqdfqS1RAHNmH_YLXJOBTsygaorFeW83jvqAt2DFGpDWwXda57pTIA_cHEf5pEJM7InpmH-mK-NuefaTbhE-AvHlynA2pUHblFNTJ9zs219IjHI_Ot2nbqQrlyUzl58nX0vyDAi2bItCM7DM2vRDTD2w7_5g6JeAvaNsKg6OEVmFyEr4L2KMhrYsdSYSAlgupdihy3KWg_B6csOR5WjHUgaCiO0spRC4ftZnEkFbob78WNTGff80ubAynZADTow\u0026h=XDS4dDK1XbmvMEDdye0BF2me_oYer4t__fnPRBZxN9U" ], + "x-ms-request-id": [ "42c28578-a303-4b5b-afb9-421ce18b4a10" ], + "x-ms-correlation-request-id": [ "82a5e60b-ac8a-4691-a555-faf9ee10c4a1" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T053919Z:82a5e60b-ac8a-4691-a555-faf9ee10c4a1" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 0AF79E94A2EA43FA8DC4FC01D74368E4 Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:39:19Z" ], + "Date": [ "Tue, 07 Nov 2023 05:39:19 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "573" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/96ca029d-851e-4305-b4db-42a5617e2913*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"name\":\"96ca029d-851e-4305-b4db-42a5617e2913*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default\",\"status\":\"Accepted\",\"startTime\":\"2023-11-07T05:38:49.14225Z\"}" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Stop+$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/96ca029d-851e-4305-b4db-42a5617e2913*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349323599286876\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=Dhy7IsF-JEq9ZMLkkrGyXO0mCFixF1s6Hz6PwcsReN-akf4ZX55soq1OqrJiWVsTakvm7DkI4sif_QYD9pYmGosNqdfqS1RAHNmH_YLXJOBTsygaorFeW83jvqAt2DFGpDWwXda57pTIA_cHEf5pEJM7InpmH-mK-NuefaTbhE-AvHlynA2pUHblFNTJ9zs219IjHI_Ot2nbqQrlyUzl58nX0vyDAi2bItCM7DM2vRDTD2w7_5g6JeAvaNsKg6OEVmFyEr4L2KMhrYsdSYSAlgupdihy3KWg_B6csOR5WjHUgaCiO0spRC4ftZnEkFbob78WNTGff80ubAynZADTow\u0026h=XDS4dDK1XbmvMEDdye0BF2me_oYer4t__fnPRBZxN9U+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/96ca029d-851e-4305-b4db-42a5617e2913*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349323599286876\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=Dhy7IsF-JEq9ZMLkkrGyXO0mCFixF1s6Hz6PwcsReN-akf4ZX55soq1OqrJiWVsTakvm7DkI4sif_QYD9pYmGosNqdfqS1RAHNmH_YLXJOBTsygaorFeW83jvqAt2DFGpDWwXda57pTIA_cHEf5pEJM7InpmH-mK-NuefaTbhE-AvHlynA2pUHblFNTJ9zs219IjHI_Ot2nbqQrlyUzl58nX0vyDAi2bItCM7DM2vRDTD2w7_5g6JeAvaNsKg6OEVmFyEr4L2KMhrYsdSYSAlgupdihy3KWg_B6csOR5WjHUgaCiO0spRC4ftZnEkFbob78WNTGff80ubAynZADTow\u0026h=XDS4dDK1XbmvMEDdye0BF2me_oYer4t__fnPRBZxN9U", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "24" ], + "x-ms-client-request-id": [ "a2b3b734-a56f-4ce9-90b6-84df546a8bc8" ], + "CommandName": [ "Az.StackHCIVm.internal\\Stop-AzStackHCIVmVirtualMachine" ], + "FullCommandName": [ "Stop-AzStackHCIVmVirtualMachine_Stop" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8f02293b-0000-0100-0000-6549cd730000\"" ], + "Location": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/96ca029d-851e-4305-b4db-42a5617e2913*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349323901476043\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=c8KO6aY6TYoulouTSeFpFZUYPIMJuEu5v58fcfmKPSA3BtmmJGDy4t2czWrPcOQmubNZYiPYsVSndUY5xx-ViDwPaZP8DoFTIzR8-4MhRmrf7zLfaXIJ1E6nIo5YzK3SeEA2T4P0igY7YsCSA43Ng0-EINgqrG9KMSHBeHZKP3FeXTbReXiiO_A5zjlOlNLcdERfLBOXvEpQjhYALQLmhU0N4Bi37jU0QA98XEWdK2tqIvXEAg7dDpyyZhzvGZ1VIQDn29T4A9TpCZh3GSonLgi6s40fM_a7X04UMTB1hnOK7vJO-EO6fvwb_649y7aRHx7FAxtcreLwjGzh9HwAng\u0026h=CE-kYCO_KsrwnR9881b32IE_Kz-Gx6YTDGrarhKSdeo" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "Azure-AsyncOperation": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/96ca029d-851e-4305-b4db-42a5617e2913*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349323901319763\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=FZ_drRlL9aBkv0r7edUkzpml-4-YWPLS3rO1YA7UMwkx02R8HVfKpSmPKbhdOijsA_G8N2RwmDL_7eUzcqaSM7j1B5MlwVrZjbG__GFS4JbqwnaWhMUqUhkH6gGLpl-T5-2TbtlJp6KSNIYuhFKluAqSYbAwZ2B1uMk4sRxNBsW3N7hf-uRP9SbkuJGW61QZxyPp1-_moIxDt6b1hYWl8aZmFs1dcM7zHVI4BCgtJGdRBWe6x3QUvldprlh3BeGMeX10J37aLTVRJgXcAvWXYkLWvCDPwZ4jCZCSCB3A4S4H1e4E1mV4MkDeKNCF_aWai4-3cBsE2PeJVNnSWlz9ew\u0026h=fEXNJw0TPnrYs9PTs-8b6GA6BWv-xZsgXiczhTX5Q8E" ], + "x-ms-request-id": [ "a0de7ffb-f924-45fb-a989-9110730dd4ef" ], + "x-ms-correlation-request-id": [ "aed07d75-c2dd-4707-9c54-1ef73dc24186" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T053950Z:aed07d75-c2dd-4707-9c54-1ef73dc24186" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 5F46F6BD1D9A4724A4E987F18B048CB2 Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:39:50Z" ], + "Date": [ "Tue, 07 Nov 2023 05:39:49 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "573" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/96ca029d-851e-4305-b4db-42a5617e2913*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"name\":\"96ca029d-851e-4305-b4db-42a5617e2913*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default\",\"status\":\"Accepted\",\"startTime\":\"2023-11-07T05:38:49.14225Z\"}" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Stop+$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/96ca029d-851e-4305-b4db-42a5617e2913*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349323901319763\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=FZ_drRlL9aBkv0r7edUkzpml-4-YWPLS3rO1YA7UMwkx02R8HVfKpSmPKbhdOijsA_G8N2RwmDL_7eUzcqaSM7j1B5MlwVrZjbG__GFS4JbqwnaWhMUqUhkH6gGLpl-T5-2TbtlJp6KSNIYuhFKluAqSYbAwZ2B1uMk4sRxNBsW3N7hf-uRP9SbkuJGW61QZxyPp1-_moIxDt6b1hYWl8aZmFs1dcM7zHVI4BCgtJGdRBWe6x3QUvldprlh3BeGMeX10J37aLTVRJgXcAvWXYkLWvCDPwZ4jCZCSCB3A4S4H1e4E1mV4MkDeKNCF_aWai4-3cBsE2PeJVNnSWlz9ew\u0026h=fEXNJw0TPnrYs9PTs-8b6GA6BWv-xZsgXiczhTX5Q8E+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/96ca029d-851e-4305-b4db-42a5617e2913*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349323901319763\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=FZ_drRlL9aBkv0r7edUkzpml-4-YWPLS3rO1YA7UMwkx02R8HVfKpSmPKbhdOijsA_G8N2RwmDL_7eUzcqaSM7j1B5MlwVrZjbG__GFS4JbqwnaWhMUqUhkH6gGLpl-T5-2TbtlJp6KSNIYuhFKluAqSYbAwZ2B1uMk4sRxNBsW3N7hf-uRP9SbkuJGW61QZxyPp1-_moIxDt6b1hYWl8aZmFs1dcM7zHVI4BCgtJGdRBWe6x3QUvldprlh3BeGMeX10J37aLTVRJgXcAvWXYkLWvCDPwZ4jCZCSCB3A4S4H1e4E1mV4MkDeKNCF_aWai4-3cBsE2PeJVNnSWlz9ew\u0026h=fEXNJw0TPnrYs9PTs-8b6GA6BWv-xZsgXiczhTX5Q8E", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "25" ], + "x-ms-client-request-id": [ "a2b3b734-a56f-4ce9-90b6-84df546a8bc8" ], + "CommandName": [ "Az.StackHCIVm.internal\\Stop-AzStackHCIVmVirtualMachine" ], + "FullCommandName": [ "Stop-AzStackHCIVmVirtualMachine_Stop" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8f021e46-0000-0100-0000-6549cdb20000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "3e9ffb38-d0ff-4c93-a8ef-52e1832e1792" ], + "x-ms-correlation-request-id": [ "dc14b183-6247-4652-910f-ca3dfa1c8b85" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T054020Z:dc14b183-6247-4652-910f-ca3dfa1c8b85" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 8DFB16198557461684C63E6053210664 Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:40:20Z" ], + "Date": [ "Tue, 07 Nov 2023 05:40:19 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "644" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/96ca029d-851e-4305-b4db-42a5617e2913*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"name\":\"96ca029d-851e-4305-b4db-42a5617e2913*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default\",\"status\":\"Succeeded\",\"startTime\":\"2023-11-07T05:38:49.14225Z\",\"endTime\":\"2023-11-07T05:40:02.0330121Z\",\"error\":{},\"properties\":null}" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Stop+$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/96ca029d-851e-4305-b4db-42a5617e2913*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349323295935928\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=YLCnztCg4Aj01mke8yde9QXYFJVnIRk8W1NXHm08QnXT4OSpZ_C_RqxuBG5IK3nYguyLwmOA8pDWde5LmWHYad-Vil1xUOl1PKpKnZVkdGFwYXVSlH1QSm2PmrqIW3M2QXoEzB0ceaVJQay-qt02zfWX2w9NGGT8Oa0JhoibqcKZtRTzPzaBn1Viqtr88c6-qFmKaMtyS1pQ-epSTVWzwEN3G26pQzpdLKOAnZY3C3Q_8pGNd2knWlWgubIy2I1wZtj6dLms0G4iDaMkx5ng_oSsZb5J-HOsGzaAtARBJ_zTLFscYwiqtsWQaOmVyu4Fmqe_ZiKK_rPGA0GaS02f_Q\u0026h=CmSZgd6lDaK0QyfALHikZtxKd1t78owyUyeXCZs3RrM+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/96ca029d-851e-4305-b4db-42a5617e2913*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349323295935928\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=YLCnztCg4Aj01mke8yde9QXYFJVnIRk8W1NXHm08QnXT4OSpZ_C_RqxuBG5IK3nYguyLwmOA8pDWde5LmWHYad-Vil1xUOl1PKpKnZVkdGFwYXVSlH1QSm2PmrqIW3M2QXoEzB0ceaVJQay-qt02zfWX2w9NGGT8Oa0JhoibqcKZtRTzPzaBn1Viqtr88c6-qFmKaMtyS1pQ-epSTVWzwEN3G26pQzpdLKOAnZY3C3Q_8pGNd2knWlWgubIy2I1wZtj6dLms0G4iDaMkx5ng_oSsZb5J-HOsGzaAtARBJ_zTLFscYwiqtsWQaOmVyu4Fmqe_ZiKK_rPGA0GaS02f_Q\u0026h=CmSZgd6lDaK0QyfALHikZtxKd1t78owyUyeXCZs3RrM", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "26" ], + "x-ms-client-request-id": [ "a2b3b734-a56f-4ce9-90b6-84df546a8bc8" ], + "CommandName": [ "Az.StackHCIVm.internal\\Stop-AzStackHCIVmVirtualMachine" ], + "FullCommandName": [ "Stop-AzStackHCIVmVirtualMachine_Stop" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8f021e46-0000-0100-0000-6549cdb20000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11998" ], + "x-ms-request-id": [ "371514ec-f15a-4abd-aaf2-4fdf282ec23f" ], + "x-ms-correlation-request-id": [ "afac6915-85bf-4877-aaa5-99c90844ac07" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T054020Z:afac6915-85bf-4877-aaa5-99c90844ac07" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 041FF9226686438D8DDE6000E2F7B5AA Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:40:20Z" ], + "Date": [ "Tue, 07 Nov 2023 05:40:19 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "644" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/96ca029d-851e-4305-b4db-42a5617e2913*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"name\":\"96ca029d-851e-4305-b4db-42a5617e2913*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default\",\"status\":\"Succeeded\",\"startTime\":\"2023-11-07T05:38:49.14225Z\",\"endTime\":\"2023-11-07T05:40:02.0330121Z\",\"error\":{},\"properties\":null}" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Start+$POST+https://management.azure.com//subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/start?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com//subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/start?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "27" ], + "x-ms-client-request-id": [ "0b451c0a-5e71-4000-9a5f-8c50f1c2cf80" ], + "CommandName": [ "Az.StackHCIVm.internal\\Start-AzStackHCIVmVirtualMachine" ], + "FullCommandName": [ "Start-AzStackHCIVmVirtualMachine_Start" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/26767eb5-18ca-46e3-a8de-d887adcd6c91*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349324220927562\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=gN4PgfHLckRHNS6Ko5ThXHuNjVC8TfovHnsQsXredT-FR-CV43EIJsl8OaSCZrhSGwwZ3qxA9JkrnKI5l9d_6ojg0tljcPuG1JQ9YSYlsFZuiLt5qLg-L90ButmufsFYC-MITG7SGVFrxWa47LGxZYmbnaC0x67nKEJbKfOUrWLg-rYHFJGw0d0yYC5Wg-aMHsNs6E2afp9a84ezJNriCzvMS2nM5kn8XsCl7fx7YeVzL8B2MeP0DnVHfgaZwqwE2yD4lM1JCb1ITyAJUIUgRXdGMM6X8hk75aBJfvSw2E-Qer8aWmD6MD-t7QFmzsl2jZ0rs1rt4y4ZbAaoNTVAcw\u0026h=6erUqLhTOBZWFs5vaoAFA_waRQNSpZfF45ybSKU_arU" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1198" ], + "x-ms-providerhub-traffic": [ "True" ], + "mise-correlation-id": [ "39dc8635-c703-436d-8cdb-eca04f699596" ], + "x-ms-request-id": [ "00000000-0000-0000-0000-000000000000" ], + "Azure-AsyncOperation": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/26767eb5-18ca-46e3-a8de-d887adcd6c91*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349324220927562\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=gN4PgfHLckRHNS6Ko5ThXHuNjVC8TfovHnsQsXredT-FR-CV43EIJsl8OaSCZrhSGwwZ3qxA9JkrnKI5l9d_6ojg0tljcPuG1JQ9YSYlsFZuiLt5qLg-L90ButmufsFYC-MITG7SGVFrxWa47LGxZYmbnaC0x67nKEJbKfOUrWLg-rYHFJGw0d0yYC5Wg-aMHsNs6E2afp9a84ezJNriCzvMS2nM5kn8XsCl7fx7YeVzL8B2MeP0DnVHfgaZwqwE2yD4lM1JCb1ITyAJUIUgRXdGMM6X8hk75aBJfvSw2E-Qer8aWmD6MD-t7QFmzsl2jZ0rs1rt4y4ZbAaoNTVAcw\u0026h=6erUqLhTOBZWFs5vaoAFA_waRQNSpZfF45ybSKU_arU" ], + "x-ms-correlation-request-id": [ "b74ea1cc-5021-4f5f-b2ef-cfcd85c30ac6" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T054022Z:b74ea1cc-5021-4f5f-b2ef-cfcd85c30ac6" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 71B1675554F749D6898668DEBF84BD39 Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:40:20Z" ], + "Date": [ "Tue, 07 Nov 2023 05:40:21 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "4" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "bnVsbA==" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Start+$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/26767eb5-18ca-46e3-a8de-d887adcd6c91*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349324220927562\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=gN4PgfHLckRHNS6Ko5ThXHuNjVC8TfovHnsQsXredT-FR-CV43EIJsl8OaSCZrhSGwwZ3qxA9JkrnKI5l9d_6ojg0tljcPuG1JQ9YSYlsFZuiLt5qLg-L90ButmufsFYC-MITG7SGVFrxWa47LGxZYmbnaC0x67nKEJbKfOUrWLg-rYHFJGw0d0yYC5Wg-aMHsNs6E2afp9a84ezJNriCzvMS2nM5kn8XsCl7fx7YeVzL8B2MeP0DnVHfgaZwqwE2yD4lM1JCb1ITyAJUIUgRXdGMM6X8hk75aBJfvSw2E-Qer8aWmD6MD-t7QFmzsl2jZ0rs1rt4y4ZbAaoNTVAcw\u0026h=6erUqLhTOBZWFs5vaoAFA_waRQNSpZfF45ybSKU_arU+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/26767eb5-18ca-46e3-a8de-d887adcd6c91*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349324220927562\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=gN4PgfHLckRHNS6Ko5ThXHuNjVC8TfovHnsQsXredT-FR-CV43EIJsl8OaSCZrhSGwwZ3qxA9JkrnKI5l9d_6ojg0tljcPuG1JQ9YSYlsFZuiLt5qLg-L90ButmufsFYC-MITG7SGVFrxWa47LGxZYmbnaC0x67nKEJbKfOUrWLg-rYHFJGw0d0yYC5Wg-aMHsNs6E2afp9a84ezJNriCzvMS2nM5kn8XsCl7fx7YeVzL8B2MeP0DnVHfgaZwqwE2yD4lM1JCb1ITyAJUIUgRXdGMM6X8hk75aBJfvSw2E-Qer8aWmD6MD-t7QFmzsl2jZ0rs1rt4y4ZbAaoNTVAcw\u0026h=6erUqLhTOBZWFs5vaoAFA_waRQNSpZfF45ybSKU_arU", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "28" ], + "x-ms-client-request-id": [ "0b451c0a-5e71-4000-9a5f-8c50f1c2cf80" ], + "CommandName": [ "Az.StackHCIVm.internal\\Start-AzStackHCIVmVirtualMachine" ], + "FullCommandName": [ "Start-AzStackHCIVmVirtualMachine_Start" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8f02ee4a-0000-0100-0000-6549cdcb0000\"" ], + "Location": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/26767eb5-18ca-46e3-a8de-d887adcd6c91*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349324522916079\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=lkp32J71I7VfR1bqrXaOObTVKf_SnHN50M17glgbLv3qa5CkZVYXOGLsuWYZ4Ke24niuOwXWaWxW1rKCrBaAp5bSdAEKKyzP6hZkpfTPsppwl74pu1P_SNfs_vlg5MI-RMi1M5yCcBWeAL7JTRLGpjYnabB6smj5pj3rzZlaQFjCdY0r70HvXjeg225Q2g4YloweDu11UNWb82uoQUe8RPpbbayMUqs5bsP6EeKw91gCy8W5O4ipcSoUZtR_dVwF4Rws3hhlzZPXuZi_rYgYRGPfo1TQp1p3P6LtlJbFP_DikDnBxr3gV4zMuydVNgneXwQmgaRP0k8euYKoDXZotQ\u0026h=McDn18XFJQYnWDtoCWCAT5kO2D1txgsRPLFmAIxDdyc" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T054052Z:bb969b4a-f060-4908-9453-1a741f2e171f" ], + "Azure-AsyncOperation": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/26767eb5-18ca-46e3-a8de-d887adcd6c91*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349324522603598\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=er80SxTlvVVHsfhyl45OptOCJcyNFfmtMx0k-VkCG43Xrhj9wNFw5JmFzko0bDQqZnruY__K6yKby-N8jl8TPPlTALVOuWOLE172HiGQGBeccq6YLSycbD_qsKI6Dka49-g_sj2_aQ2zE8SnT03kQYnCsqc45bPp_bptUXC7r6bcZ2sznYLKNia-Rpu6e2LqIaOFKQ1LkCveIKMddjgxfU9nlcmalGEvlvwJG-16_L7ezkKk4zHMioiXAXoWr882_AZljUp_l0K5HbDJ6JP2yFop01XqO-w4CKOJQ8F9LsSXwie4wiJuYiGQChYGh5HjzN2qljERAsZMzbTrN8Nicg\u0026h=K204QnKTBL1eNIsRAceVmSbPNcdT2elyLL0uLrxxE5A" ], + "x-ms-request-id": [ "e3fa1327-a4d9-4102-ae67-e7835b2f3377" ], + "x-ms-correlation-request-id": [ "bb969b4a-f060-4908-9453-1a741f2e171f" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: D1AD011A2D384A8992A9F23DAD09949E Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:40:52Z" ], + "Date": [ "Tue, 07 Nov 2023 05:40:51 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "575" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/26767eb5-18ca-46e3-a8de-d887adcd6c91*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"name\":\"26767eb5-18ca-46e3-a8de-d887adcd6c91*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default\",\"status\":\"Accepted\",\"startTime\":\"2023-11-07T05:40:21.0594742Z\"}" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Start+$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/26767eb5-18ca-46e3-a8de-d887adcd6c91*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349324522603598\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=er80SxTlvVVHsfhyl45OptOCJcyNFfmtMx0k-VkCG43Xrhj9wNFw5JmFzko0bDQqZnruY__K6yKby-N8jl8TPPlTALVOuWOLE172HiGQGBeccq6YLSycbD_qsKI6Dka49-g_sj2_aQ2zE8SnT03kQYnCsqc45bPp_bptUXC7r6bcZ2sznYLKNia-Rpu6e2LqIaOFKQ1LkCveIKMddjgxfU9nlcmalGEvlvwJG-16_L7ezkKk4zHMioiXAXoWr882_AZljUp_l0K5HbDJ6JP2yFop01XqO-w4CKOJQ8F9LsSXwie4wiJuYiGQChYGh5HjzN2qljERAsZMzbTrN8Nicg\u0026h=K204QnKTBL1eNIsRAceVmSbPNcdT2elyLL0uLrxxE5A+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/26767eb5-18ca-46e3-a8de-d887adcd6c91*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349324522603598\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=er80SxTlvVVHsfhyl45OptOCJcyNFfmtMx0k-VkCG43Xrhj9wNFw5JmFzko0bDQqZnruY__K6yKby-N8jl8TPPlTALVOuWOLE172HiGQGBeccq6YLSycbD_qsKI6Dka49-g_sj2_aQ2zE8SnT03kQYnCsqc45bPp_bptUXC7r6bcZ2sznYLKNia-Rpu6e2LqIaOFKQ1LkCveIKMddjgxfU9nlcmalGEvlvwJG-16_L7ezkKk4zHMioiXAXoWr882_AZljUp_l0K5HbDJ6JP2yFop01XqO-w4CKOJQ8F9LsSXwie4wiJuYiGQChYGh5HjzN2qljERAsZMzbTrN8Nicg\u0026h=K204QnKTBL1eNIsRAceVmSbPNcdT2elyLL0uLrxxE5A", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "29" ], + "x-ms-client-request-id": [ "0b451c0a-5e71-4000-9a5f-8c50f1c2cf80" ], + "CommandName": [ "Az.StackHCIVm.internal\\Start-AzStackHCIVmVirtualMachine" ], + "FullCommandName": [ "Start-AzStackHCIVmVirtualMachine_Start" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8f02ee4a-0000-0100-0000-6549cdcb0000\"" ], + "Location": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/26767eb5-18ca-46e3-a8de-d887adcd6c91*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349324824641969\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=SeVX5i0wYDMBeJ9Rib_4ciTx2wC-FYWQQXDt635XFBsAfKfPem13aTHH-a55-YOBv6KKMi1dDiudoyjIffAbeovYvXYaWVhjy3yRWah2ohZixMumqsRaOeKThlOsGoTzQnRt20u6s0K9DUGq_yDUIGqJtJz9IN0AAp7lLJkKgWPIfEpdwb61IwN4Zn50dpqVLuN-Mj-Chnwpkj5GszFym3AET0UldeeHiWVcTuoN91QnSlh-BbZcSrFVqqX76MYOGWB2vkfQZhnb-3NvYX5Zh7vXCsoki4s73aSxrMLdGHQxFDUuefef9NnrxODybN5a6cU8IeUU649PmP0-NxmPEg\u0026h=G3Lkz0pbhK59yKIQNDQ7ydRpICA-d39-dx0vavMTme8" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "Azure-AsyncOperation": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/26767eb5-18ca-46e3-a8de-d887adcd6c91*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349324824641969\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=SeVX5i0wYDMBeJ9Rib_4ciTx2wC-FYWQQXDt635XFBsAfKfPem13aTHH-a55-YOBv6KKMi1dDiudoyjIffAbeovYvXYaWVhjy3yRWah2ohZixMumqsRaOeKThlOsGoTzQnRt20u6s0K9DUGq_yDUIGqJtJz9IN0AAp7lLJkKgWPIfEpdwb61IwN4Zn50dpqVLuN-Mj-Chnwpkj5GszFym3AET0UldeeHiWVcTuoN91QnSlh-BbZcSrFVqqX76MYOGWB2vkfQZhnb-3NvYX5Zh7vXCsoki4s73aSxrMLdGHQxFDUuefef9NnrxODybN5a6cU8IeUU649PmP0-NxmPEg\u0026h=G3Lkz0pbhK59yKIQNDQ7ydRpICA-d39-dx0vavMTme8" ], + "x-ms-request-id": [ "b521726d-884f-4f35-b00b-ea49010658d2" ], + "x-ms-correlation-request-id": [ "0a3f6ff1-38da-4e0e-82a4-0f429bfee4a0" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T054122Z:0a3f6ff1-38da-4e0e-82a4-0f429bfee4a0" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 2BE2170EFB05476A907C12CD78D20DE3 Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:41:22Z" ], + "Date": [ "Tue, 07 Nov 2023 05:41:21 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "575" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/26767eb5-18ca-46e3-a8de-d887adcd6c91*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"name\":\"26767eb5-18ca-46e3-a8de-d887adcd6c91*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default\",\"status\":\"Accepted\",\"startTime\":\"2023-11-07T05:40:21.0594742Z\"}" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Start+$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/26767eb5-18ca-46e3-a8de-d887adcd6c91*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349324824641969\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=SeVX5i0wYDMBeJ9Rib_4ciTx2wC-FYWQQXDt635XFBsAfKfPem13aTHH-a55-YOBv6KKMi1dDiudoyjIffAbeovYvXYaWVhjy3yRWah2ohZixMumqsRaOeKThlOsGoTzQnRt20u6s0K9DUGq_yDUIGqJtJz9IN0AAp7lLJkKgWPIfEpdwb61IwN4Zn50dpqVLuN-Mj-Chnwpkj5GszFym3AET0UldeeHiWVcTuoN91QnSlh-BbZcSrFVqqX76MYOGWB2vkfQZhnb-3NvYX5Zh7vXCsoki4s73aSxrMLdGHQxFDUuefef9NnrxODybN5a6cU8IeUU649PmP0-NxmPEg\u0026h=G3Lkz0pbhK59yKIQNDQ7ydRpICA-d39-dx0vavMTme8+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/26767eb5-18ca-46e3-a8de-d887adcd6c91*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349324824641969\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=SeVX5i0wYDMBeJ9Rib_4ciTx2wC-FYWQQXDt635XFBsAfKfPem13aTHH-a55-YOBv6KKMi1dDiudoyjIffAbeovYvXYaWVhjy3yRWah2ohZixMumqsRaOeKThlOsGoTzQnRt20u6s0K9DUGq_yDUIGqJtJz9IN0AAp7lLJkKgWPIfEpdwb61IwN4Zn50dpqVLuN-Mj-Chnwpkj5GszFym3AET0UldeeHiWVcTuoN91QnSlh-BbZcSrFVqqX76MYOGWB2vkfQZhnb-3NvYX5Zh7vXCsoki4s73aSxrMLdGHQxFDUuefef9NnrxODybN5a6cU8IeUU649PmP0-NxmPEg\u0026h=G3Lkz0pbhK59yKIQNDQ7ydRpICA-d39-dx0vavMTme8", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "30" ], + "x-ms-client-request-id": [ "0b451c0a-5e71-4000-9a5f-8c50f1c2cf80" ], + "CommandName": [ "Az.StackHCIVm.internal\\Start-AzStackHCIVmVirtualMachine" ], + "FullCommandName": [ "Start-AzStackHCIVmVirtualMachine_Start" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8f02ce56-0000-0100-0000-6549ce0d0000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11998" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T054152Z:8f48c853-8837-49ee-964c-d81adc1bff15" ], + "x-ms-request-id": [ "9262af07-21a2-407b-adb9-4802cf54dbe0" ], + "x-ms-correlation-request-id": [ "8f48c853-8837-49ee-964c-d81adc1bff15" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: B419C1CFE7D64854B3EF5CD9B3ADAF00 Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:41:52Z" ], + "Date": [ "Tue, 07 Nov 2023 05:41:52 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "646" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/26767eb5-18ca-46e3-a8de-d887adcd6c91*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"name\":\"26767eb5-18ca-46e3-a8de-d887adcd6c91*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default\",\"status\":\"Succeeded\",\"startTime\":\"2023-11-07T05:40:21.0594742Z\",\"endTime\":\"2023-11-07T05:41:33.1255666Z\",\"error\":{},\"properties\":null}" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Start+$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/26767eb5-18ca-46e3-a8de-d887adcd6c91*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349324220927562\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=gN4PgfHLckRHNS6Ko5ThXHuNjVC8TfovHnsQsXredT-FR-CV43EIJsl8OaSCZrhSGwwZ3qxA9JkrnKI5l9d_6ojg0tljcPuG1JQ9YSYlsFZuiLt5qLg-L90ButmufsFYC-MITG7SGVFrxWa47LGxZYmbnaC0x67nKEJbKfOUrWLg-rYHFJGw0d0yYC5Wg-aMHsNs6E2afp9a84ezJNriCzvMS2nM5kn8XsCl7fx7YeVzL8B2MeP0DnVHfgaZwqwE2yD4lM1JCb1ITyAJUIUgRXdGMM6X8hk75aBJfvSw2E-Qer8aWmD6MD-t7QFmzsl2jZ0rs1rt4y4ZbAaoNTVAcw\u0026h=6erUqLhTOBZWFs5vaoAFA_waRQNSpZfF45ybSKU_arU+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/26767eb5-18ca-46e3-a8de-d887adcd6c91*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349324220927562\u0026c=MIIHADCCBeigAwIBAgITHgMjMN6vpcEQg2_WbgAAAyMw3jANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjMwODAzMDczNjQzWhcNMjQwNzI4MDczNjQzWjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKtqtBNpyBDffqSjU2vKc-q1Ku3MtRBZR4VV9i6TdAcmNpVmw6W8QNgsa-z0zaqgCcjkLIFSUySU0_7_r4cjNFPDGVj0Y3gPDesFRunHaZsZoA2l235ZxgkOhmI9Eq_hgRKbBV-_zy1PbegjuigJTDOv4tC_xxRRMMioo273xgqG_kUrJVmb5EpU0OONBJtawx7E17himPHTOSCk6f__KaMY6z55v5motGTAEvs40N_pYLk36d4xWMWAfMSqoQu0fCiDTOBh9fXR1Mix28dh2is83JJOEmTls4gNVGZ4_gVn6DrVk-sPnD5sGs789lwzBSlRdpOoJMUnxOgMEgc_JB0CAwEAAaOCA-0wggPpMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHLBggrBgEFBQcBAQSCAb0wggG5MGMGCCsGAQUFBzAChldodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MFMGCCsGAQUFBzAChkdodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAyLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDA2LmNydDBTBggrBgEFBQcwAoZHaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMi5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwNi5jcnQwUwYIKwYBBQUHMAKGR2h0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDIuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3J0MB0GA1UdDgQWBBQQBQ6aI7w4CwOrsQOypzq30e50CDAOBgNVHQ8BAf8EBAMCBaAwggEmBgNVHR8EggEdMIIBGTCCARWgggERoIIBDYY_aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDYuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBTxRmjG8cPwKy19i2rhsvm-NfzRQTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAD5C_x4drGztlnmLaCdpAyL9KN3LkK_sr-VeDz0s3SwQ30lixsYUUfohjlbSqgoq5GW7WmEgMVuyHCv3nUc01REq-CK7A2xlhD68sfOKqXdpPFsjDCyVEFxuigozWoM3jh9ffTPLM-0cuvpIUH3sOooWAL0Y2RpShpYCxzE7ufkpuFvrs0SPvDNxn7Ga6gYdqvqXsGni-J8I4mQ5sPmZa23Nqq3RDpkYkMunjIJkX7_3p-mX4Wcnm5j93_oLnn7WRkjMF3gwwCcJGn_2yLAeVeJ8E4TNZA2_mfmwo7zGwRDV0VT4JM6evNGxDXVG9XG3hdGlZaoe_TTL5yyWR4CmM2A\u0026s=gN4PgfHLckRHNS6Ko5ThXHuNjVC8TfovHnsQsXredT-FR-CV43EIJsl8OaSCZrhSGwwZ3qxA9JkrnKI5l9d_6ojg0tljcPuG1JQ9YSYlsFZuiLt5qLg-L90ButmufsFYC-MITG7SGVFrxWa47LGxZYmbnaC0x67nKEJbKfOUrWLg-rYHFJGw0d0yYC5Wg-aMHsNs6E2afp9a84ezJNriCzvMS2nM5kn8XsCl7fx7YeVzL8B2MeP0DnVHfgaZwqwE2yD4lM1JCb1ITyAJUIUgRXdGMM6X8hk75aBJfvSw2E-Qer8aWmD6MD-t7QFmzsl2jZ0rs1rt4y4ZbAaoNTVAcw\u0026h=6erUqLhTOBZWFs5vaoAFA_waRQNSpZfF45ybSKU_arU", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "31" ], + "x-ms-client-request-id": [ "0b451c0a-5e71-4000-9a5f-8c50f1c2cf80" ], + "CommandName": [ "Az.StackHCIVm.internal\\Start-AzStackHCIVmVirtualMachine" ], + "FullCommandName": [ "Start-AzStackHCIVmVirtualMachine_Start" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8f02ce56-0000-0100-0000-6549ce0d0000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "b7a8498c-8a29-4c47-8430-f1fa856cfb1e" ], + "x-ms-correlation-request-id": [ "0762d57b-864c-4923-8914-e5243e16b87e" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T054152Z:0762d57b-864c-4923-8914-e5243e16b87e" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 3D7D9548028742698F683FB6F061DC7C Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:41:52Z" ], + "Date": [ "Tue, 07 Nov 2023 05:41:52 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "646" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/26767eb5-18ca-46e3-a8de-d887adcd6c91*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"name\":\"26767eb5-18ca-46e3-a8de-d887adcd6c91*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default\",\"status\":\"Succeeded\",\"startTime\":\"2023-11-07T05:40:21.0594742Z\",\"endTime\":\"2023-11-07T05:41:33.1255666Z\",\"error\":{},\"properties\":null}" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Delete+$DELETE+https://management.azure.com//subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default?api-version=2023-09-01-preview+1": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com//subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "32" ], + "x-ms-client-request-id": [ "1ab7f84d-cdb8-4d36-adef-e736b65ddbad" ], + "CommandName": [ "Az.StackHCIVm.internal\\Remove-AzStackHCIVmVirtualMachine" ], + "FullCommandName": [ "Remove-AzStackHCIVmVirtualMachine_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"46039852-0000-0100-0000-6549ce210000\"" ], + "Location": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/8b559b2c-e173-4ecc-9022-ede70b286c1f*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349325135890778\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=kWLbB4jYSHbCRfp-7HhlpFQ72IdI26Xnox8WlYNTiLcLYdtk5Vox2SaAanNqHhUKhPUtc_-CtLpCDjCItCsYm3fF4joTXji86AMwF7UoXk3n0O598Xh3zsGwKkQQndjZZl-6MEsDmk-liDUrAqEDry6oAkkmV_Hd1BdRtuY_r_Ni72vbjMPqbDwVjnysKwEbLdVZCvuXq1pTJpSsFro1qWwcTYs7HsHRNldEeEUgrsgDFyFIP869Uyh0SYbKGLpHTwf2zDOtN8h7F4NR55gAaOKbfkAz3iqGCg1PK6g-OU7YN6TAFzNyYl0tRzsZITs-9CsBIEonGnEAmM5MbDymww\u0026h=q-IBAmwEQnyvyE2bVOQFTaFd3IaA2PN5HFpY1lfE7eo" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14999" ], + "x-ms-providerhub-traffic": [ "True" ], + "Azure-AsyncOperation": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/8b559b2c-e173-4ecc-9022-ede70b286c1f*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349325135734478\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=H01yxdz-_tMQD1-DjFSNxd_fmfO2ggu5lbA70_DYx7e3S8UFh0QwfGkcpCTEtc3JoUVWMBX_TkHCgN6Zv0mMINwXnDBOrligjwdT23TlOz_X6aGiX3t9iCi7ZF9ljBudCt7-uH0zoS68EHi0ar9TFmULBe4SzfJ-BRIFbx3f0rumpXeLsmZPdiEKQ06hvKuX4TUuJ7pWmiVI2VGpAS4oKLEI5ruIfzsGdb0z0HYllDn6MLOAkV9HoHfD8l2qfT88l6jXEFYZbcHxRUnuJ7nfdkTHSJv2UKWxU1YM6p2Z_2CyUUcmnrN9xwTd5j8um7cortCyFRq1Z43_5fFu6nPSJg\u0026h=B7WgAcyeGyIJexe-sARpQux8c_v-gAbKqe2aR2lDbJI" ], + "x-ms-request-id": [ "8b559b2c-e173-4ecc-9022-ede70b286c1f" ], + "x-ms-correlation-request-id": [ "55f95943-8722-4f58-8df4-66b4b19591b6" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T054153Z:55f95943-8722-4f58-8df4-66b4b19591b6" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 0D517134145645FD83F5BB56ABEEE5A5 Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:41:52Z" ], + "Date": [ "Tue, 07 Nov 2023 05:41:53 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "4" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "bnVsbA==" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Delete+$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/8b559b2c-e173-4ecc-9022-ede70b286c1f*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349325135734478\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=H01yxdz-_tMQD1-DjFSNxd_fmfO2ggu5lbA70_DYx7e3S8UFh0QwfGkcpCTEtc3JoUVWMBX_TkHCgN6Zv0mMINwXnDBOrligjwdT23TlOz_X6aGiX3t9iCi7ZF9ljBudCt7-uH0zoS68EHi0ar9TFmULBe4SzfJ-BRIFbx3f0rumpXeLsmZPdiEKQ06hvKuX4TUuJ7pWmiVI2VGpAS4oKLEI5ruIfzsGdb0z0HYllDn6MLOAkV9HoHfD8l2qfT88l6jXEFYZbcHxRUnuJ7nfdkTHSJv2UKWxU1YM6p2Z_2CyUUcmnrN9xwTd5j8um7cortCyFRq1Z43_5fFu6nPSJg\u0026h=B7WgAcyeGyIJexe-sARpQux8c_v-gAbKqe2aR2lDbJI+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/8b559b2c-e173-4ecc-9022-ede70b286c1f*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349325135734478\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=H01yxdz-_tMQD1-DjFSNxd_fmfO2ggu5lbA70_DYx7e3S8UFh0QwfGkcpCTEtc3JoUVWMBX_TkHCgN6Zv0mMINwXnDBOrligjwdT23TlOz_X6aGiX3t9iCi7ZF9ljBudCt7-uH0zoS68EHi0ar9TFmULBe4SzfJ-BRIFbx3f0rumpXeLsmZPdiEKQ06hvKuX4TUuJ7pWmiVI2VGpAS4oKLEI5ruIfzsGdb0z0HYllDn6MLOAkV9HoHfD8l2qfT88l6jXEFYZbcHxRUnuJ7nfdkTHSJv2UKWxU1YM6p2Z_2CyUUcmnrN9xwTd5j8um7cortCyFRq1Z43_5fFu6nPSJg\u0026h=B7WgAcyeGyIJexe-sARpQux8c_v-gAbKqe2aR2lDbJI", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "33" ], + "x-ms-client-request-id": [ "1ab7f84d-cdb8-4d36-adef-e736b65ddbad" ], + "CommandName": [ "Az.StackHCIVm.internal\\Remove-AzStackHCIVmVirtualMachine" ], + "FullCommandName": [ "Remove-AzStackHCIVmVirtualMachine_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8f02a259-0000-0100-0000-6549ce210000\"" ], + "Location": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/8b559b2c-e173-4ecc-9022-ede70b286c1f*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349325437417518\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=aLyPUSjsTTYm9sU1lCIo-7PYdxl33z-khVezMjQeQyDr_3O8s9CKxru5aus-u2wW4hMCD5hEUlj5g2yVN7WGbMpSxliXhiMJt3kdUXAS12KQgMh2oieGzG6JsLbjudyC1wNcP_w7_SFlRcyBUsWn9eaeR-DEtCR5Et12Hh5NjHkSS2UZi2Yf212q3nkdSYyn_reIY_zlvY0dbRvWtdn748KsNLWuZ9naA1cPlssTlSYeqedjq4yCfrogcF0wyVxtVTxlsjeLql6hxr0VzCtRNEBbYvoIfI05pw_5ImcmTUeIavn9buCli8xTxdoU-0mYiVfWj9AegkBUxtH3mTTpZQ\u0026h=QXZEitvXkhjOJy39Po-Q9-ufqUgdH4IjmemgHPLT_hc" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "Azure-AsyncOperation": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/8b559b2c-e173-4ecc-9022-ede70b286c1f*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349325437261280\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=fgW6kbDr6bguX4zJC0_6SjwLqhbs_bVr_hTgIQPrEU8Ss-4nIcqWiEoKys-0HikZXSrVmKoQBIswlF5NwZcMKkcq4PGKlLZ6AkhFPFw5XInTTj9_GKsUKFqC4P3ysH3wHGJCB2v-ehrhZXOcbtvXVn-6Fxe3zWPMQJjcSsmcmKjCX8zXLBjGlt87u6UD_Dx7FrG_qbvzItDEsJtjRz8KHBBuU4p1MnFjsIIGcAtCnEDSd4iNLojK-RWREh55ZOzaafyMKpDlF1QZwq_esM7vcO_TrLBtx0rOCbnvrayPUny7Z4j4sldaHKj6Yzl73TugohJBRuUKJ-VGQiHTqzosrg\u0026h=oe02PA8P2gGc7SdC8tlrqztiuNde_-2Qnteeru29et0" ], + "x-ms-request-id": [ "3b088820-5736-4a47-85f2-a761c95028c7" ], + "x-ms-correlation-request-id": [ "d0a4b867-10b3-43e7-a53e-f02bd3685a02" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T054223Z:d0a4b867-10b3-43e7-a53e-f02bd3685a02" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: F419BAA46D7E4CC19AA04D502C95F3CC Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:42:23Z" ], + "Date": [ "Tue, 07 Nov 2023 05:42:23 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "575" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/8b559b2c-e173-4ecc-9022-ede70b286c1f*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"name\":\"8b559b2c-e173-4ecc-9022-ede70b286c1f*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default\",\"status\":\"Deleting\",\"startTime\":\"2023-11-07T05:41:53.2579303Z\"}" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Delete+$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/8b559b2c-e173-4ecc-9022-ede70b286c1f*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349325437261280\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=fgW6kbDr6bguX4zJC0_6SjwLqhbs_bVr_hTgIQPrEU8Ss-4nIcqWiEoKys-0HikZXSrVmKoQBIswlF5NwZcMKkcq4PGKlLZ6AkhFPFw5XInTTj9_GKsUKFqC4P3ysH3wHGJCB2v-ehrhZXOcbtvXVn-6Fxe3zWPMQJjcSsmcmKjCX8zXLBjGlt87u6UD_Dx7FrG_qbvzItDEsJtjRz8KHBBuU4p1MnFjsIIGcAtCnEDSd4iNLojK-RWREh55ZOzaafyMKpDlF1QZwq_esM7vcO_TrLBtx0rOCbnvrayPUny7Z4j4sldaHKj6Yzl73TugohJBRuUKJ-VGQiHTqzosrg\u0026h=oe02PA8P2gGc7SdC8tlrqztiuNde_-2Qnteeru29et0+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/8b559b2c-e173-4ecc-9022-ede70b286c1f*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349325437261280\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=fgW6kbDr6bguX4zJC0_6SjwLqhbs_bVr_hTgIQPrEU8Ss-4nIcqWiEoKys-0HikZXSrVmKoQBIswlF5NwZcMKkcq4PGKlLZ6AkhFPFw5XInTTj9_GKsUKFqC4P3ysH3wHGJCB2v-ehrhZXOcbtvXVn-6Fxe3zWPMQJjcSsmcmKjCX8zXLBjGlt87u6UD_Dx7FrG_qbvzItDEsJtjRz8KHBBuU4p1MnFjsIIGcAtCnEDSd4iNLojK-RWREh55ZOzaafyMKpDlF1QZwq_esM7vcO_TrLBtx0rOCbnvrayPUny7Z4j4sldaHKj6Yzl73TugohJBRuUKJ-VGQiHTqzosrg\u0026h=oe02PA8P2gGc7SdC8tlrqztiuNde_-2Qnteeru29et0", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "34" ], + "x-ms-client-request-id": [ "1ab7f84d-cdb8-4d36-adef-e736b65ddbad" ], + "CommandName": [ "Az.StackHCIVm.internal\\Remove-AzStackHCIVmVirtualMachine" ], + "FullCommandName": [ "Remove-AzStackHCIVmVirtualMachine_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8f02a259-0000-0100-0000-6549ce210000\"" ], + "Location": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/8b559b2c-e173-4ecc-9022-ede70b286c1f*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349325740143744\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=Dedoa7C0x7LGczHfe5ZFPwPalNln_ftA3-jhpLJLdXi187iAl0U81OxrMIOWj2ojMF7phyWg42EpVJ3aR4PsPtPo7qZOfAU5ZX0FF0hjPtvul_CpvbfdiK8OZnLwYwp953KA20EIP95kOOpg8c5E5PQRys5rTRShhNaFqxV6_STW-vTWNOxDTiq0vVVbLsdOgVUjEAvxhp2LehreIXB7E_PsTQToIhfAo4gqb755l9Xlz-dRxRHLRUTZPy4rOnVAkHjOYOtoz2ihANmsnmoS_fmeWKBMOW_TFxk02lWy9BS-jv_2ncJ6ctjpnzFpR7NEtygMRbpQTYJxE06xLcSvog\u0026h=tHm7smfVzpfqDQ9j6EJ_46MiCH35qwvzi35FCrmRfI8" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "Azure-AsyncOperation": [ "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/8b559b2c-e173-4ecc-9022-ede70b286c1f*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349325740143744\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=Dedoa7C0x7LGczHfe5ZFPwPalNln_ftA3-jhpLJLdXi187iAl0U81OxrMIOWj2ojMF7phyWg42EpVJ3aR4PsPtPo7qZOfAU5ZX0FF0hjPtvul_CpvbfdiK8OZnLwYwp953KA20EIP95kOOpg8c5E5PQRys5rTRShhNaFqxV6_STW-vTWNOxDTiq0vVVbLsdOgVUjEAvxhp2LehreIXB7E_PsTQToIhfAo4gqb755l9Xlz-dRxRHLRUTZPy4rOnVAkHjOYOtoz2ihANmsnmoS_fmeWKBMOW_TFxk02lWy9BS-jv_2ncJ6ctjpnzFpR7NEtygMRbpQTYJxE06xLcSvog\u0026h=tHm7smfVzpfqDQ9j6EJ_46MiCH35qwvzi35FCrmRfI8" ], + "x-ms-request-id": [ "0c309943-2f87-469e-ba72-ea60b4c813db" ], + "x-ms-correlation-request-id": [ "f51eaa4c-ca34-4de3-a68f-f0e2d8691f00" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T054254Z:f51eaa4c-ca34-4de3-a68f-f0e2d8691f00" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 166C8D51CFA54F279D9A92DC83477217 Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:42:53Z" ], + "Date": [ "Tue, 07 Nov 2023 05:42:53 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "575" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/8b559b2c-e173-4ecc-9022-ede70b286c1f*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"name\":\"8b559b2c-e173-4ecc-9022-ede70b286c1f*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default\",\"status\":\"Deleting\",\"startTime\":\"2023-11-07T05:41:53.2579303Z\"}" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Delete+$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/8b559b2c-e173-4ecc-9022-ede70b286c1f*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349325740143744\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=Dedoa7C0x7LGczHfe5ZFPwPalNln_ftA3-jhpLJLdXi187iAl0U81OxrMIOWj2ojMF7phyWg42EpVJ3aR4PsPtPo7qZOfAU5ZX0FF0hjPtvul_CpvbfdiK8OZnLwYwp953KA20EIP95kOOpg8c5E5PQRys5rTRShhNaFqxV6_STW-vTWNOxDTiq0vVVbLsdOgVUjEAvxhp2LehreIXB7E_PsTQToIhfAo4gqb755l9Xlz-dRxRHLRUTZPy4rOnVAkHjOYOtoz2ihANmsnmoS_fmeWKBMOW_TFxk02lWy9BS-jv_2ncJ6ctjpnzFpR7NEtygMRbpQTYJxE06xLcSvog\u0026h=tHm7smfVzpfqDQ9j6EJ_46MiCH35qwvzi35FCrmRfI8+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/8b559b2c-e173-4ecc-9022-ede70b286c1f*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349325740143744\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=Dedoa7C0x7LGczHfe5ZFPwPalNln_ftA3-jhpLJLdXi187iAl0U81OxrMIOWj2ojMF7phyWg42EpVJ3aR4PsPtPo7qZOfAU5ZX0FF0hjPtvul_CpvbfdiK8OZnLwYwp953KA20EIP95kOOpg8c5E5PQRys5rTRShhNaFqxV6_STW-vTWNOxDTiq0vVVbLsdOgVUjEAvxhp2LehreIXB7E_PsTQToIhfAo4gqb755l9Xlz-dRxRHLRUTZPy4rOnVAkHjOYOtoz2ihANmsnmoS_fmeWKBMOW_TFxk02lWy9BS-jv_2ncJ6ctjpnzFpR7NEtygMRbpQTYJxE06xLcSvog\u0026h=tHm7smfVzpfqDQ9j6EJ_46MiCH35qwvzi35FCrmRfI8", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "35" ], + "x-ms-client-request-id": [ "1ab7f84d-cdb8-4d36-adef-e736b65ddbad" ], + "CommandName": [ "Az.StackHCIVm.internal\\Remove-AzStackHCIVmVirtualMachine" ], + "FullCommandName": [ "Remove-AzStackHCIVmVirtualMachine_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8502c299-0000-0800-0000-6549ce750000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "628ea677-c2e3-46d8-a1a5-4bc18e97284d" ], + "x-ms-correlation-request-id": [ "d5588924-1d8c-41af-9fb6-b051c50ebdcc" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T054324Z:d5588924-1d8c-41af-9fb6-b051c50ebdcc" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 724ED05BACF74934A26955F334289931 Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:43:24Z" ], + "Date": [ "Tue, 07 Nov 2023 05:43:23 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "594" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/eastus/operationStatuses/8b559b2c-e173-4ecc-9022-ede70b286c1f*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"name\":\"8b559b2c-e173-4ecc-9022-ede70b286c1f*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default\",\"status\":\"Succeeded\",\"startTime\":\"2023-11-07T05:41:53.2579303Z\",\"properties\":null}" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Delete+$GET+https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/8b559b2c-e173-4ecc-9022-ede70b286c1f*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349325135734478\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=H01yxdz-_tMQD1-DjFSNxd_fmfO2ggu5lbA70_DYx7e3S8UFh0QwfGkcpCTEtc3JoUVWMBX_TkHCgN6Zv0mMINwXnDBOrligjwdT23TlOz_X6aGiX3t9iCi7ZF9ljBudCt7-uH0zoS68EHi0ar9TFmULBe4SzfJ-BRIFbx3f0rumpXeLsmZPdiEKQ06hvKuX4TUuJ7pWmiVI2VGpAS4oKLEI5ruIfzsGdb0z0HYllDn6MLOAkV9HoHfD8l2qfT88l6jXEFYZbcHxRUnuJ7nfdkTHSJv2UKWxU1YM6p2Z_2CyUUcmnrN9xwTd5j8um7cortCyFRq1Z43_5fFu6nPSJg\u0026h=B7WgAcyeGyIJexe-sARpQux8c_v-gAbKqe2aR2lDbJI+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/8b559b2c-e173-4ecc-9022-ede70b286c1f*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB?api-version=2023-09-01-preview\u0026t=638349325135734478\u0026c=MIIHHjCCBgagAwIBAgITfwI8ooo2761TEgO3SgAEAjyiijANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDIwHhcNMjMxMTAxMTc1NTI2WhcNMjQxMDI2MTc1NTI2WjBAMT4wPAYDVQQDEzVhc3luY29wZXJhdGlvbnNpZ25pbmdjZXJ0aWZpY2F0ZS5tYW5hZ2VtZW50LmF6dXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0WQLjgbZj70uXwL_AnKvEas1GVvOB7Og4giEY7H0L78RFiY2-CzzgMKyZV8H3ACZxqQoBMWsq9XAf4iUNAer7s23VPyWkoVdr2uTc8SCvur4qja77OTMKiRVU277ViRu_Mb-fJvQKeRO3Q8A4Sg1A63a2VQ_WlyOCHPBj-gUF0zU4SYnlqSYGcNmuhCjtHpVvF_N3CGz0JlGTo3ia0wmks2y95IHeD0lcr0AgP73_eafbKafZn4Z56GdC3lngKdhyEiQi_kPyxaydv1PfV2xX9OLKvB19e9jLB43QA9r5k5DsAhqtv6eqwHBdW07S9MCMu8kwoYUpX1TTGapizc6ECAwEAAaOCBAswggQHMCcGCSsGAQQBgjcVCgQaMBgwCgYIKwYBBQUHAwEwCgYIKwYBBQUHAwIwPQYJKwYBBAGCNxUHBDAwLgYmKwYBBAGCNxUIhpDjDYTVtHiE8Ys-hZvdFs6dEoFggvX2K4Py0SACAWQCAQowggHaBggrBgEFBQcBAQSCAcwwggHIMGYGCCsGAQUFBzAChlpodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpaW5mcmEvQ2VydHMvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MFYGCCsGAQUFBzAChkpodHRwOi8vY3JsMi5hbWUuZ2JsL2FpYS9CTDJQS0lJTlRDQTAxLkFNRS5HQkxfQU1FJTIwSW5mcmElMjBDQSUyMDAyKDQpLmNydDBWBggrBgEFBQcwAoZKaHR0cDovL2NybDMuYW1lLmdibC9haWEvQkwyUEtJSU5UQ0EwMS5BTUUuR0JMX0FNRSUyMEluZnJhJTIwQ0ElMjAwMig0KS5jcnQwVgYIKwYBBQUHMAKGSmh0dHA6Ly9jcmw0LmFtZS5nYmwvYWlhL0JMMlBLSUlOVENBMDEuQU1FLkdCTF9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3J0MB0GA1UdDgQWBBTwk8yVBP3k-Qa8LdSw6mv--mLIvDAOBgNVHQ8BAf8EBAMCBaAwggE1BgNVHR8EggEsMIIBKDCCASSgggEgoIIBHIZCaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMi5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JshjRodHRwOi8vY3JsNC5hbWUuZ2JsL2NybC9BTUUlMjBJbmZyYSUyMENBJTIwMDIoNCkuY3JsMBcGA1UdIAQQMA4wDAYKKwYBBAGCN3sBATAfBgNVHSMEGDAWgBSuecJrXSWIEwb2BwnDl3x7l48dVTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAKR8h2puMUi3SGdIfblcEylOBfcaCRtDDIvC64QKLae7vOAe1f8SpXEFfYeIl5xydb8lEUYApxL701SQSy-NPuBuuQ0CIMKjZ-xCj9VbjQIykosQBVJvxp5I0TplyumFiehQP3zZuc1PZ2hg05aq3CKSbJGKFlow_8P9RN66yeKWGE7SWV9NZThEL8VfEXjl_ITgWb-L1SmnFKTdOVNVDQoRjjX-JqVobqh0O4K0dsPapDoAdqjIECodvocGyWtCEwIk-j8yyBxqX_JzzumMzxUMrxCjaosaJVOvoJB7vh6WuiYfHondyzaGqjm9Bjpqj46bQXojx6xALlzNX5x_j_g\u0026s=H01yxdz-_tMQD1-DjFSNxd_fmfO2ggu5lbA70_DYx7e3S8UFh0QwfGkcpCTEtc3JoUVWMBX_TkHCgN6Zv0mMINwXnDBOrligjwdT23TlOz_X6aGiX3t9iCi7ZF9ljBudCt7-uH0zoS68EHi0ar9TFmULBe4SzfJ-BRIFbx3f0rumpXeLsmZPdiEKQ06hvKuX4TUuJ7pWmiVI2VGpAS4oKLEI5ruIfzsGdb0z0HYllDn6MLOAkV9HoHfD8l2qfT88l6jXEFYZbcHxRUnuJ7nfdkTHSJv2UKWxU1YM6p2Z_2CyUUcmnrN9xwTd5j8um7cortCyFRq1Z43_5fFu6nPSJg\u0026h=B7WgAcyeGyIJexe-sARpQux8c_v-gAbKqe2aR2lDbJI", + "Content": null, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "36" ], + "x-ms-client-request-id": [ "1ab7f84d-cdb8-4d36-adef-e736b65ddbad" ], + "CommandName": [ "Az.StackHCIVm.internal\\Remove-AzStackHCIVmVirtualMachine" ], + "FullCommandName": [ "Remove-AzStackHCIVmVirtualMachine_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"8502c299-0000-0800-0000-6549ce750000\"" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "x-ms-request-id": [ "a3ae980d-65ee-4016-a1a6-e90a3a14196b" ], + "x-ms-correlation-request-id": [ "0ae62b91-36d7-4aa3-9e55-abf3b0acf292" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T054324Z:0ae62b91-36d7-4aa3-9e55-abf3b0acf292" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 4921434FB14A46E0B0415B8E9666D441 Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:43:24Z" ], + "Date": [ "Tue, 07 Nov 2023 05:43:23 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "594" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/8b559b2c-e173-4ecc-9022-ede70b286c1f*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"name\":\"8b559b2c-e173-4ecc-9022-ede70b286c1f*54B5010753498496B6B2043B014447B3D791406422CEB117DBB179C180C5E5BB\",\"resourceId\":\"/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default\",\"status\":\"Succeeded\",\"startTime\":\"2023-11-07T05:41:53.2579303Z\",\"properties\":null}" + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2?api-version=2023-03-15-preview+6": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2?api-version=2023-03-15-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "37" ], + "x-ms-client-request-id": [ "e2b67ede-99c0-4b7e-bb9c-9a9574825319" ], + "CommandName": [ "Az.StackHCIVm.internal\\Remove-AzStackHCIVmMachine" ], + "FullCommandName": [ "Remove-AzStackHCIVmMachine_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-request-id": [ "807a1d7f-c229-4be9-b48e-6fc5a9f966d4" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14999" ], + "x-ms-correlation-request-id": [ "0e728249-ac84-4e57-9a5f-2368811b5d7e" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T054328Z:0e728249-ac84-4e57-9a5f-2368811b5d7e" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: B92E5DC04082405DB4213176D7570BFA Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:43:24Z" ], + "Date": [ "Tue, 07 Nov 2023 05:43:27 GMT" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "AzStackHCIVmVirtualMachine+[NoContext]+Delete+$GET+https://management.azure.com//subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default?api-version=2023-09-01-preview+7": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com//subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.HybridCompute/machines/manualvmtest2/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default?api-version=2023-09-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "38" ], + "x-ms-client-request-id": [ "3bf3b98c-49cd-4e7e-8495-660e0d7d538e" ], + "CommandName": [ "Az.StackHCIVm.internal\\Get-AzStackHCIVmVirtualMachine" ], + "FullCommandName": [ "Get-AzStackHCIVmVirtualMachine_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 404, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-failure-cause": [ "gateway" ], + "x-ms-request-id": [ "670785fb-6153-41ae-9bde-17067bb8d9a5" ], + "x-ms-correlation-request-id": [ "670785fb-6153-41ae-9bde-17067bb8d9a5" ], + "x-ms-routing-request-id": [ "WESTUS2:20231107T054328Z:670785fb-6153-41ae-9bde-17067bb8d9a5" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 52DBD7CD68ED40978223FAAC331FA35F Ref B: CO6AA3150218033 Ref C: 2023-11-07T05:43:28Z" ], + "Date": [ "Tue, 07 Nov 2023 05:43:27 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "233" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"error\":{\"code\":\"ResourceNotFound\",\"message\":\"The Resource \u0027Microsoft.HybridCompute/machines/manualvmtest2\u0027 under resource group \u0027AltaylSnClus-rg\u0027 was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix\"}}" + } + } +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/test/AzStackHciVmLogicalNetwork.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHciVmLogicalNetwork.Tests.ps1 new file mode 100644 index 000000000000..5fd039f64c5c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHciVmLogicalNetwork.Tests.ps1 @@ -0,0 +1,45 @@ +if(($null -eq $TestName) -or ($TestName -contains 'AzStackHCIVmLogicalNetwork')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'AzStackHCIVmLogicalNetwork.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'AzStackHCIVmLogicalNetwork' { + It 'Create Logical Network ' { + New-AzStackHciVMLogicalNetwork -Name $env.lnetName -SubscriptionId $env.subscriptionId -ResourceGroupName $env.resourceGroupName -CustomLocationId $env.customLocationId -Location $env.location -VmSwitchName $env.vmSwitchName | Select-Object -Property ProvisioningState | Should -BeExactly "@{ProvisioningState=Succeeded}" + } + + It 'List' { + { + $config = Get-AzStackHCIVMLogicalNetwork -ResourceGroupName $env.resourceGroupName + $config.Count | Should -BeGreaterThan 0 + } | Should -Not -Throw + } + + It 'Get' { + { + $config = Get-AzStackHCIVMLogicalNetwork -Name $env.lnetName -ResourceGroupName $env.resourceGroupName + $config.Name | Should -Be $env.lnetName + } | Should -Not -Throw + } + + + It 'Delete'{ + { + Remove-AzStackHCIVMLogicalNetwork -Name $env.lnetName -ResourceGroupName $env.resourceGroupName -Force + $config = Get-AzStackHCIVMLogicalNetwork -Name $env.lnetName-ResourceGroupName $env.resourceGroupName + $config | Should -Be $null + } | Should -Throw + } + +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/AzStackHciVmNetworkInterface.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHciVmNetworkInterface.Tests.ps1 new file mode 100644 index 000000000000..397943bc6144 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHciVmNetworkInterface.Tests.ps1 @@ -0,0 +1,45 @@ +if(($null -eq $TestName) -or ($TestName -contains 'AzStackHCIVmNetworkInterface')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'AzStackHCIVmNetworkInterface.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'AzStackHCIVmNetworkInterface' { + It 'Create Network Interface ' { + New-AzStackHciVMNetworkInterface -Name $env.nicName -SubscriptionId $env.subscriptionId -ResourceGroupName $env.resourceGroupName -CustomLocationId $env.customLocationId -Location $env.location -SubnetId "/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/logicalNetworks/bugbashlnet" | Select-Object -Property ProvisioningState | Should -BeExactly "@{ProvisioningState=Succeeded}" + } + + It 'List' { + { + $config = Get-AzStackHCIVMNetworkInterface -ResourceGroupName $env.resourceGroupName + $config.Count | Should -BeGreaterThan 0 + } | Should -Not -Throw + } + + It 'Get' { + { + $config = Get-AzStackHCIVMNetworkInterface -Name $env.nicName -ResourceGroupName $env.resourceGroupName + $config.Name | Should -Be $env.nicName + } | Should -Not -Throw + } + + + It 'Delete'{ + { + Remove-AzStackHCIVMNetworkInterface -Name $env.nicName -ResourceGroupName $env.resourceGroupName -Force + $config = Get-AzStackHCIVMNetworkInterface -Name $env.nicName -ResourceGroupName $env.resourceGroupName + $config | Should -Be $null + } | Should -Throw + } + +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/test/AzStackHciVmStoragePath.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHciVmStoragePath.Tests.ps1 new file mode 100644 index 000000000000..3776b8f774fa --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHciVmStoragePath.Tests.ps1 @@ -0,0 +1,45 @@ +if(($null -eq $TestName) -or ($TestName -contains 'AzStackHCIVmStoragePath')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'AzStackHCIVmStoragePath.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'AzStackHCIVmStoragePath' { + It 'Create Storage Path ' { + New-AzStackHCIVMStoragePath -Name $env.storagePathName -SubscriptionId $env.subscriptionId -ResourceGroupName $env.resourceGroupName -CustomLocationId $env.customLocationId -Location $env.location -Path "C:\\ClusterStorage\\Volume1\\testPath1106" | Select-Object -Property ProvisioningState | Should -BeExactly "@{ProvisioningState=Succeeded}" + } + + It 'List' { + { + $config = Get-AzStackHCIVMStoragePath -ResourceGroupName $env.resourceGroupName + $config.Count | Should -BeGreaterThan 0 + } | Should -Not -Throw + } + + It 'Get' { + { + $config = Get-AzStackHCIVMStoragePath -Name $env.storagePathName -ResourceGroupName $env.resourceGroupName + $config.Name | Should -Be $env.storagePathName + } | Should -Not -Throw + } + + + It 'Delete'{ + { + Remove-AzStackHCIVMStoragePath -Name $env.storagePathName -ResourceGroupName $env.resourceGroupName -Force + $config = Get-AzStackHCIVMStoragePath -Name $env.storagePathName -ResourceGroupName $env.resourceGroupName + $config | Should -Be $null + } | Should -Throw + } + +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/test/AzStackHciVmVirtualMachine.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHciVmVirtualMachine.Tests.ps1 new file mode 100644 index 000000000000..23211792670c --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/AzStackHciVmVirtualMachine.Tests.ps1 @@ -0,0 +1,53 @@ +if(($null -eq $TestName) -or ($TestName -contains 'AzStackHCIVmVirtualMachine')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'AzStackHCIVmVirtualMachine.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'AzStackHCIVmVirtualMachine' { + It 'Create Virtual Machine ' { + + New-AzStackHciVMVirtualMachine -Name manualvmtest2 -OsType Linux -ImageId "/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.AzureStackHCI/galleryImages/bugbashimage" -VmSize "Standard_K8S_v1" -ComputerName "manualvmtest2" -ResourceGroupName "AltaylSnClus-rg" -CustomLocationId "/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl" -Location "eastus" -ProvisionVMAgent:$false -ProvisionVMConfigAgent:$false -SubscriptionId $env.subscriptionId | Select-Object -Property ProvisioningState | Should -BeExactly "@{ProvisioningState=Succeeded}" + + } + + It 'Get' { + { + $config = Get-AzStackHCIVMVirtualMachine -Name manualvmtest2 -ResourceGroupName $env.resourceGroupName + $config.Name | Should -Be "default" + } | Should -Not -Throw + } + + It 'Stop' { + { + Stop-AzStackHCIVMVirtualMachine -Name manualvmtest2 -ResourceGroupName $env.resourceGroupName + } | Should -Not -Throw + } + + It 'Start' { + { + Start-AzStackHCIVMVirtualMachine -Name manualvmtest2 -ResourceGroupName $env.resourceGroupName + } | Should -Not -Throw + } + + + It 'Delete'{ + { + + Remove-AzStackHCIVMVirtualMachine -Name manualvmtest2 -ResourceGroupName $env.resourceGroupName -Force + $config = Get-AzStackHCIVMVirtualMachine -Name manualvmtest2 -ResourceGroupName $env.resourceGroupName + $config | Should -Be $null + } | Should -Throw + } + +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Get-AzStackHCIVmImage.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Get-AzStackHCIVmImage.Tests.ps1 new file mode 100644 index 000000000000..e3b38e577131 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Get-AzStackHCIVmImage.Tests.ps1 @@ -0,0 +1,30 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzStackHCIVmImage.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzStackHCIVmImage' { + It 'BySubscription' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByName' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByResourceGroup' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Get-AzStackHCIVmVirtualMachine.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Get-AzStackHCIVmVirtualMachine.Tests.ps1 new file mode 100644 index 000000000000..292643604eef --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Get-AzStackHCIVmVirtualMachine.Tests.ps1 @@ -0,0 +1,30 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzStackHCIVmVirtualMachine.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzStackHCIVmVirtualMachine' { + It 'BySubscription' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByName' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByResourceGroup' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Get-AzStackHciVMLogicalNetwork.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Get-AzStackHciVMLogicalNetwork.Tests.ps1 new file mode 100644 index 000000000000..2fc408e023ec --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Get-AzStackHciVMLogicalNetwork.Tests.ps1 @@ -0,0 +1,30 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzStackHciVMLogicalNetwork.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzStackHciVMLogicalNetwork' { + It 'List1' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Get-AzStackHciVMNetworkInterface.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Get-AzStackHciVMNetworkInterface.Tests.ps1 new file mode 100644 index 000000000000..58bfab60b596 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Get-AzStackHciVMNetworkInterface.Tests.ps1 @@ -0,0 +1,30 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzStackHciVMNetworkInterface.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzStackHciVMNetworkInterface' { + It 'List1' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Get-AzStackHciVMStoragePath.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Get-AzStackHciVMStoragePath.Tests.ps1 new file mode 100644 index 000000000000..51a2fff21c67 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Get-AzStackHciVMStoragePath.Tests.ps1 @@ -0,0 +1,30 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzStackHciVMStoragePath.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzStackHciVMStoragePath' { + It 'List1' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Get-AzStackHciVMVirtualHardDisk.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Get-AzStackHciVMVirtualHardDisk.Tests.ps1 new file mode 100644 index 000000000000..9cf30f8bbbfb --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Get-AzStackHciVMVirtualHardDisk.Tests.ps1 @@ -0,0 +1,30 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzStackHciVMVirtualHardDisk.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzStackHciVMVirtualHardDisk' { + It 'List1' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/New-AzStackHCIVmImage.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/New-AzStackHCIVmImage.Tests.ps1 new file mode 100644 index 000000000000..129ed49a8bea --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/New-AzStackHCIVmImage.Tests.ps1 @@ -0,0 +1,26 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzStackHCIVmImage.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzStackHCIVmImage' { + It 'MarketplaceURN' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GalleryImage' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Marketplace' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/New-AzStackHCIVmLogicalNetwork.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/New-AzStackHCIVmLogicalNetwork.Tests.ps1 new file mode 100644 index 000000000000..192c82a6e55b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/New-AzStackHCIVmLogicalNetwork.Tests.ps1 @@ -0,0 +1,18 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzStackHCIVmLogicalNetwork.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzStackHCIVmLogicalNetwork' { + It '__AllParameterSets' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/New-AzStackHCIVmNetworkInterface.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/New-AzStackHCIVmNetworkInterface.Tests.ps1 new file mode 100644 index 000000000000..9319791d0978 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/New-AzStackHCIVmNetworkInterface.Tests.ps1 @@ -0,0 +1,18 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzStackHCIVmNetworkInterface.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzStackHCIVmNetworkInterface' { + It '__AllParameterSets' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/New-AzStackHCIVmStoragePath.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/New-AzStackHCIVmStoragePath.Tests.ps1 new file mode 100644 index 000000000000..3d843e5b6d6a --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/New-AzStackHCIVmStoragePath.Tests.ps1 @@ -0,0 +1,18 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzStackHCIVmStoragePath.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzStackHCIVmStoragePath' { + It '__AllParameterSets' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/New-AzStackHCIVmVirtualHardDisk.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/New-AzStackHCIVmVirtualHardDisk.Tests.ps1 new file mode 100644 index 000000000000..7a8c7fbb5e69 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/New-AzStackHCIVmVirtualHardDisk.Tests.ps1 @@ -0,0 +1,18 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzStackHCIVmVirtualHardDisk.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzStackHCIVmVirtualHardDisk' { + It '__AllParameterSets' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/New-AzStackHCIVmVirtualMachine.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/New-AzStackHCIVmVirtualMachine.Tests.ps1 new file mode 100644 index 000000000000..6d1804f6f321 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/New-AzStackHCIVmVirtualMachine.Tests.ps1 @@ -0,0 +1,30 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzStackHCIVmVirtualMachine.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzStackHCIVmVirtualMachine' { + It 'ByImageId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByImageName' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByOsDiskId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByOsDiskName' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/README.md b/src/StackHCI/StackHCIVm.Autorest/test/README.md new file mode 100644 index 000000000000..7c752b4c8c43 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/README.md @@ -0,0 +1,17 @@ +# Test +This directory contains the [Pester](https://www.powershellgallery.com/packages/Pester) tests to run for the module. We use Pester as it is the unofficial standard for PowerShell unit testing. Test stubs for custom cmdlets (created in `..\custom`) will be generated into this folder when `build-module.ps1` is ran. These test stubs will fail automatically, to indicate that tests should be written for custom cmdlets. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: no + +## Details +We allow three testing modes: *live*, *record*, and *playback*. These can be selected using the `-Live`, `-Record`, and `-Playback` switches respectively on the `test-module.ps1` script. This script will run through any `.Tests.ps1` scripts in the `test` folder. If you choose the *record* mode, it will create a `.Recording.json` file of the REST calls between the client and server. Then, when you choose *playback* mode, it will use the `.Recording.json` file to mock the communication between server and client. The *live* mode runs the same as the *record* mode; however, it doesn't create the `.Recording.json` file. + +## Purpose +Custom cmdlets generally encompass additional functionality not described in the REST specification, or combines functionality generated from the REST spec. To validate this functionality continues to operate as intended, creating tests that can be ran and re-ran against custom cmdlets is part of the framework. + +## Usage +To execute tests, run the `test-module.ps1`. To write tests, [this example](https://github.com/pester/Pester/blob/8b9cf4248315e44f1ac6673be149f7e0d7f10466/Examples/Planets/Get-Planet.Tests.ps1#L1) from the Pester repository is very useful for getting started. \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmImage.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmImage.Tests.ps1 new file mode 100644 index 000000000000..6630741db6c5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmImage.Tests.ps1 @@ -0,0 +1,22 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzStackHCIVmImage.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Remove-AzStackHCIVmImage' { + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByName' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmLogicalNetwork.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmLogicalNetwork.Tests.ps1 new file mode 100644 index 000000000000..2becb03ad699 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmLogicalNetwork.Tests.ps1 @@ -0,0 +1,22 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzStackHCIVmLogicalNetwork.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Remove-AzStackHCIVmLogicalNetwork' { + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Delete' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmNetworkInterface.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmNetworkInterface.Tests.ps1 new file mode 100644 index 000000000000..bb6fae0b13c9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmNetworkInterface.Tests.ps1 @@ -0,0 +1,22 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzStackHCIVmNetworkInterface.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Remove-AzStackHCIVmNetworkInterface' { + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByName' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmStoragePath.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmStoragePath.Tests.ps1 new file mode 100644 index 000000000000..5f914226b71b --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmStoragePath.Tests.ps1 @@ -0,0 +1,22 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzStackHCIVmStoragePath.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Remove-AzStackHCIVmStoragePath' { + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByName' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmVirtualHardDisk.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmVirtualHardDisk.Tests.ps1 new file mode 100644 index 000000000000..1a7ce4316fb0 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmVirtualHardDisk.Tests.ps1 @@ -0,0 +1,22 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzStackHCIVmVirtualHardDisk.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Remove-AzStackHCIVmVirtualHardDisk' { + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByName' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmVirtualMachine.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmVirtualMachine.Tests.ps1 new file mode 100644 index 000000000000..5474c2ce9da5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmVirtualMachine.Tests.ps1 @@ -0,0 +1,22 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzStackHCIVmVirtualMachine.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Remove-AzStackHCIVmVirtualMachine' { + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByName' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmVirtualMachineDataDisk.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmVirtualMachineDataDisk.Tests.ps1 new file mode 100644 index 000000000000..4f40050825f2 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmVirtualMachineDataDisk.Tests.ps1 @@ -0,0 +1,22 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzStackHCIVmVirtualMachineDataDisk.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Remove-AzStackHCIVmVirtualMachineDataDisk' { + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByName' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmVirtualMachineNetworkInterface.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmVirtualMachineNetworkInterface.Tests.ps1 new file mode 100644 index 000000000000..6032c6d9e7df --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Remove-AzStackHCIVmVirtualMachineNetworkInterface.Tests.ps1 @@ -0,0 +1,22 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzStackHCIVmVirtualMachineNetworkInterface.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Remove-AzStackHCIVmVirtualMachineNetworkInterface' { + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByName' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Restart-AzStackHCIVmVirtualMachine.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Restart-AzStackHCIVmVirtualMachine.Tests.ps1 new file mode 100644 index 000000000000..92ed34a458f6 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Restart-AzStackHCIVmVirtualMachine.Tests.ps1 @@ -0,0 +1,22 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Restart-AzStackHCIVmVirtualMachine.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Restart-AzStackHCIVmVirtualMachine' { + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByName' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Start-AzStackHCIVmVirtualMachine.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Start-AzStackHCIVmVirtualMachine.Tests.ps1 new file mode 100644 index 000000000000..6ccc95777190 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Start-AzStackHCIVmVirtualMachine.Tests.ps1 @@ -0,0 +1,22 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Start-AzStackHCIVmVirtualMachine.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Start-AzStackHCIVmVirtualMachine' { + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByName' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Stop-AzStackHCIVmVirtualMachine.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Stop-AzStackHCIVmVirtualMachine.Tests.ps1 new file mode 100644 index 000000000000..1af2602af814 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Stop-AzStackHCIVmVirtualMachine.Tests.ps1 @@ -0,0 +1,22 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Stop-AzStackHCIVmVirtualMachine.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Stop-AzStackHCIVmVirtualMachine' { + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByName' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Update-AzStackHCIVmImage.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Update-AzStackHCIVmImage.Tests.ps1 new file mode 100644 index 000000000000..164f19fd4ef5 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Update-AzStackHCIVmImage.Tests.ps1 @@ -0,0 +1,22 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzStackHCIVmImage.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Update-AzStackHCIVmImage' { + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByName' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Update-AzStackHCIVmVirtualMachine.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Update-AzStackHCIVmVirtualMachine.Tests.ps1 new file mode 100644 index 000000000000..9401e0415f04 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Update-AzStackHCIVmVirtualMachine.Tests.ps1 @@ -0,0 +1,22 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzStackHCIVmVirtualMachine.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Update-AzStackHCIVmVirtualMachine' { + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ByName' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Update-AzStackHciVMLogicalNetwork.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Update-AzStackHciVMLogicalNetwork.Tests.ps1 new file mode 100644 index 000000000000..03cdee6b3cb3 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Update-AzStackHciVMLogicalNetwork.Tests.ps1 @@ -0,0 +1,26 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzStackHciVMLogicalNetwork.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Update-AzStackHciVMLogicalNetwork' { + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Update-AzStackHciVMNetworkInterface.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Update-AzStackHciVMNetworkInterface.Tests.ps1 new file mode 100644 index 000000000000..767c39570fef --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Update-AzStackHciVMNetworkInterface.Tests.ps1 @@ -0,0 +1,26 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzStackHciVMNetworkInterface.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Update-AzStackHciVMNetworkInterface' { + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Update-AzStackHciVMStoragePath.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Update-AzStackHciVMStoragePath.Tests.ps1 new file mode 100644 index 000000000000..dd80b9c541e9 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Update-AzStackHciVMStoragePath.Tests.ps1 @@ -0,0 +1,26 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzStackHciVMStoragePath.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Update-AzStackHciVMStoragePath' { + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/Update-AzStackHciVMVirtualHardDisk.Tests.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/Update-AzStackHciVMVirtualHardDisk.Tests.ps1 new file mode 100644 index 000000000000..c6ecaad8e4ee --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/Update-AzStackHciVMVirtualHardDisk.Tests.ps1 @@ -0,0 +1,26 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzStackHciVMVirtualHardDisk.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Update-AzStackHciVMVirtualHardDisk' { + It 'ByResourceId' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/env.json b/src/StackHCI/StackHCIVm.Autorest/test/env.json new file mode 100644 index 000000000000..0032e543e301 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/env.json @@ -0,0 +1,32 @@ +{ + "SubscriptionId": "0709bd7a-8383-4e1d-98c8-f81d1b3443fc", + "Tenant": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "resourceGroupName": "AltaylSnClus-rg", + "location": "eastus", + "mkpImageNameURN": "testMkpImageURN1106", + "mkpImageName": "testMkpImage1106", + "imageName": "testImage1106-2", + "customLocationId": "/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl", + "imagePath": "C:\\ClusterStorage\\Volume1\\vhds\\ubuntu.vhdx", + "osTypeLinux": "Linux", + "osTypeWindows": "Windows", + "offer": "windowsserver", + "publisher": "MicrosoftWindowsServer", + "sku": "2022-datacenter-azure-edition-core", + "version": "20348.1850.230906", + "urn": "microsoftwindowsserver:windowsserver:2022-datacenter-azure-edition-core:20348.1850.230906", + "vhdName": "testVhd1106", + "sizeGb": 2, + "lnetName": "testLnetPowershell1106", + "vmSwitchName": "ExternalSwitch", + "nicName": "testnicPowershell", + "storagePathName": "teststoragepath1106", + "storageContainerPath": "C:\\ClusterStorage\\Volume1\\testPath1106", + "vmImageName": "bugbashimage", + "vmVhdName": "testVhdDisk1106", + "vmImageId": "/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourcegroups/mkclus90-rg/mkclus90-rg/providers/Microsoft.AzureStackHCI/galleryImages/testVmImage", + "vmVhdID": "/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourcegroups/mkclus90-rg/mkclus90-rg/providers/Microsoft.AzureStackHCI/virtualHardDisks/testVhdDisk", + "vmName": "testVmPowershell1106", + "vmSize": "Standard_K8S_v1", + "adminUsername": "localadmin" +} diff --git a/src/StackHCI/StackHCIVm.Autorest/test/envVariables.json b/src/StackHCI/StackHCIVm.Autorest/test/envVariables.json new file mode 100644 index 000000000000..273b207405be --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/envVariables.json @@ -0,0 +1,32 @@ +{ + "SubscriptionId": "0709bd7a-8383-4e1d-98c8-f81d1b3443fc", + "Tenant": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "resourceGroupName": "AltaylSnClus-rg", + "location": "eastus", + "mkpImageNameURN": "testMkpImageURN1106", + "mkpImageName": "testMkpImage1106", + "imageName": "testImage1106-2", + "customLocationId": "/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourceGroups/AltaylSnClus-rg/providers/Microsoft.ExtendedLocation/customLocations/myResourceBridge-cl", + "imagePath": "C:\\ClusterStorage\\Volume1\\vhds\\ubuntu.vhdx", + "osTypeLinux": "Linux", + "osTypeWindows": "Windows", + "offer": "windowsserver", + "publisher": "MicrosoftWindowsServer", + "sku": "2022-datacenter-azure-edition-core", + "version": "20348.1850.230906", + "urn": "microsoftwindowsserver:windowsserver:2022-datacenter-azure-edition-core:20348.1850.230906", + "vhdName": "testVhd1106", + "sizeGb": 2, + "lnetName": "testLnetPowershell1106", + "vmSwitchName": "ExternalSwitch", + "nicName": "testnicPowershell", + "storagePathName": "teststoragepath1106", + "storageContainerPath": "C:\\ClusterStorage\\Volume1\\testPath1106", + "vmImageName": "bugbashimage", + "vmVhdName": "testVhdDisk1106", + "vmImageId": "/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourcegroups/mkclus90-rg/mkclus90-rg/providers/Microsoft.AzureStackHCI/galleryImages/testVmImage", + "vmVhdID": "/subscriptions/0709bd7a-8383-4e1d-98c8-f81d1b3443fc/resourcegroups/mkclus90-rg/mkclus90-rg/providers/Microsoft.AzureStackHCI/virtualHardDisks/testVhdDisk", + "vmName": "testVmPowershell1106", + "vmSize": "Standard_K8S_v1", + "adminUsername": "localadmin" + } \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/test/loadEnv.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/loadEnv.ps1 new file mode 100644 index 000000000000..5f079e89615e --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/loadEnv.ps1 @@ -0,0 +1,29 @@ +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- +$envFile = 'env.json' +if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' +} + +if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) { + $envFilePath = Join-Path $PSScriptRoot $envFile +} else { + $envFilePath = Join-Path $PSScriptRoot '..\$envFile' +} +$env = @{} +if (Test-Path -Path $envFilePath) { + $env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json + $PSDefaultParameterValues=@{"*:SubscriptionId"=$env.SubscriptionId; "*:Tenant"=$env.Tenant} +} \ No newline at end of file diff --git a/src/StackHCI/StackHCIVm.Autorest/test/utils.ps1 b/src/StackHCI/StackHCIVm.Autorest/test/utils.ps1 new file mode 100644 index 000000000000..a537efc2ce67 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/test/utils.ps1 @@ -0,0 +1,31 @@ +function RandomString([bool]$allChars, [int32]$len) { + if ($allChars) { + return -join ((33..126) | Get-Random -Count $len | % {[char]$_}) + } else { + return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) + } +} +$env = @{} +if ($UsePreviousConfigForRecord) { + $previousEnv = Get-Content (Join-Path $PSScriptRoot 'env.json') | ConvertFrom-Json + $previousEnv.psobject.properties | Foreach-Object { $env[$_.Name] = $_.Value } +} +# Add script method called AddWithCache to $env, when useCache is set true, it will try to get the value from the $env first. +# example: $val = $env.AddWithCache('key', $val, $true) +$env | Add-Member -Type ScriptMethod -Value { param( [string]$key, [object]$val, [bool]$useCache) if ($this.Contains($key) -and $useCache) { return $this[$key] } else { $this[$key] = $val; return $val } } -Name 'AddWithCache' +function setupEnv() { + # Preload subscriptionId and tenant from context, which will be used in test + # as default. You could change them if needed. + # For any resources you created for test, you should add it to $env here. + $env = Get-Content -Path (Join-Path $PSScriptRoot "envVariables.json") | ConvertFrom-Json + + $envFile = 'env.json' + if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' + } + set-content -Path (Join-Path $PSScriptRoot $envFile) -Value (ConvertTo-Json $env) +} +function cleanupEnv() { + # Clean resources you create for testing +} + diff --git a/src/StackHCI/StackHCIVm.Autorest/utils/Unprotect-SecureString.ps1 b/src/StackHCI/StackHCIVm.Autorest/utils/Unprotect-SecureString.ps1 new file mode 100644 index 000000000000..cb05b51a6220 --- /dev/null +++ b/src/StackHCI/StackHCIVm.Autorest/utils/Unprotect-SecureString.ps1 @@ -0,0 +1,16 @@ +#This script converts securestring to plaintext + +param( + [Parameter(Mandatory, ValueFromPipeline)] + [System.Security.SecureString] + ${SecureString} +) + +$ssPtr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString) +try { + $plaintext = [System.Runtime.InteropServices.Marshal]::PtrToStringBSTR($ssPtr) +} finally { + [System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($ssPtr) +} + +return $plaintext \ No newline at end of file